src/hg/utils/makefile 1.15

1.15 2009/08/12 08:21:38 markd
added make test, simplify rules
Index: src/hg/utils/makefile
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/utils/makefile,v
retrieving revision 1.14
retrieving revision 1.15
diff -b -B -U 1000000 -r1.14 -r1.15
--- src/hg/utils/makefile	12 Aug 2009 07:48:05 -0000	1.14
+++ src/hg/utils/makefile	12 Aug 2009 08:21:38 -0000	1.15
@@ -1,71 +1,56 @@
 # Build all directories in utils
 # test comment
 # 	$Id$
 
 include ../../inc/common.mk
 
-all:    
-	@for D in $(USE_DIRS) x; do \
-	  if test "$$D" != "x" ; then \
-	    ( cd $$D && echo $$D && $(MAKE) ) ;\
-	    x=$$? ; if [ $$x -ne 0 ]; then exit $$x ; fi \
-	    fi ;\
-	done
-
-scripts:
-	@for F in ${SCRIPT_FILES}; do \
-	    chmod +x $$F; \
-	    rm -f ${SCRIPTS}/$${F}; \
-	    echo cp -p $$F ${SCRIPTS}; \
-	    cp -p $$F ${SCRIPTS}; \
-	 done
-	cd automation && ${MAKE} scripts
-
-alpha: scripts all
-
-test:
-	@echo "nothing for tests yet"
-
-clean:
-	@for D in $(USE_DIRS) x; do \
-	  if test "$$D" != "x" ; then \
-	    ( cd $$D && echo $$D && $(MAKE) clean ) ;\
-	    x=$$? ; if [ $$x -ne 0 ]; then exit $$x ; fi \
-	    fi ;\
-	done
-	touch non-empty-rm.o
-	- find . -name \*.o -print | xargs rm
 
 SCRIPT_FILES = \
 	dumpDb.pl \
 	mergeOverlapBed4.pl
 
 # List of directories to build
 USE_DIRS = $(DIRS)
 
 DIRS = \
 	bedWeedOverlapping \
 	chromGraphFromBin \
 	chromGraphToBin \
 	crTreeIndexBed \
 	crTreeSearchBed \
 	gapToLift \
 	oligoMatch \
 	positionalTblCheck \
 	safePush \
 	toDev64 \
 	twoBitMask \
-	gff3ToGenePred
+	gff3ToGenePred \
+	automation
 
 TEST_DIRS = \
 	gff3ToGenePred
 
-BAD_DIRS= \
-	ccCpLock \
-	geneStarts \
-	jimgrep \
-	jkShell \
-	dnsInfo \
-	wigAsciiToBinary \
-	cCp
+
+all:: utils
+
+utils: $(USE_DIRS:%=%.utils)
+%.utils:
+	(cd $* && $(MAKE))
+
+scripts: $(SCRIPT_FILES:%=%.scripts)
+%.scripts:
+	chmod +x $*
+	rm -f ${SCRIPTS}/$*
+	cp -p $* ${SCRIPTS}/$*
+
+alpha: scripts all
+
+test::	${TEST_DIRS:%=%.test}
+%.test:
+	(cd $* && ${MAKE} test)
+
+clean:: $(USE_DIRS:%=%.clean)
+	- find . -name '*.o' -exec rm {} \;
+%.clean:
+	(cd $* && ${MAKE} clean)