1 RBUILD_fullpath
=${subst <<<,,${subst $(SEP
)<<<,,${subst /,$(SEP
),${subst \\,$(SEP
),$(1)}}<<<}}
3 RBUILD_compress_prefix
=${subst >>>,,${subst >>>$($(2)),$$($(2)),>>>$(1)}}
4 RBUILD_compress_prefixes
=${call RBUILD_compress_prefix
,${call RBUILD_compress_prefix
,${call RBUILD_compress_prefix
,${call RBUILD_compress_prefix
,${call RBUILD_compress_prefix
,$(1),INTERMEDIATE
},OUTPUT
},CDOUTPUT
},TEMPORARY
},INSTALL
}
6 RBUILD_strip_prefix
=${subst >>>,,${subst >>>$($(2)),,>>>$(1)}}
7 RBUILD_strip_prefixes
=${subst >>>,,${subst >>>$(SEP
),,>>>${call RBUILD_strip_prefix
,${call RBUILD_strip_prefix
,${call RBUILD_strip_prefix
,${call RBUILD_strip_prefix
,${call RBUILD_strip_prefix
,$(1),INTERMEDIATE
},OUTPUT
},CDOUTPUT
},TEMPORARY
},INSTALL
}}}
10 RBUILD_intermediate_path_noext
=${call RBUILD_intermediate_dir
,$(1)}$(SEP
)$(basename $(notdir $(1)))
11 RBUILD_output_path_noext
=${call RBUILD_output_dir
,$(1)}$(SEP
)$(basename $(notdir $(1)))
14 RBUILD_intermediate_path_unique
=${call RBUILD_intermediate_path_noext
,$(2)}_
$(1)
15 RBUILD_output_dir
=${call RBUILD_output_path_noext
,$(2)}_
$(1)
18 RBUILD_intermediate_dir
=${call RBUILD_fullpath
,$(value INTERMEDIATE
)$(SEP
)$(dir ${call RBUILD_strip_prefixes
,$(1)})}
19 RBUILD_output_dir
=${call RBUILD_fullpath
,$(value OUTPUT
)$(SEP
)$(dir ${call RBUILD_strip_prefixes
,$(1)})}
22 RBUILD_name
=$(basename $(notdir $(1)))
25 RBUILD_dir
=${call RBUILD_fullpath
,$(dir ${call RBUILD_compress_prefixes
,$(1)})}
27 #(module, flags, includes, compiler, prefix)
28 RBUILD_compiler_flags
=\
29 $$(BUILTIN_
$(5)$(4)FLAGS
) \
30 $$(PROJECT_
$(5)$(4)FLAGS
) \
31 $$(MODULETYPE
$($(1)_TYPE
)_
$(4)FLAGS
) \
36 #(module, flags, includes, compiler, prefix)
37 RBUILD_compiler_flags_with_cpp
=\
38 $$($(5)$(4)INCLUDES
) $$(CPPINCLUDES
) \
40 $$($(1)_
$(4)INCLUDES
) $$($(1)_CPPINCLUDES
) \
41 $$(MODULETYPE
$($(1)_TYPE
)_
$(4)INCLUDES
) $$(MODULETYPE
$($(1)_TYPE
)_CPPINCLUDES
) \
42 $$(PROJECT_
$(5)$(4)INCLUDES
) $$(PROJECT_
$(5)CPPINCLUDES
) \
43 $$(BUILTIN_
$(5)$(4)INCLUDES
) $$(BUILTIN_
$(5)CPPINCLUDES
) \
44 $$(BUILTIN_
$(5)CPPDEFINES
) $$(BUILTIN_
$(5)CPPFLAGS
) $$(BUILTIN_
$(5)$(4)DEFINES
) $$(BUILTIN_
$(5)$(4)FLAGS
) \
45 $$(PROJECT_
$(5)CPPDEFINES
) $$(PROJECT_
$(5)CPPFLAGS
) $$(PROJECT_
$(5)$(4)DEFINES
) $$(PROJECT_
$(5)$(4)FLAGS
) \
46 $$(MODULETYPE
$($(1)_TYPE
)_CPPDEFINES
) $$(MODULETYPE
$($(1)_TYPE
)_CPPFLAGS
) $$(MODULETYPE
$($(1)_TYPE
)_
$(4)DEFINES
) $$(MODULETYPE
$($(1)_TYPE
)_
$(4)FLAGS
) \
47 $$($(1)_CPPDEFINES
) $$($(1)_CPPFLAGS
) $$($(1)_
$(4)DEFINES
) $$($(1)_
$(4)FLAGS
) \
49 $$(CPPDEFINES
) $$(CPPFLAGS
) $$($(5)$(4)DEFINES
) $$($(5)$(4)FLAGS
)
51 #(module, flags, includes, compiler, prefix)
52 RBUILD_compiler_flags_builtin_cpp
=\
53 $$($(5)$(4)INCLUDES
) $$(CPPINCLUDES
) \
55 $$($(1)_
$(4)INCLUDES
) $$($(1)_CPPINCLUDES
) \
56 $$(MODULETYPE
$($(1)_TYPE
)_
$(4)INCLUDES
) $$(MODULETYPE
$($(1)_TYPE
)_CPPINCLUDES
) \
57 $$(PROJECT_
$(5)$(4)INCLUDES
) $$(PROJECT_
$(5)CPPINCLUDES
) \
58 $$(BUILTIN_
$(5)$(4)INCLUDES
) $$(BUILTIN_
$(5)CPPINCLUDES
) \
59 $$(BUILTIN_
$(5)CPPDEFINES
) $$(BUILTIN_
$(5)$(4)DEFINES
) $$(BUILTIN_
$(5)$(4)FLAGS
) \
60 $$(PROJECT_
$(5)CPPDEFINES
) $$(PROJECT_
$(5)$(4)DEFINES
) $$(PROJECT_
$(5)$(4)FLAGS
) \
61 $$(MODULETYPE
$($(1)_TYPE
)_CPPDEFINES
) $$(MODULETYPE
$($(1)_TYPE
)_
$(4)DEFINES
) $$(MODULETYPE
$($(1)_TYPE
)_
$(4)FLAGS
) \
62 $$($(1)_CPPDEFINES
) $$($(1)_
$(4)DEFINES
) $$($(1)_
$(4)FLAGS
) \
64 $$(CPPDEFINES
) $$($(5)$(4)DEFINES
) $$($(5)$(4)FLAGS
)
66 #(module, flags, includes, compiler, prefix)
67 RBUILD_compiler_flags_with_includes
=\
68 $$($(5)$(4)INCLUDES
) \
70 $$($(1)_
$(4)INCLUDES
) $$($(1)_CPPINCLUDES
) \
71 $$(MODULETYPE
$($(1)_TYPE
)_
$(4)INCLUDES
) \
72 $$(PROJECT_
$(5)$(4)INCLUDES
) \
73 $$(BUILTIN_
$(5)$(4)INCLUDES
) \
74 $$(BUILTIN_
$(5)$(4)FLAGS
) \
75 $$(PROJECT_
$(5)$(4)FLAGS
) \
76 $$(MODULETYPE
$($(1)_TYPE
)_
$(4)FLAGS
) \
81 #(module, flags, includes, compiler, prefix)
82 RBUILD_compiler_flags_cpp
=\
83 $$($(5)$(4)INCLUDES
) $$(CPPINCLUDES
) \
85 $$($(1)_
$(4)INCLUDES
) $$($(1)_CPPINCLUDES
) \
86 $$(MODULETYPE
$($(1)_TYPE
)_
$(4)INCLUDES
) $$(MODULETYPE
$($(1)_TYPE
)_CPPINCLUDES
) \
87 $$(PROJECT_
$(5)$(4)INCLUDES
) $$(PROJECT_
$(5)CPPINCLUDES
) \
88 $$(BUILTIN_
$(5)$(4)INCLUDES
) $$(BUILTIN_
$(5)CPPINCLUDES
) \
89 $$(BUILTIN_
$(5)CPPFLAGS
) $$(BUILTIN_
$(5)CPPDEFINES
) $$(BUILTIN_
$(5)$(4)DEFINES
) \
90 $$(PROJECT_
$(5)CPPFLAGS
) $$(PROJECT_
$(5)CPPDEFINES
) $$(PROJECT_
$(5)$(4)DEFINES
) \
91 $$(MODULETYPE
$($(1)_TYPE
)_CPPFLAGS
) $$(MODULETYPE
$($(1)_TYPE
)_CPPDEFINES
) $$(MODULETYPE
$($(1)_TYPE
)_
$(4)DEFINES
) \
92 $$($(1)_CPPFLAGS
) $$($(1)_CPPDEFINES
) $$($(1)_
$(4)DEFINES
) \
94 $$(CPPFLAGS
) $$(CPPDEFINES
) $$($(5)$(4)DEFINES
)
96 #(module, flags, includes)
97 RBUILD_cflags
=${call RBUILD_compiler_flags_with_cpp
,$(1),$(2),$(3),C
}
98 RBUILD_cxxflags
=${call RBUILD_compiler_flags_with_cpp
,$(1),$(2),$(3),CXX
}
99 #~ RBUILD_asflags=${call RBUILD_compiler_flags_with_cpp,$(1),$(2),$(3),AS}
100 RBUILD_asflags
=${call RBUILD_compiler_flags_builtin_cpp
,$(1),$(2),$(3),AS
}
101 RBUILD_nasmflags
=${call RBUILD_compiler_flags_builtin_cpp
,$(1),$(2),$(3),NASM
}
102 RBUILD_rc_pp_flags
=${call RBUILD_compiler_flags_cpp
,$(1),-DRC_INVOKED
=1 -D__WIN32__
=1 -D__FLAT__
=1,$(3) -I.
,RC
}
103 RBUILD_rc_flags
=${call RBUILD_compiler_flags_with_includes
,$(1),$(2),$(3),RC
}
104 RBUILD_spec_pp_flags
=${call RBUILD_compiler_flags_cpp
,$(1),,$(3),SPEC
}
105 RBUILD_spec_flags
=${call RBUILD_compiler_flags
,$(1),$(2),,SPEC
}
106 RBUILD_midlflags
=${call RBUILD_compiler_flags_builtin_cpp
,$(1),$(2),$(3),MIDL
}
107 RBUILD_host_cflags
=${call RBUILD_compiler_flags_with_cpp
,$(1),$(2),$(3),C
,HOST_
}
108 RBUILD_host_cxxflags
=${call RBUILD_compiler_flags_with_cpp
,$(1),$(2),$(3),CXX
,HOST_
}
109 RBUILD_ldflags
=${call RBUILD_compiler_flags
,$(1),$(2),,LD
}
111 RCFLAG_UNICODE
:=-DUNICODE
-D_UNICODE
113 BUILTIN_ASDEFINES
+= -D__ASM__
114 BUILTIN_RCFLAGS
+= --nostdinc
115 BUILTIN_RCDEFINES
+= -DRC_INVOKED
116 BUILTIN_NASMFLAGS
+= -f win32
118 #(module, source, dependencies, cflags, output)
121 $(2): $${$(1)_precondition
}
123 ifeq ($(ROS_BUILDDEPS
),full
)
125 $(5).d
: $(2) |
${call RBUILD_dir
,$(5)}
127 $${gas} -MF
$$@
${call RBUILD_asflags
,$(1),$(4)} -M
-MP
-MT
$$@
$$<
131 $(5): $(2) $(5).d
$(3) |
${call RBUILD_dir
,$(5)}
133 $${gas} -o
$$@
${call RBUILD_asflags
,$(1),$(4)} -c
$$<
137 $(5): $(2) $(3) |
${call RBUILD_dir
,$(5)}
139 $${gas} -o
$$@
${call RBUILD_asflags
,$(1),$(4)} -c
$$<
145 #(module, source, dependencies, cflags)
146 RBUILD_GAS_RULE
=${call RBUILD_GAS
,$(1),$(2),$(3),$(4),${call RBUILD_intermediate_path_unique
,$(1),$(2)}.o
}
148 #(module, source, dependencies, cflags, output)
151 $(2): $${$(1)_precondition
}
153 $(5): $(2) $(3) |
${call RBUILD_dir
,$(5)}
155 $${nasm} -o
$$@
${call RBUILD_nasmflags
,$(1),$(4)} $$<
159 # TODO: module_dllname -> ${call RBUILD_module_dllname,$(1)}
161 #(module, source, dependencies, cflags, module_dllname, output)
162 define RBUILD_WINEBUILD_DEF
164 $(6): $(2) $$(winebuild_TARGET
) |
${call RBUILD_intermediate_dir
,$(6)}
166 $$(Q
)$$(winebuild_TARGET
) $$(WINEBUILD_FLAGS
) -o
$$@
--def
-E
$$< --filename
$(5) ${call RBUILD_spec_flags
,$(1),$(4)}
170 #(module, source, dependencies, cflags, module_dllname, output)
171 define RBUILD_WINEBUILD_STUBS
173 $(6): $(2) $$(winebuild_TARGET
) |
${call RBUILD_intermediate_dir
,$(6)}
175 $$(Q
)$$(winebuild_TARGET
) $$(WINEBUILD_FLAGS
) -o
$$@
--pedll
$$< --filename
$(5) ${call RBUILD_spec_flags
,$(1),$(4)}
179 #(module, source, dependencies, cflags, module_dllname)
180 define RBUILD_WINEBUILD_WITH_CPP_RULE
182 ifeq ($$(ROS_BUILDDEPS
),full
)
184 ${call RBUILD_DEPENDS
,$(1),$(2),,${call RBUILD_spec_pp_flags
,$(1),$(4)},${call RBUILD_intermediate_path_unique
,$(1),$(2)}.spec.d
}
185 -include ${call RBUILD_intermediate_path_unique
,$(1),$(2)}.spec.d
187 ${call RBUILD_CPP
,$(1),$(2),${call RBUILD_intermediate_path_unique
,$(1),$(2)}.spec.d
$(3),${call RBUILD_spec_pp_flags
,$(1),$(4)},${call RBUILD_intermediate_path_unique
,$(1),$(2)}.spec
}
191 ${call RBUILD_CPP
,$(1),$(2),$(3),${call RBUILD_spec_pp_flags
,$(1),$(4)},${call RBUILD_intermediate_path_unique
,$(1),$(2)}.spec
}
195 ${call RBUILD_WINEBUILD_DEF
,$(1),${call RBUILD_intermediate_path_unique
,$(1),$(2)}.spec
,,$(4),$(5),${call RBUILD_intermediate_path_unique
,$(1),$(2)}.auto.def
}
196 ${call RBUILD_WINEBUILD_STUBS
,$(1),${call RBUILD_intermediate_path_unique
,$(1),$(2)}.spec
,,$(4),$(5),${call RBUILD_intermediate_path_unique
,$(1),$(2)}.stubs.c
}
197 ${call RBUILD_CC
,$(1),${call RBUILD_intermediate_path_unique
,$(1),$(2)}.stubs.c
,,,${call RBUILD_intermediate_path_unique
,$(1),$(2)}.stubs.o
}
201 #(module, source, dependencies, cflags, module_dllname)
202 define RBUILD_WINEBUILD_RULE
204 ${call RBUILD_WINEBUILD_DEF
,$(1),$(2),$(3),$(4),$(5),${call RBUILD_intermediate_path_unique
,$(1),$(2)}.auto.def
}
205 ${call RBUILD_WINEBUILD_STUBS
,$(1),$(2),$(3),$(4),$(5),${call RBUILD_intermediate_path_unique
,$(1),$(2)}.stubs.c
}
206 ${call RBUILD_CC
,$(1),${call RBUILD_intermediate_path_unique
,$(1),$(2)}.stubs.c
,,,${call RBUILD_intermediate_path_unique
,$(1),$(2)}.stubs.o
}
210 # FIXME: wrc butchers localized strings and doesn't implement -M, so we have to use an external preprocessor
211 #(module, source, dependencies, cflags)
212 define RBUILD_WRC_RULE
214 $(2): $${$(1)_precondition
}
216 ifeq ($$(ROS_BUILDDEPS
),full
)
218 ${call RBUILD_DEPENDS
,$(1),$(2),,${call RBUILD_rc_pp_flags
,$(1),$(4)},${call RBUILD_intermediate_path_unique
,$(1),$(2)}.res.d
}
219 -include ${call RBUILD_intermediate_path_unique
,$(1),$(2)}.coff.d
221 ${call RBUILD_intermediate_path_unique
,$(1),$(2)}.res
: $(2) ${call RBUILD_intermediate_path_unique
,$(1),$(2)}.res.d
$(3) $$(wrc_TARGET
) |
${call RBUILD_intermediate_dir
,$(2)}
223 ${call RBUILD_PIPE_CPP
,$$<,${call RBUILD_rc_pp_flags
,$(1),$(4)}} |
$$(wrc_TARGET
) -o
$$@
${call RBUILD_rc_flags
,$(1),$(4),-I
${call RBUILD_dir
,$(2)}}
227 ${call RBUILD_intermediate_path_unique
,$(1),$(2)}.res
: $(2) $(3) $$(wrc_TARGET
) |
${call RBUILD_intermediate_dir
,$(2)}
229 ${call RBUILD_PIPE_CPP
,$$<,${call RBUILD_rc_pp_flags
,$(1),$(4)}} |
$$(wrc_TARGET
) -o
$$@
${call RBUILD_rc_flags
,$(1),$(4),-I
${call RBUILD_dir
,$(2)}}
233 ${call RBUILD_intermediate_path_unique
,$(1),$(2)}.coff
: ${call RBUILD_intermediate_path_unique
,$(1),$(2)}.res |
${call RBUILD_intermediate_dir
,$(2)}
235 $${windres} -i
$$< -o
$$@
-J res
-O coff
243 define RBUILD_WIDL_HEADER_RULE
245 $(2): $${$(1)_precondition
}
247 ${call RBUILD_intermediate_path_noext
,$(2)}.h
: $(2) $(3) $$(widl_TARGET
) |
${call RBUILD_intermediate_dir
,$(2)}
249 $$(Q
)$$(widl_TARGET
) ${call RBUILD_midlflags
,$(1),$(4),-I
${call RBUILD_dir
,$(2)}} -h
-H
$$@
$$<
253 #(module, source, dependencies, cflags)
254 define RBUILD_WIDL_CLIENT_RULE
256 $(2): $${$(1)_precondition
}
258 ${call RBUILD_intermediate_path_noext
,$(2)}_c.c
${call RBUILD_intermediate_path_noext
,$(2)}_c.h
: $(2) $(3) $$(widl_TARGET
) |
${call RBUILD_intermediate_dir
,$(2)}
260 $$(Q
)$$(widl_TARGET
) ${call RBUILD_midlflags
,$(1),$(4),-I
${call RBUILD_dir
,$(2)}} -h
-H
${call RBUILD_intermediate_path_noext
,$(2)}_c.h
-c
-C
${call RBUILD_intermediate_path_noext
,$(2)}_c.c
$(2)
262 ${call RBUILD_CC
,$(1),${call RBUILD_intermediate_path_noext
,$(2)}_c.c
,,,${call RBUILD_intermediate_path_noext
,$(2)}_c.o
}
266 #(module, source, dependencies, cflags)
267 define RBUILD_WIDL_SERVER_RULE
269 $(2): $${$(1)_precondition
}
271 ${call RBUILD_intermediate_path_noext
,$(2)}_s.c
${call RBUILD_intermediate_path_noext
,$(2)}_s.h
: $(2) $(3) $$(widl_TARGET
) |
${call RBUILD_intermediate_dir
,$(2)}
273 $$(Q
)$$(widl_TARGET
) ${call RBUILD_midlflags
,$(1),$(4),-I
${call RBUILD_dir
,$(2)}} -h
-H
${call RBUILD_intermediate_path_noext
,$(2)}_s.h
-s
-S
${call RBUILD_intermediate_path_noext
,$(2)}_s.c
$(2)
275 ${call RBUILD_CC
,$(1),${call RBUILD_intermediate_path_noext
,$(2)}_s.c
,,,${call RBUILD_intermediate_path_noext
,$(2)}_s.o
}
279 #(module, source, dependencies, cflags)
280 define RBUILD_WIDL_PROXY_RULE
282 $(2): $${$(1)_precondition
}
284 ${call RBUILD_intermediate_path_noext
,$(2)}_p.c
${call RBUILD_intermediate_path_noext
,$(2)}_p.h
: $(2) $(3) $$(widl_TARGET
) |
${call RBUILD_intermediate_dir
,$(2)}
286 $$(Q
)$$(widl_TARGET
) ${call RBUILD_midlflags
,$(1),$(4),-I
${call RBUILD_dir
,$(2)}} -h
-H
${call RBUILD_intermediate_path_noext
,$(2)}_p.h
-p
-P
${call RBUILD_intermediate_path_noext
,$(2)}_p.c
$(2)
288 ${call RBUILD_CC
,$(1),${call RBUILD_intermediate_path_noext
,$(2)}_p.c
,,,${call RBUILD_intermediate_path_noext
,$(2)}_p.o
}
292 #(module, source, dependencies, cflags)
293 define RBUILD_WIDL_INTERFACE_RULE
295 $(2): $${$(1)_precondition
}
297 ${call RBUILD_intermediate_path_noext
,$(2)}_i.c
: $(2) $(3) $$(widl_TARGET
) |
${call RBUILD_intermediate_dir
,$(2)}
299 $$(Q
)$$(widl_TARGET
) ${call RBUILD_midlflags
,$(1),$(4),-I
${call RBUILD_dir
,$(2)}} -u
-U
$$@
$$<
301 ${call RBUILD_CC
,$(1),${call RBUILD_intermediate_path_noext
,$(2)}_i.c
,,,${call RBUILD_intermediate_path_noext
,$(2)}_i.o
}
305 # FIXME: this rule sucks
306 #(module, source, dependencies, cflags, bare_dependencies)
307 define RBUILD_WIDL_DLLDATA_RULE
309 $(2): $(3) ${$(1)_precondition
} $$(widl_TARGET
) |
${call RBUILD_intermediate_dir
,$(2)}
311 $$(Q
)$$(widl_TARGET
) ${call RBUILD_midlflags
,$(1),$(4)} --dlldata-only
--dlldata
=$(2) $(5)
313 ${call RBUILD_CC
,$(1),$(2),,,${call RBUILD_intermediate_path_noext
,$(2)}.o
}
317 #(module, source, dependencies, cflags)
318 define RBUILD_WIDL_TLB_RULE
320 $(2): $${$(1)_precondition
}
322 ${call RBUILD_intermediate_dir
,$(2)}$$(SEP
)$(1).tlb
: $(2) $(3) $$(widl_TARGET
) |
${call RBUILD_intermediate_dir
,$(2)}
324 $$(Q
)$$(widl_TARGET
) ${call RBUILD_midlflags
,$(1),$(4),-I
${call RBUILD_dir
,$(2)}} -t
-T
$$@
$$<
328 #(module, source, dependencies, cflags)
329 define RBUILD_HOST_GCC_RULE
331 $(2): $${$(1)_precondition
}
333 ${call RBUILD_intermediate_path_unique
,$(1),$(2)}.o
: $(2) $(3) |
${call RBUILD_intermediate_dir
,$(2)}
335 $${host_gcc} -o
$$@
${call RBUILD_host_cflags
,$(1),$(4)} -c
$$<
339 #(module, source, dependencies, cflags)
340 define RBUILD_HOST_GPP_RULE
342 $(2): $${$(1)_precondition
}
344 ${call RBUILD_intermediate_path_unique
,$(1),$(2)}.o
: $(2) $(3) |
${call RBUILD_intermediate_dir
,$(2)}
346 $${host_gpp} -o
$$@
${call RBUILD_host_cxxflags
,$(1),$(4)} -c
$$<