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