[ofa-general] [PATCH] management/Makefile: simplify top level Makefile

Sasha Khapyorsky sashak at voltaire.com
Mon Oct 1 13:26:53 PDT 2007


Simplified management top level Makefile.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 Makefile |   84 +++++++++++++------------------------------------------------
 1 files changed, 18 insertions(+), 66 deletions(-)

diff --git a/Makefile b/Makefile
index 957b1fe..e6d5383 100644
--- a/Makefile
+++ b/Makefile
@@ -1,70 +1,22 @@
 
-#LIBS:=$(wildcard lib*)
-LIBS:=libibcommon libibumad libibmad
-OSM:=opensm
-OSMLIBS:=complib libvendor
-DIAG:=infiniband-diags
+SUBDIRS:= libibcommon libibumad libibmad opensm infiniband-diags
 
-SUBDIRS=$(OSM) $(DIAG)
-
-all: BUILD_TARG=all
-all: libs_install subdirs
+allall: all install
 	@echo Make all done
 
-automake:
-	@for i in $(LIBS); do \
-		if [ -x $$i/autogen.sh ]; then \
-			if !(cd $$i; ./autogen.sh && ./configure && make && make install); then exit 1; fi \
-		fi \
-	done
-	@for i in $(OSMLIBS); do \
-		if [ -x $(OSM)/$$i/autogen.sh ]; then \
-			if !(cd $(OSM)/$$i; ./autogen.sh && ./configure && make && make install); then exit 1; fi \
-		fi \
-	done
-	@for i in $(DIAG) $(OSM)/opensm; do \
-		if [ -x $$i/autogen.sh ]; then \
-			if !(cd $$i; ./autogen.sh && ./configure); then exit 1; fi \
-		fi \
-	done
-	@for i in $(DIAG) $(OSM)/opensm; do \
-		if [ -x $$i/autogen.sh ]; then \
-			if !(cd $$i; make && make install); then exit 1; fi \
-		fi \
-	done
-
-install: BUILD_TARG=install
-install: subdirs
-	@echo Install done
-
-clean: SUBDIRS=$(LIBS) $(DIAG) $(OSM)
-clean: BUILD_TARG=clean
-clean: subdirs
-	@rm -f build_tag	
-	@echo Clean done
-
-rmdep:
-	find $(SUBDIRS) -name ".depend" | xargs rm -f
-
-depend: SUBDIRS=$(LIBS) $(DIAG) $(OSM)
-depend: BUILD_TARG=depend
-depend: rmdep subdirs
-	@echo Depend done
-
-.PHONY : subdirs
-subdirs:
-	@for i in $(SUBDIRS); do \
-		test -x $$i/configure || ( cd $$i && ./autogen.sh || exit 1 ); \
-		test -e $$i/Makefile || ( cd $$i && ./configure || exit 1 ); \
-		( cd $$i && make ) || exit 1; \
-	done
-
-.PHONY : libs_install
-libs_install:
-	@for i in $(LIBS); do \
-		test -x $$i/configure || ( cd $$i && ./autogen.sh || exit 1 ); \
-		test -e $$i/Makefile || ( cd $$i && ./configure || exit 1 ); \
-		( cd $$i && make && make install ) || exit 1; \
-	done
-
-export BUILD_TARG
+config:
+	$(foreach dir, $(SUBDIRS), \
+		if [ ! -z "$(force)" -o ! -x $(dir)/configure ] ; then \
+			( cd $(dir) && ./autogen.sh && ./configure ) \
+				|| exit 1 ; \
+		elif [ ! -e $(dir)/Makefile ] ; then \
+			( cd $(dir) && ./configure ) \
+				|| exit 1 ; \
+		fi ; )
+
+automake: force=1
+automake: config
+
+all: config
+all install clean:
+	$(foreach dir, $(SUBDIRS), $(MAKE) -C $(dir) $@ && ) echo $@ done
-- 
1.5.3.rc2.29.gc4640f




More information about the general mailing list