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