0cfbeba76576c811dfdda453b8955429327f897d
hiram
  Tue May 21 15:40:21 2013 -0700
fixup parallel build rules refs #9104
diff --git src/utils/makefile src/utils/makefile
index b27bb0e..92c991b 100644
--- src/utils/makefile
+++ src/utils/makefile
@@ -1,79 +1,23 @@
 # Build all directories in utils
 
 include ../inc/common.mk
 
-# all: builds all utilities here
-
-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
-
-# userApps: builds on user application specific programs
-
-userApps: $(UTILS_APPLIST:%=%.userApps)
-
-%.userApps:
-	( cd $* && echo $* && $(MAKE) )
-
-scripts:
-	@for F in ${SCRIPT_FILES}; do \
-	    chmod +x $$F; \
-	    rm -f ${SCRIPTS}/$${F}; \
-	    echo cp -p $$F ${SCRIPTS}; \
-	    cp -p $$F ${SCRIPTS}; \
-	 done
-	chmod +x genePredToBed/genePredToBed;
-	rm -f ${SCRIPTS}/genePredToBed;
-	echo cp -p genePredToBed/genePredToBed ${SCRIPTS};
-	@cp -p genePredToBed/genePredToBed ${SCRIPTS};
-
-alpha: scripts all
-
-test:
-	cd faToTwoBit && ${MAKE} test
-	cd twoBitToFa && ${MAKE} test
-	cd twoBitInfo && ${MAKE} test
-	cd pslLiftSubrangeBlat && ${MAKE} test
-	cd bedGeneParts && ${MAKE} test
-
-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 = \
-        agpToLift \
-        bedCollapse.pl \
-        iSync \
-        lodToBedScore \
-	mkMafFrames.pl
+# note: lists such as the following need to be defined *before*
+# they are used in the wildcard target rules.  An oddity of gnu make
 
-# List of directories to build
-USE_DIRS = $(DIRS) $(UTILS_APPLIST) $(UCSC_DIRS)
-
-UCSC_DIRS = \
-	aNotB
+# define the list of user applications to build
 
 UTILS_APPLIST = \
 	bedClip \
 	bedGraphToBigWig \
 	bedToBigBed \
 	bigBedNamedItems \
 	bigBedSummary \
 	bigBedToBed \
 	bigWigAverageOverBed  \
 	bigWigInfo \
 	bigWigMerge \
 	bigWigSummary \
 	bigWigToBedGraph \
 	bigWigToWig\
 	faCount \
@@ -87,31 +31,31 @@
 	faToTwoBit \
 	htmlCheck \
 	nibFrag \
 	nibSize \
 	paraFetch \
 	paraSync \
 	sizeof \
 	stringify \
 	textHistogram \
 	twoBitDup \
 	twoBitInfo \
 	twoBitToFa \
 	wigCorrelate \
 	wigToBigWig
 
-DIRS = \
+APPS = \
 	addCols \
 	ave \
 	aveCols \
 	bedCommonRegions \
 	bedGeneParts \
 	bedPileUps \
 	bedRemoveOverlap \
 	bedRestrictToPositions \
 	calc \
 	catDir \
 	catUncomment \
 	ccCp \
 	chopFaLines \
 	colTransform \
 	countChars \
@@ -169,24 +113,87 @@
 	tailLines \
 	textHist2 \
 	tickToDate \
 	timing \
 	toLower \
 	toUpper \
 	udcCleanup \
 	undupFa \
 	upper \
 	venn \
 	verticalSplitSqlTable \
 	weedLines \
 	wigTestMaker \
 	wordLine
 
+# list of utilities to build of interest only at UCSC
+
+UCSC_APPS = \
+	aNotB
+
+# list of scripts to install
+
+SCRIPT_FILES = \
+        agpToLift \
+        bedCollapse.pl \
+        iSync \
+        lodToBedScore \
+	mkMafFrames.pl
+
+# List of all directories to build
+
+ALL_APPS = $(APPS) $(UTILS_APPLIST) $(UCSC_APPS)
+
+# all: builds all utilities here
+
+all: $(ALL_APPS:%=%.all)
+
+%.all:
+	cd $* && echo $* && $(MAKE)
+
+# userAppsB: builds the user application specific programs
+# it would have been nice to be able to use the target name 'userApps'
+# here, but there is a directory by that name, and thus it always exists
+# and so the target does nothing.
+
+userAppsB: $(UTILS_APPLIST:%=%.userApps)
+
+%.userApps:
+	cd $* && echo $* && $(MAKE)
+
+scripts: $(SCRIPT_FILES:%=%.scripts)
+	chmod +x genePredToBed/genePredToBed;
+	rm -f ${SCRIPTS}/genePredToBed;
+	echo cp -p genePredToBed/genePredToBed ${SCRIPTS};
+	@cp -p genePredToBed/genePredToBed ${SCRIPTS};
+
+%.scripts:
+	chmod +x $*
+	rm -f ${SCRIPTS}/$*
+	echo cp -p $* ${SCRIPTS}
+	cp -p $* ${SCRIPTS}
+
+alpha: scripts all
+
+test:
+	cd faToTwoBit && ${MAKE} test
+	cd twoBitToFa && ${MAKE} test
+	cd twoBitInfo && ${MAKE} test
+	cd pslLiftSubrangeBlat && ${MAKE} test
+	cd bedGeneParts && ${MAKE} test
+
+clean: $(ALL_APPS:%=%.clean)
+	touch non-empty-rm.o
+	- find . -name \*.o -print | xargs rm
+
+%.clean:
+	cd $* && echo $* && $(MAKE) clean
+
 BAD_DIRS= \
 	ccCpLock \
 	est2genomeToPsl \
 	geneStarts \
 	jimgrep \
 	jkShell \
 	dnsInfo \
 	wigAsciiToBinary \
 	cCp