diff options
author | Andreas Baumann <abaumann@yahoo.com> | 2009-02-26 09:45:30 +0100 |
---|---|---|
committer | Andreas Baumann <abaumann@yahoo.com> | 2009-02-26 09:45:30 +0100 |
commit | 8cff71890f72d619162b4b8fac6f96f268deabd6 (patch) | |
tree | b4c94d7455bcc44b0b607198984134e81b0797a0 /makefiles/gmake/depend.mk | |
parent | 6a4d7e4836dc9e4b7dba4a39dd0a51e0bea0d1c5 (diff) | |
download | wolfbones-8cff71890f72d619162b4b8fac6f96f268deabd6.tar.gz wolfbones-8cff71890f72d619162b4b8fac6f96f268deabd6.tar.bz2 |
made the GNU make NMAKE switch as we go to Windows now, also fixed small bugs in the makefiles
Diffstat (limited to 'makefiles/gmake/depend.mk')
-rw-r--r-- | makefiles/gmake/depend.mk | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/makefiles/gmake/depend.mk b/makefiles/gmake/depend.mk new file mode 100644 index 0000000..bcdb5b2 --- /dev/null +++ b/makefiles/gmake/depend.mk @@ -0,0 +1,67 @@ +# provides generic rules for C/C++ dependeny generation using +# 'makedepend', 'gcc -MM' or similar mechanisms +# +# requires: +# - compilers CC and CCPP +# - INCLUDEDIRS +# - OBJS, CPP_OBJS and BIN_OBJS, CPP_BIN_OBJS +# - TEST_BINS, TEST_BIN_OBJS, TEST_CPP_BINS, TEST_CPP_BIN_OBJS +# +# provides: +# - included dependency files +# +# author: Andreas Baumann, abaumann at yahoo dot com + +ifeq "$(COMPILER)" "gcc" + +%.d : %.c + @echo Generating dependencies for $< + @$(CC) -DMAKE_DEPENDENCIES -MM -MT $@ $(CFLAGS) $< | \ + sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)\&\&\&\1 : \2,g" | tr -s '&' "\n" > $@ + +%.d : %.cpp + @echo Generating dependencies for $< + @$(CCPP) -DMAKE_DEPENDENCIES -MM -MT $@ $(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 $(INCLUDE_DIRS) -I/usr/lib/tcc/include -f - $< > $@ + +endif + +ifeq "$(COMPILER)" "icc" + +%.d : %.c + @echo Generating dependencies for $< + @$(CC) -DMAKE_DEPENDENCIES -MM -MT $@ $(CFLAGS) $< | \ + sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)\&\&\&\1 : \2,g" | tr -s '&' "\n" > $@ + +%.d : %.cpp + @echo Generating dependencies for $< + @$(CCPP) -DMAKE_DEPENDENCIES -MM -MT $@ $(CCPPFLAGS) $< | \ + sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)\&\&\&\1 : \2,g" | tr -s '&' "\n" > $@ + +endif + +ifeq "$(COMPILER)" "spro" + +%.d : %.c + @echo Generating dependencies for $< + @$(CC) -DMAKE_DEPENDENCIES -xM1 $(INCLUDE_DIRS) $< > $@ + +%.d : %.cpp + @echo Generating dependencies for $< + @$(CCPP) -DMAKE_DEPENDENCIES -xM1 $(INCLUDE_DIRS) $< > $@ +endif + +-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) |