Output PCH, not dependencies.
[reactos.git] / reactos / tools / rbuild / backend / mingw / compilers / gcc.mak
1 CFLAG_WERROR:=-Werror
2 CFLAG_CRTDLL:=-D_DLL -D__USE_CRTIMP
3
4 CXXFLAG_WERROR:=-Werror
5 CXXFLAG_CRTDLL:=-D_DLL -D__USE_CRTIMP
6
7 CPPFLAG_WERROR:=-Werror
8 CPPFLAG_UNICODE:=-DUNICODE -D_UNICODE
9
10 # FIXME: disabled until RosBE stops sucking
11 # BUILTIN_CPPFLAGS+= -nostdinc
12 BUILTIN_CFLAGS+= -fno-optimize-sibling-calls
13 BUILTIN_CXXFLAGS+= -fno-optimize-sibling-calls
14
15 #(module, source, dependencies, cflags, output)
16 define RBUILD_DEPENDS
17
18 $(5): $(2) $(3) | ${call RBUILD_dir,$(5)}
19 $$(ECHO_DEPENDS)
20 $${gcc} -xc -MF $$@ $(4) -M -MP -MT $$@ $$<
21
22 endef
23
24 #(module, source, dependencies, cflags, output)
25 define RBUILD_CXX_DEPENDS
26
27 $(5): $(2) $(3) | ${call RBUILD_dir,$(5)}
28 $$(ECHO_DEPENDS)
29 $${gpp} -MF $$@ $(4) -M -MP -MT $$@ $$<
30
31 endef
32
33 #(source, cflags)
34 RBUILD_PIPE_CPP=$${gcc} $(2) -xc -E $(1)
35 RBUILD_PIPE_CXX_CPP=$${gpp} $(2) -E $(1)
36
37 #(module, source, dependencies, cflags, output)
38 define RBUILD_CPP
39
40 $(5): $(2) $(3) | ${call RBUILD_dir,$(5)}
41 $$(ECHO_CPP)
42 ${call RBUILD_PIPE_CPP,$$<,$(4)} > $$@
43
44 endef
45
46 #(module, source, dependencies, cflags, output)
47 define RBUILD_CXX_CPP
48
49 $(5): $(2) $(3) | ${call RBUILD_dir,$(5)}
50 $$(ECHO_CPP)
51 ${call RBUILD_PIPE_CXX_CPP,$$<,$(4)} > $$@
52
53 endef
54
55 #(module, source, dependencies, cflags, output)
56 define RBUILD_CC
57
58 $(2): $${$(1)_precondition}
59
60 ifeq ($(ROS_BUILDDEPS),full)
61
62 ${call RBUILD_DEPENDS,$(1),$(2),,${call RBUILD_cflags,$(1),$(4)},$(5).d}
63 -include $(5).d
64
65 $(5): $(2) $(5).d $(3) | ${call RBUILD_dir,$(5)}
66 $$(ECHO_CC)
67 $${gcc} -o $$@ ${call RBUILD_cflags,$(1),$(4)} -c $$<
68
69 else
70
71 $(5): $(2) $(3) | ${call RBUILD_dir,$(5)}
72 $$(ECHO_CC)
73 $${gcc} -o $$@ ${call RBUILD_cflags,$(1),$(4)} -c $$<
74
75 endif
76
77 endef
78
79 #(module, source, dependencies, cflags, output)
80 define RBUILD_CXX
81
82 $(2): $${$(1)_precondition}
83
84 ifeq ($(ROS_BUILDDEPS),full)
85
86 ${call RBUILD_CXX_DEPENDS,$(1),$(2),,${call RBUILD_cxxflags,$(1),$(4)},$(5).d}
87 -include $(5).d
88
89 $(5): $(2) $(5).d $(3) | ${call RBUILD_dir,$(5)}
90 $$(ECHO_CC)
91 $${gpp} -o $$@ ${call RBUILD_cxxflags,$(1),$(4)} -c $$<
92
93 else
94
95 $(5): $(2) $(3) | ${call RBUILD_dir,$(5)}
96 $$(ECHO_CC)
97 $${gpp} -o $$@ ${call RBUILD_cxxflags,$(1),$(4)} -c $$<
98
99 endif
100
101 endef
102
103 #(module, source, dependencies, cflags)
104 RBUILD_CC_RULE=${call RBUILD_CC,$(1),$(2),$(3),$(4),${call RBUILD_intermediate_path_unique,$(1),$(2)}.o}
105 RBUILD_CXX_RULE=${call RBUILD_CXX,$(1),$(2),$(3),$(4),${call RBUILD_intermediate_path_unique,$(1),$(2)}.o}
106
107 #(module, source, dependencies, cflags)
108 define RBUILD_CC_PCH_RULE
109
110 $(2): $${$(1)_precondition}
111
112 ifeq ($$(ROS_BUILDDEPS),full)
113
114 ${call RBUILD_intermediate_dir,$(2)}$$(SEP).gch_$(1)$$(SEP)$(notdir $(2)).gch.d: $(2) | ${call RBUILD_intermediate_dir,$(2)}
115 $$(ECHO_DEPENDS)
116 $${gcc} -MF $$@ ${call RBUILD_cflags,$(1),$(4)} -x c-header -M -MP -MT $$@ $$<
117
118 -include $$(intermediate_dir)$$(SEP).gch_$$(module_name)$$(SEP)$(notdir $(2)).gch.d
119
120 ${call RBUILD_intermediate_dir,$(2)}$$(SEP).gch_$(1)$$(SEP)$(notdir $(2)).gch: $(2) ${call RBUILD_intermediate_dir,$(2)}$$(SEP).gch_$(1)$$(SEP)$(notdir $(2)).gch.d $(3) | ${call RBUILD_intermediate_dir,$(2)}$$(SEP).gch_$(1)
121 $$(ECHO_PCH)
122 $${gcc} -MF $$@ ${call RBUILD_cflags,$(1),$(4)} -x c-header -M -MP -MT $$@ $$<
123
124 else
125
126 ${call RBUILD_intermediate_dir,$(2)}$$(SEP).gch_$(1)$$(SEP)$(notdir $(2)).gch: $(2) $(3) | ${call RBUILD_intermediate_dir,$(2)}$$(SEP).gch_$(1)
127 $$(ECHO_PCH)
128 $${gcc} -o $$@ ${call RBUILD_cflags,$(1),$(4)} -x c-header $$<
129
130 endif
131
132 endef
133
134 #(module, source, dependencies, cflags)
135 define RBUILD_CXX_PCH_RULE
136
137 $(2): $${$(1)_precondition}
138
139 ifeq ($$(ROS_BUILDDEPS),full)
140
141 ${call RBUILD_intermediate_dir,$(2)}$$(SEP).gch_$(1)$$(SEP)$(notdir $(2)).gch.d: $(2) | ${call RBUILD_intermediate_dir,$(2)}
142 $$(ECHO_DEPENDS)
143 $${gpp} -MF $$@ ${call RBUILD_cxxflags,$(1),$(4)} -x c++-header -M -MP -MT $$@ $$<
144
145 -include $$(intermediate_dir)$$(SEP).gch_$$(module_name)$$(SEP)$(notdir $(2)).gch.d
146
147 ${call RBUILD_intermediate_dir,$(2)}$$(SEP).gch_$(1)$$(SEP)$(notdir $(2)).gch: $(2) ${call RBUILD_intermediate_dir,$(2)}$$(SEP).gch_$(1)$$(SEP)$(notdir $(2)).gch.d $(3) | ${call RBUILD_intermediate_dir,$(2)}$$(SEP).gch_$(1)
148 $$(ECHO_PCH)
149 $${gpp} -MF $$@ ${call RBUILD_cxxflags,$(1),$(4)} -x c++-header -M -MP -MT $$@ $$<
150
151 else
152
153 ${call RBUILD_intermediate_dir,$(2)}$$(SEP).gch_$(1)$$(SEP)$(notdir $(2)).gch: $(2) $(3) | ${call RBUILD_intermediate_dir,$(2)}$$(SEP).gch_$(1)
154 $$(ECHO_PCH)
155 $${gpp} -o $$@ ${call RBUILD_cxxflags,$(1),$(4)} -x c++-header $$<
156
157 endif
158
159 endef
160