[BACK]Return to Makefile CVS log [TXT][DIR] Up to [Development] / xfs-cmds

File: [Development] / xfs-cmds / Makefile (download)

Revision 1.3, Tue Jun 4 22:53:09 2002 UTC (15 years, 4 months ago) by sandeen
Branch: MAIN
Changes since 1.2: +0 -31 lines

Undoes mod:     xfs-cmds:slinx:120772a
Undo xfs-cmds:slinx:120772a, inadvertently whacked a previous mod.

#
# Top-level makefile for xfs-cmds
#	(with specific bits for LBS)
# 

XFS_CMDS_DIR := $(shell pwd)

# This is true for both LBS and 2.4.x-xfs builds... for now...
TOP=..

ARCH := $(shell uname -m | sed -e s/i.86/i386/)

COMMANDS = attr acl xfsprogs dmapi xfsdump

# We'd like to be able to satisfy dependencies from within the
# xfs-cmds tree when we can; we can use environment vars to
# point autoconf & the build within the tree.

# Set up environment vars for cmd build; this is the superset of needed
# includes/libs, but we'll just set them all here unless there's a good
# reason not to...

export	CPPFLAGS =  -I$(XFS_CMDS_DIR)/xfsprogs/include \
		    -I$(XFS_CMDS_DIR)/dmapi/include \
		    -I$(XFS_CMDS_DIR)/attr/include

export	LDFLAGS =   -L$(XFS_CMDS_DIR)/xfsprogs/libxfs/.libs \
		    -L$(XFS_CMDS_DIR)/xfsprogs/libhandle/.libs \
		    -L$(XFS_CMDS_DIR)/dmapi/libdm/.libs \
		    -L$(XFS_CMDS_DIR)/attr/libattr/.libs

export	LTLDFLAGS = -L$(XFS_CMDS_DIR)/xfsprogs/libxfs \
		    -L$(XFS_CMDS_DIR)/xfsprogs/libhandle \
		    -L$(XFS_CMDS_DIR)/dmapi/libdm \
		    -L$(XFS_CMDS_DIR)/attr/libattr

# For LBS, the "all" target should build all RPMs, but
# should _not_ install them

default all: cmds

cmds-install: cmds
	echo "=== Making $@ `date`"
	( rpm -Uvh --replacefiles --replacepkgs \
		$(XFS_CMDS_DIR)/RPMS/$(ARCH)/*.$(ARCH).rpm )

cmds: builddirs

	echo "=== Making $@ `date`"
	for d in $(COMMANDS); do \
		echo "== Building $$d"; \
		( cd $(XFS_CMDS_DIR)/$$d && ./Makepkgs ) || exit 1; \
	done
	for d in $(COMMANDS); do \
		( cd $(XFS_CMDS_DIR) && /bin/cp $$d/build/rpm/*.src.rpm SRPMS ) \
	done
	for d in $(COMMANDS); do \
		( cd $(XFS_CMDS_DIR) && /bin/cp $$d/build/rpm/*.$(ARCH).rpm RPMS/$(ARCH) ) \
	done

	# If this is an LBS build ($(TOP)/sgi-install/SGI/RPMS exists)
	# then copy the RPMs over to sgi-install after they're built
	([ -d $(TOP)/sgi-install/SGI/RPMS ] && \
		( /bin/cp $(XFS_CMDS_DIR)/RPMS/$(ARCH)/*.rpm $(TOP)/sgi-install/SGI/RPMS )) || \
		echo

	([ -d $(TOP)/sgi-install/SGI/SRPMS ] && \
		( /bin/cp $(XFS_CMDS_DIR)/SRPMS/*.src.rpm $(TOP)/sgi-install/SGI/SRPMS )) || \
		echo

# For LBS, the "exports" target should install any packages that
# are needed for other LBS packages; for now this does not include
# any of the xfs userspace (?)

# Docs say to copy RPMs after all: and exports: but building
# exports won't _build_ any rpms, so...?

exports:
	# (null)

# if slinx build already has builddirs above, link to them, otherwise
# make our own (LBS or standalone)
builddirs:
	echo "cmd builddirs"
	([ -d $(TOP)/BUILD ] && ln -s $(TOP)/BUILD $(XFS_CMDS_DIR)/BUILD) \
		|| ([ -d $(XFS_CMDS_DIR)/BUILD ] || mkdir $(XFS_CMDS_DIR)/BUILD)
	([ -d $(TOP)/SRPMS ]  && ln -s $(TOP)/SRPMS $(XFS_CMDS_DIR)/SRPMS) \
		|| ([ -d $(XFS_CMDS_DIR)/SRPMS ] || mkdir $(XFS_CMDS_DIR)/SRPMS)
	([ -d $(TOP)/RPMS/$(ARCH) ]  && ln -s $(TOP)/RPMS $(XFS_CMDS_DIR)/RPMS) \
		|| ([ -d $(XFS_CMDS_DIR)/RPMS/$(ARCH) ] || mkdir -p $(XFS_CMDS_DIR)/RPMS/$(ARCH))

clean:
	rm -rf RPMS SRPMS BUILD SOURCES
	for d in $(COMMANDS); do \
		( cd $(XFS_CMDS_DIR)/$$d && make -i clean ) \
	done

realclean: clean
	for d in $(COMMANDS); do ( cd $(XFS_CMDS_DIR)/$$d && make realclean ) done