4abf44177745692dfda0cc4f93b2b20f2dd39ea2
kate
  Thu May 4 10:40:43 2017 -0700
Add tools for making barChart files (expMatrixToBarchartBed and bedJoinTabOffset) to user apps. Cleanup ws and provide for scripts in subdirs. refs #18736

diff --git src/utils/makefile src/utils/makefile
index 8ae92b8..d375456 100644
--- src/utils/makefile
+++ src/utils/makefile
@@ -134,98 +134,116 @@
 	scaffoldFaToAgp \
 	scrambleFa \
 	subs \
 	tableSum \
 	textHist2 \
 	udcCleanup \
 	undupFa \
 	upper \
 	venn \
 	verticalSplitSqlTable \
 	weedLines \
 	wigTestMaker
 
 # list of scripts to install
 
+USER_APP_SCRIPTS = \
+	bedJoinTabOffset \
+	expMatrixToBarchartBed
+
 SCRIPT_FILES = \
 	agpToLift \
 	apacheLogParse \
 	bedCollapse.pl \
 	bedFixBlockOverlaps \
 	bedOverlapMerge \
 	bedSingleCover.pl \
 	bedBetween \
 	doLocusName \
 	extToolsChromeParse \
 	iSync \
 	lodToBedScore \
 	matrixMerge \
 	mkMafFrames.pl \
 	patSeqFilterBulkAndAnnotate \
 	patSeqSummarizeDocs \
 	pslProtCnv \
 	pslSameGene \
 	tabRepl \
 	uniprotLift \
 	uniprotToTab \
-	bedJoinTabOffset \
-	expMatrixToBarchartBed \
 	ggTables \
 	ggGeneClasses \
 	ggGpmlToTag \
 	ggKgmlToTab \
 	ggMsrToTab \
 	ggPidToTab \
 	ggPpiToTab \
 	ggSpfToTab \
 	bedNamePickFirst \
-	bedBestTranscript
-
-
+	bedBestTranscript \
+	genePredToBed \
+	${USER_APP_SCRIPTS}
 
 # List of all directories to build
 
 ALL_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)
+userAppsB: $(UTILS_APPLIST:%=%.userApp) $(USER_APP_SCRIPTS:%=%.userAppScript)
 
-%.userApps:
+%.userApp:
 	cd $* && echo $* && $(MAKE)
 
+%.userAppScript:
+	@rm -f ${DESTDIR}${BINDIR}/$*
+	@if test -d $* ; \
+	then \
+	    chmod +x $*/$*; \
+	    echo cp -p $*/$* ${DESTDIR}${BINDIR}; \
+	    cp -p $*/$* ${DESTDIR}${BINDIR}; \
+	else \
+	    chmod +x $*; \
+	    echo cp -p $*/$* ${DESTDIR}${BINDIR}; \
+	    cp -p $* ${DESTDIR}${BINDIR}/$*; \
+	fi
+
 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}
+	@rm -f ${SCRIPTS}/$*
+	@if test -d $* ; \
+	then \
+	    chmod +x $*/$*; \
+	    echo cp -p $*/$* ${SCRIPTS}; \
+	    cp -p $*/$* ${SCRIPTS}; \
+	else \
+	    chmod +x $*; \
+	    echo cp -p $* ${SCRIPTS}; \
+	    cp -p $* ${SCRIPTS}; \
+	fi
 
 testAll: $(ALL_APPS:%=%.testAll)
 
 %.testAll:
 	@test -s $*/tests/makefile && (echo $*; cd $* && $(MAKE) test) || true
 
 test: testAll
 	cd faToTwoBit && ${MAKE} test
 	cd twoBitToFa && ${MAKE} test
 	cd twoBitInfo && ${MAKE} test
 	cd bedGeneParts && ${MAKE} test
 
 clean: $(ALL_APPS:%=%.clean)
 	touch non-empty-rm.o
 	- find . -name \*.o -print | xargs rm