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