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