#
# tools/Makefile
#
# Copyright (C) 1997 - 1999  Heinz Mauelshagen, Germany
#
# February 1997
#
# lvm tools are free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# 
# lvm tools are distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with GNU CC; see the file COPYING.  If not, write to
# the Free Software Foundation, 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA. 
#
#

SUBDIRS = lib man8 .

#
# Link decision (archive or shared library)
#
# uncomment next line and comment out XLINKER
# if you like binding with static LVM library
## LIBS = $(TOP)/tools/lib/liblvm.a
XLINKER = -Xlinker -rpath $(TOP)/tools/lib -Xlinker -rpath /lib -Xlinker -rpath /usr/lib -llvm

include ../make.tmpl
include tools_and_lib.make.tmpl

LDFLAGS = $(LIBS) -L$(TOP)/tools/lib $(XLINKER)
ALL = $(ALL_SOURCES:.c=)
ALL_RM = $(ALL) $(ALL_OBJECTS)
ALL_SCRIPTS = lvmcreate_initrd

$(ALL_SOURCES):	Makefile lvm_user.h lib/liblvm.h

$(ALL_OBJECTS):	Makefile lib/liblvm.h lvm_user.h

all_this:	$(ALL_OBJECTS) $(ALL) $(ALL_SOURCES) $(ALL_HEADERS) $(OTHER_DEP) $(LIBS)
		@echo ""
		@echo "Done Tools parts"
		@echo ""


strip:		$(ALL_TARGETS)
	@echo
	@echo "Stripping all executables..."
	@echo
	@strip $(ALL_TARGETS) >/dev/null 2>&1

list:		$(ALL_TARGETS)
	@ls -l $(ALL_TARGETS)

l:	list

install-bin:	$(ALL_TARGETS) $(ALL_SCRIPTS)
	@echo "*** Installing $(ALL_TARGETS) $(ALL_SCRIPTS) in $(BINDIR) ***"
	@for f in $(ALL_TARGETS) $(ALL_SCRIPTS); \
	do \
  	   rm -f $(BINDIR)/$$f; \
	   install -o root -g root -m 555 -s $$f $(BINDIR)/$$f; \
	done

remove-bin:	$(ALL_TARGETS) $(ALL_SCRIPTS)
	@echo "*** Removing $(ALL_TARGETS) $(ALL_SCRIPTS) from $(BINDIR) ***"
	@for f in $(ALL_TARGETS) $(ALL_SCRIPTS); \
	do \
	   rm -f $(BINDIR)/$$f; \
	done

install_this:	install-bin

remove_this:	remove-bin

clean_this:
	rm -f $(ALL_RM)

clean_targets:
	rm -f $(ALL_TARGETS)

checkin:
	@for i in $(ALL_SOURCES) $(ALL_HEADERS); \
	do echo "." | ci $$i; \
	done
	@for i in $(ALL_SOURCES) $(ALL_HEADERS); \
	do echo "." | co -l $$i; \
	done
	@echo ""
	@echo "Please remember to check in Makefile !!!"
	@echo ""
