From c79e5b11211dff332e94359fef0895e2153f772c Mon Sep 17 00:00:00 2001 From: Ole Hansen <ole@jlab.org> Date: Fri, 3 Mar 2017 13:21:24 -0500 Subject: [PATCH] Pick up improved dependency handling in Makefiles from master --- Makefile | 41 ++++++++++++++++++----------------------- hana_decode/Makefile | 29 +++++++++++++---------------- hana_scaler/Makefile | 29 +++++++++++++---------------- 3 files changed, 44 insertions(+), 55 deletions(-) diff --git a/Makefile b/Makefile index 4d9b0c0c..02b6ff06 100644 --- a/Makefile +++ b/Makefile @@ -133,11 +133,6 @@ ifdef ONLINE_ET endif -MAKEDEPEND := gcc -ifeq ($(shell root-config --version | cut -c1),6) - MAKEDEPEND += -std=c++11 -endif - ifdef WITH_DEBUG DEFINES += -DWITH_DEBUG endif @@ -255,8 +250,12 @@ src/ha_compiledata.h: Makefile @echo "" >> $@ @echo "#endif" >> $@ -subdirs: - set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i; done +src/THaInterface.o: src/ha_compiledata.h + +subdirs: $(SUBDIRS) + +$(SUBDIRS): + set -e; $(MAKE) -C $@ #---------- Core libraries ----------------------------------------- $(LIBHALLA).$(VERSION): $(HDR) $(OBJS) @@ -382,29 +381,25 @@ ifneq ($(NAME),analyzer) endif set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i install; done -.PHONY: all clean realclean srcdist cvsdist subdirs static - - ###--- DO NOT CHANGE ANYTHING BELOW THIS LINE UNLESS YOU KNOW WHAT ### YOU ARE DOING +.PHONY: all clean realclean srcdist cvsdist subdirs $(SUBDIRS) + .SUFFIXES: -.SUFFIXES: .c .cc .cpp .C .o .d %.o: %.C +ifeq ($(strip $(MAKEDEPEND)),) + $(CXX) $(CXXFLAGS) -MMD -o $@ -c $< + @mv -f $*.d $*.d.tmp +else $(CXX) $(CXXFLAGS) -o $@ -c $< - -%.d: %.C src/ha_compiledata.h - @echo Creating dependencies for $< -# @$(SHELL) -ec '$(CXX) -MM $(CXXFLAGS) -c $< \ -# | sed '\''s%\($*\)\.o[ :]*%\1.o $@ : %g'\'' > $@; \ -# [ -s $@ ] || rm -f $@' - @$(SHELL) -ec '$(MAKEDEPEND) -MM $(ROOTINC) $(INCLUDES) $(DEFINES) -c $< \ - | sed '\''s%^.*\.o%$*\.o%g'\'' \ - | sed '\''s%\($*\)\.o[ :]*%\1.o $@ : %g'\'' > $@; \ - [ -s $@ ] || rm -f $@' - -### + $(MAKEDEPEND) $(ROOTINC) $(INCLUDES) $(DEFINES) -c $< > $*.d.tmp +endif + @sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d + @sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \ + sed -e 's/^ *//' -e 's/$$/:/' >> $*.d + @rm -f $*.d.tmp -include $(DEP) diff --git a/hana_decode/Makefile b/hana_decode/Makefile index b01e18e9..e2fd3996 100644 --- a/hana_decode/Makefile +++ b/hana_decode/Makefile @@ -129,11 +129,6 @@ else DEFINES += $(shell getconf LFS_CFLAGS) endif -MAKEDEPEND = g++ -ifeq ($(shell root-config --version | cut -c1),6) - MAKEDEPEND += -std=c++11 -endif - export OSNAME := $(shell uname) ifeq ($(OSNAME),SunOS) @@ -360,19 +355,21 @@ install: all # -cp -puvf libdc.so $(ANALYZER)/$(PLATFORM) ### +.PHONY: all static evio tarfile version clean realclean install + .SUFFIXES: -.SUFFIXES: .c .cc .cpp .C .o .d %.o: %.C - $(CXX) $(CXXFLAGS) -c $< - -%.d: %.C - @echo Creating dependencies for $< -# @$(SHELL) -ec '$(CXX) -MM $(CXXFLAGS) -c $< \ -# | sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \ -# [ -s $@ ] || rm -f $@' - @$(SHELL) -ec '$(MAKEDEPEND) -MM $(ROOTINC) $(INCLUDES) $(DEFINES) -c $< \ - | sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \ - [ -s $@ ] || rm -f $@' +ifeq ($(strip $(MAKEDEPEND)),) + $(CXX) $(CXXFLAGS) -MMD -o $@ -c $< + @mv -f $*.d $*.d.tmp +else + $(CXX) $(CXXFLAGS) -o $@ -c $< + $(MAKEDEPEND) $(ROOTINC) $(INCLUDES) $(DEFINES) -c $< > $*.d.tmp +endif + @sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d + @sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \ + sed -e 's/^ *//' -e 's/$$/:/' >> $*.d + @rm -f $*.d.tmp -include $(DEPS) diff --git a/hana_scaler/Makefile b/hana_scaler/Makefile index 4af81e21..63030f60 100644 --- a/hana_scaler/Makefile +++ b/hana_scaler/Makefile @@ -118,11 +118,6 @@ ARCH = linux DEFINES += $(shell getconf LFS_CFLAGS) endif -MAKEDEPEND = g++ -ifeq ($(shell root-config --version | cut -c1),6) - MAKEDEPEND += -std=c++11 -endif - export OSNAME := $(shell uname) ifeq ($(OSNAME),SunOS) @@ -307,19 +302,21 @@ install: all # -cp -puvf libscaler.so $(ANALYZER)/$(PLATFORM) ### +.PHONY: all static tarfile version clean realclean install + .SUFFIXES: -.SUFFIXES: .c .cc .cpp .C .o .d %.o: %.C - $(CXX) $(CXXFLAGS) -c $< - -%.d: %.C - @echo Creating dependencies for $< -# @$(SHELL) -ec '$(CXX) -MM $(CXXFLAGS) -c $< \ -# | sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \ -# [ -s $@ ] || rm -f $@' - @$(SHELL) -ec '$(MAKEDEPEND) -MM $(ROOTINC) $(INCLUDES) $(DEFINES) -c $< \ - | sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \ - [ -s $@ ] || rm -f $@' +ifeq ($(strip $(MAKEDEPEND)),) + $(CXX) $(CXXFLAGS) -MMD -o $@ -c $< + @mv -f $*.d $*.d.tmp +else + $(CXX) $(CXXFLAGS) -o $@ -c $< + $(MAKEDEPEND) $(ROOTINC) $(INCLUDES) $(DEFINES) -c $< > $*.d.tmp +endif + @sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d + @sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \ + sed -e 's/^ *//' -e 's/$$/:/' >> $*.d + @rm -f $*.d.tmp -include $(DEPS) -- GitLab