1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# 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 $(@:.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) $< | \
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) $< | \
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 $(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 $<
@makedepend -DMAKE_DEPENDENCIES $(PLATFORM_COMPILE_FLAGS) $(INCLUDE_DIRS) -I/usr/lib/pcc/i686-pc-linux-gnu/0.9.9/include -f - $< > $@
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)
|