diff options
Diffstat (limited to 'makefiles/gmake/depend.mk')
-rw-r--r-- | makefiles/gmake/depend.mk | 49 |
1 files changed, 13 insertions, 36 deletions
diff --git a/makefiles/gmake/depend.mk b/makefiles/gmake/depend.mk index eb832e7..411da66 100644 --- a/makefiles/gmake/depend.mk +++ b/makefiles/gmake/depend.mk @@ -2,7 +2,7 @@ # 'makedepend', 'gcc -MM' or similar mechanisms # # requires: -# - compilers CC and CCPP +# - compilers CC and CXX # - INCLUDEDIRS # - OBJS, CPP_OBJS and BIN_OBJS, CPP_BIN_OBJS # - TEST_BINS, TEST_BIN_OBJS, TEST_CPP_BINS, TEST_CPP_BIN_OBJS @@ -16,34 +16,12 @@ ifeq "$(COMPILER)" "gcc" %.d : %.c @echo Generating dependencies for $< - @$(CC) -DMAKE_DEPENDENCIES -MM -MT $(@:.d=.o) $(CFLAGS) $< | \ + @$(CC) -DMAKE_DEPENDENCIES -MM -MT $(@:.d=.o) $(ALL_CFLAGS) $< | \ sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)\&\&\&\1 : \2,g" | tr -s '&' "\n" > $@ %.d : %.cpp @echo Generating dependencies for $< - @$(CCPP) -DMAKE_DEPENDENCIES -MM -MT $(@:.d=.o) $(CCPPFLAGS) $< | \ - sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)\&\&\&\1 : \2,g" | tr -s '&' "\n" > $@ - -endif - -ifeq "$(COMPILER)" "tcc" - -%.d : %.c - @echo Generating dependencies for $< - @makedepend -DMAKE_DEPENDENCIES $(PLATFORM_COMPILE_FLAGS) $(INCLUDE_DIRS) -I/usr/lib/tcc/include -f - $< > $@ - -endif - -ifeq "$(COMPILER)" "icc" - -%.d : %.c - @echo Generating dependencies for $< - @$(CC) -DMAKE_DEPENDENCIES -MM -MT $(@:.d=.o) $(CFLAGS) $< | \ - sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)\&\&\&\1 : \2,g" | tr -s '&' "\n" > $@ - -%.d : %.cpp - @echo Generating dependencies for $< - @$(CCPP) -DMAKE_DEPENDENCIES -MM -MT $(@:.d=.o) $(CCPPFLAGS) $< | \ + @$(CXX) -DMAKE_DEPENDENCIES -MM -MT $(@:.d=.o) $(ALL_CXXFLAGS) $< | \ sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)\&\&\&\1 : \2,g" | tr -s '&' "\n" > $@ endif @@ -52,25 +30,24 @@ ifeq "$(COMPILER)" "spro" %.d : %.c @echo Generating dependencies for $< - @$(CC) -DMAKE_DEPENDENCIES -xM1 $(CFLAGS) $< > $@ + @$(CC) -DMAKE_DEPENDENCIES -xM1 $(ALL_CFLAGS) $< > $@ %.d : %.cpp @echo Generating dependencies for $< - @$(CCPP) -DMAKE_DEPENDENCIES -xM1 $(CCPPFLAGS) $< > $@ -endif - -ifeq "$(COMPILER)" "pcc" - -# FIXME: platform in path of compiler include files, mmh, how to fix? -%.d : %.c - @echo Generating dependencies for $< - @$(CC) -DMAKE_DEPENDENCIES $(CFLAGS) -M $< > $@ - + @$(CXX) -DMAKE_DEPENDENCIES -xM1 $(ALL_CXXFLAGS) $< > $@ endif +ifneq ($(MAKECMDGOALS),clean) +ifneq ($(MAKECMDGOALS),distclean) -include $(OBJS:.o=.d) -include $(CPP_OBJS:.o=.d) -include $(BIN_OBJS:.o=.d) -include $(CPP_BIN_OBJS:.o=.d) -include $(TEST_BIN_OBJS:.o=.d) -include $(TEST_CPP_BIN_OBJS:.o=.d) + +.PHONY: depend +depend: $(OBJS:.o=.d) $(CPP_OBJS:.o=.d) $(BIN_OBJS:.o=.d) $(CPP_BIN_OBJS:.o=.d) $(TEST_BIN_OBJS:.o=.d) $(TEST_CPP_BIN_OBJS:.o=.d) + +endif +endif |