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)))
23 RBUILD_noext
=$(dir $(1))$(basename $(notdir $(1)))
26 RBUILD_dir
=${call RBUILD_fullpath
,$(dir ${call RBUILD_compress_prefixes
,$(1)})}
28 #(module, flags, includes, compiler, prefix)
29 RBUILD_compiler_flags
=\
30 $$(BUILTIN_
$(5)$(4)FLAGS
) \
31 $$(PROJECT_
$(5)$(4)FLAGS
) \
32 $$(MODULETYPE
$($(1)_TYPE
)_
$(4)FLAGS
) \
37 #(module, flags, includes, compiler, prefix)
38 RBUILD_compiler_flags_with_cpp
=\
39 $$($(5)$(4)INCLUDES
) $$(CPPINCLUDES
) \
41 $$($(1)_
$(4)INCLUDES
) $$($(1)_CPPINCLUDES
) \
42 $$(MODULETYPE
$($(1)_TYPE
)_
$(4)INCLUDES
) $$(MODULETYPE
$($(1)_TYPE
)_CPPINCLUDES
) \
43 $$(PROJECT_
$(5)$(4)INCLUDES
) $$(PROJECT_
$(5)CPPINCLUDES
) \
44 $$(BUILTIN_
$(5)$(4)INCLUDES
) $$(BUILTIN_
$(5)CPPINCLUDES
) \
45 $$(BUILTIN_
$(5)CPPDEFINES
) $$(BUILTIN_
$(5)CPPFLAGS
) $$(BUILTIN_
$(5)$(4)DEFINES
) $$(BUILTIN_
$(5)$(4)FLAGS
) \
46 $$(PROJECT_
$(5)CPPDEFINES
) $$(PROJECT_
$(5)CPPFLAGS
) $$(PROJECT_
$(5)$(4)DEFINES
) $$(PROJECT_
$(5)$(4)FLAGS
) \
47 $$(MODULETYPE
$($(1)_TYPE
)_CPPDEFINES
) $$(MODULETYPE
$($(1)_TYPE
)_CPPFLAGS
) $$(MODULETYPE
$($(1)_TYPE
)_
$(4)DEFINES
) $$(MODULETYPE
$($(1)_TYPE
)_
$(4)FLAGS
) \
48 $$($(1)_CPPDEFINES
) $$($(1)_CPPFLAGS
) $$($(1)_
$(4)DEFINES
) $$($(1)_
$(4)FLAGS
) \
50 $$(CPPDEFINES
) $$(CPPFLAGS
) $$($(5)$(4)DEFINES
) $$($(5)$(4)FLAGS
)
52 #(module, flags, includes, compiler, prefix)
53 RBUILD_compiler_flags_builtin_cpp
=\
54 $$($(5)$(4)INCLUDES
) $$(CPPINCLUDES
) \
56 $$($(1)_
$(4)INCLUDES
) $$($(1)_CPPINCLUDES
) \
57 $$(MODULETYPE
$($(1)_TYPE
)_
$(4)INCLUDES
) $$(MODULETYPE
$($(1)_TYPE
)_CPPINCLUDES
) \
58 $$(PROJECT_
$(5)$(4)INCLUDES
) $$(PROJECT_
$(5)CPPINCLUDES
) \
59 $$(BUILTIN_
$(5)$(4)INCLUDES
) $$(BUILTIN_
$(5)CPPINCLUDES
) \
60 $$(BUILTIN_
$(5)CPPDEFINES
) $$(BUILTIN_
$(5)$(4)DEFINES
) $$(BUILTIN_
$(5)$(4)FLAGS
) \
61 $$(PROJECT_
$(5)CPPDEFINES
) $$(PROJECT_
$(5)$(4)DEFINES
) $$(PROJECT_
$(5)$(4)FLAGS
) \
62 $$(MODULETYPE
$($(1)_TYPE
)_CPPDEFINES
) $$(MODULETYPE
$($(1)_TYPE
)_
$(4)DEFINES
) $$(MODULETYPE
$($(1)_TYPE
)_
$(4)FLAGS
) \
63 $$($(1)_CPPDEFINES
) $$($(1)_
$(4)DEFINES
) $$($(1)_
$(4)FLAGS
) \
65 $$(CPPDEFINES
) $$($(5)$(4)DEFINES
) $$($(5)$(4)FLAGS
)
67 #(module, flags, includes, compiler, prefix)
68 RBUILD_compiler_flags_with_includes
=\
69 $$($(5)$(4)INCLUDES
) \
71 $$($(1)_
$(4)INCLUDES
) $$($(1)_CPPINCLUDES
) \
72 $$(MODULETYPE
$($(1)_TYPE
)_
$(4)INCLUDES
) \
73 $$(PROJECT_
$(5)$(4)INCLUDES
) \
74 $$(BUILTIN_
$(5)$(4)INCLUDES
) \
75 $$(BUILTIN_
$(5)$(4)FLAGS
) \
76 $$(PROJECT_
$(5)$(4)FLAGS
) \
77 $$(MODULETYPE
$($(1)_TYPE
)_
$(4)FLAGS
) \
82 #(module, flags, includes, compiler, prefix)
83 RBUILD_compiler_flags_cpp
=\
84 $$($(5)$(4)INCLUDES
) $$(CPPINCLUDES
) \
86 $$($(1)_
$(4)INCLUDES
) $$($(1)_CPPINCLUDES
) \
87 $$(MODULETYPE
$($(1)_TYPE
)_
$(4)INCLUDES
) $$(MODULETYPE
$($(1)_TYPE
)_CPPINCLUDES
) \
88 $$(PROJECT_
$(5)$(4)INCLUDES
) $$(PROJECT_
$(5)CPPINCLUDES
) \
89 $$(BUILTIN_
$(5)$(4)INCLUDES
) $$(BUILTIN_
$(5)CPPINCLUDES
) \
90 $$(BUILTIN_
$(5)CPPFLAGS
) $$(BUILTIN_
$(5)CPPDEFINES
) $$(BUILTIN_
$(5)$(4)DEFINES
) \
91 $$(PROJECT_
$(5)CPPFLAGS
) $$(PROJECT_
$(5)CPPDEFINES
) $$(PROJECT_
$(5)$(4)DEFINES
) \
92 $$(MODULETYPE
$($(1)_TYPE
)_CPPFLAGS
) $$(MODULETYPE
$($(1)_TYPE
)_CPPDEFINES
) $$(MODULETYPE
$($(1)_TYPE
)_
$(4)DEFINES
) \
93 $$($(1)_CPPFLAGS
) $$($(1)_CPPDEFINES
) $$($(1)_
$(4)DEFINES
) \
95 $$(CPPFLAGS
) $$(CPPDEFINES
) $$($(5)$(4)DEFINES
)
97 #(module, flags, includes)
98 RBUILD_cflags
=${call RBUILD_compiler_flags_with_cpp
,$(1),$(2),$(3),C
}
99 RBUILD_cxxflags
=${call RBUILD_compiler_flags_with_cpp
,$(1),$(2),$(3),CXX
}
100 #~ RBUILD_asflags=${call RBUILD_compiler_flags_with_cpp,$(1),$(2),$(3),AS}
101 RBUILD_asflags
=${call RBUILD_compiler_flags_builtin_cpp
,$(1),$(2),$(3),AS
}
102 RBUILD_nasmflags
=${call RBUILD_compiler_flags_builtin_cpp
,$(1),$(2),$(3),NASM
}
103 RBUILD_rc_pp_flags
=${call RBUILD_compiler_flags_cpp
,$(1),-DRC_INVOKED
=1 -D__WIN32__
=1 -D__FLAT__
=1,$(3) -I.
,RC
}
104 RBUILD_rc_flags
=${call RBUILD_compiler_flags_with_includes
,$(1),$(2),$(3),RC
}
105 RBUILD_spec_pp_flags
=${call RBUILD_compiler_flags_cpp
,$(1),,$(3),SPEC
}
106 RBUILD_spec_flags
=${call RBUILD_compiler_flags
,$(1),$(2),,SPEC
}
107 RBUILD_midlflags
=${call RBUILD_compiler_flags_builtin_cpp
,$(1),$(2),$(3),MIDL
}
108 RBUILD_host_cflags
=${call RBUILD_compiler_flags_with_cpp
,$(1),$(2),$(3),C
,HOST_
}
109 RBUILD_host_cxxflags
=${call RBUILD_compiler_flags_with_cpp
,$(1),$(2),$(3),CXX
,HOST_
}
110 RBUILD_ldflags
=${call RBUILD_compiler_flags
,$(1),$(2),,LD
}
112 RCFLAG_UNICODE
:=-DUNICODE
-D_UNICODE
114 BUILTIN_ASDEFINES
+= -D__ASM__
115 BUILTIN_RCFLAGS
+= --nostdinc
116 BUILTIN_RCDEFINES
+= -DRC_INVOKED
117 BUILTIN_NASMFLAGS
+= -f win32
119 #(module, source, dependencies, cflags, output)
122 $(2): $${$(1)_precondition
}
124 ifeq ($(ROS_BUILDDEPS
),full
)
126 $(5).d
: $(2) |
${call RBUILD_dir
,$(5)}
128 $${gas} -MF
$$@
${call RBUILD_asflags
,$(1),$(4)} -M
-MP
-MT
$$@
$$<
132 $(5): $(2) $(5).d
$(3) |
${call RBUILD_dir
,$(5)}
134 $${gas} -o
$$@
${call RBUILD_asflags
,$(1),$(4)} -c
$$<
138 $(5): $(2) $(3) |
${call RBUILD_dir
,$(5)}
140 $${gas} -o
$$@
${call RBUILD_asflags
,$(1),$(4)} -c
$$<
146 #(module, source, dependencies, cflags)
147 RBUILD_GAS_RULE
=${call RBUILD_GAS
,$(1),$(2),$(3),$(4),${call RBUILD_intermediate_path_unique
,$(1),$(2)}.o
}
149 #(module, source, dependencies, cflags, output)
152 $(2): $${$(1)_precondition
}
154 $(5): $(2) $(3) |
${call RBUILD_dir
,$(5)}
156 $${nasm} -o
$$@
${call RBUILD_nasmflags
,$(1),$(4)} $$<
160 # TODO: module_dllname -> ${call RBUILD_module_dllname,$(1)}
162 #(module, source, dependencies, cflags, module_dllname, output)
163 define RBUILD_WINEBUILD_DEF
165 $(6): $(2) $$(winebuild_TARGET
) |
${call RBUILD_intermediate_dir
,$(6)}
167 $$(Q
)$$(winebuild_TARGET
) $$(WINEBUILD_FLAGS
) -o
$$@
--def
-E
$$< --filename
$(5) ${call RBUILD_spec_flags
,$(1),$(4)}
171 #(module, source, dependencies, cflags, module_dllname, output)
172 define RBUILD_WINEBUILD_STUBS
174 $(6): $(2) $$(winebuild_TARGET
) |
${call RBUILD_intermediate_dir
,$(6)}
176 $$(Q
)$$(winebuild_TARGET
) $$(WINEBUILD_FLAGS
) -o
$$@
--pedll
$$< --filename
$(5) ${call RBUILD_spec_flags
,$(1),$(4)}
180 #(module, source, dependencies, cflags, module_dllname)
181 define RBUILD_WINEBUILD_WITH_CPP_RULE
183 ifeq ($$(ROS_BUILDDEPS
),full
)
185 ${call RBUILD_DEPENDS
,$(1),$(2),,${call RBUILD_spec_pp_flags
,$(1),$(4)},${call RBUILD_intermediate_path_unique
,$(1),$(2)}.spec.d
}
186 -include ${call RBUILD_intermediate_path_unique
,$(1),$(2)}.spec.d
188 ${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
}
192 ${call RBUILD_CPP
,$(1),$(2),$(3),${call RBUILD_spec_pp_flags
,$(1),$(4)},${call RBUILD_intermediate_path_unique
,$(1),$(2)}.spec
}
196 ${call RBUILD_WINEBUILD_DEF
,$(1),${call RBUILD_intermediate_path_unique
,$(1),$(2)}.spec
,,$(4),$(5),${call RBUILD_intermediate_path_unique
,$(1),$(2)}.auto.def
}
197 ${call RBUILD_WINEBUILD_STUBS
,$(1),${call RBUILD_intermediate_path_unique
,$(1),$(2)}.spec
,,$(4),$(5),${call RBUILD_intermediate_path_unique
,$(1),$(2)}.stubs.c
}
198 ${call RBUILD_CC
,$(1),${call RBUILD_intermediate_path_unique
,$(1),$(2)}.stubs.c
,,,${call RBUILD_intermediate_path_unique
,$(1),$(2)}.stubs.o
}
202 #(module, source, dependencies, cflags, module_dllname)
203 define RBUILD_WINEBUILD_RULE
205 ${call RBUILD_WINEBUILD_DEF
,$(1),$(2),$(3),$(4),$(5),${call RBUILD_intermediate_path_unique
,$(1),$(2)}.auto.def
}
206 ${call RBUILD_WINEBUILD_STUBS
,$(1),$(2),$(3),$(4),$(5),${call RBUILD_intermediate_path_unique
,$(1),$(2)}.stubs.c
}
207 ${call RBUILD_CC
,$(1),${call RBUILD_intermediate_path_unique
,$(1),$(2)}.stubs.c
,,,${call RBUILD_intermediate_path_unique
,$(1),$(2)}.stubs.o
}
211 # FIXME: wrc butchers localized strings and doesn't implement -M, so we have to use an external preprocessor
212 #(module, source, dependencies, cflags)
213 define RBUILD_WRC_RULE
215 $(2): $${$(1)_precondition
}
217 ifeq ($$(ROS_BUILDDEPS
),full
)
219 ${call RBUILD_DEPENDS
,$(1),$(2),,${call RBUILD_rc_pp_flags
,$(1),$(4)},${call RBUILD_intermediate_path_unique
,$(1),$(2)}.res.d
}
220 -include ${call RBUILD_intermediate_path_unique
,$(1),$(2)}.coff.d
222 ${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)}
224 ${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)}}
228 ${call RBUILD_intermediate_path_unique
,$(1),$(2)}.res
: $(2) $(3) $$(wrc_TARGET
) |
${call RBUILD_intermediate_dir
,$(2)}
230 ${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)}}
234 ${call RBUILD_intermediate_path_unique
,$(1),$(2)}.coff
: ${call RBUILD_intermediate_path_unique
,$(1),$(2)}.res |
${call RBUILD_intermediate_dir
,$(2)}
236 $${windres} -i
$$< -o
$$@
-J res
-O coff
244 define RBUILD_WIDL_HEADER_RULE
246 $(2): $${$(1)_precondition
}
248 ${call RBUILD_intermediate_path_noext
,$(2)}.h
: $(2) $(3) $$(widl_TARGET
) |
${call RBUILD_intermediate_dir
,$(2)}
250 $$(Q
)$$(widl_TARGET
) ${call RBUILD_midlflags
,$(1),$(4),-I
${call RBUILD_dir
,$(2)}} -h
-H
$$@
$$<
254 #(module, source, dependencies, cflags)
255 define RBUILD_WIDL_CLIENT_RULE
257 $(2): $${$(1)_precondition
}
259 ${call RBUILD_intermediate_path_noext
,$(2)}_c.c
${call RBUILD_intermediate_path_noext
,$(2)}_c.h
: ${call RBUILD_intermediate_path_noext
,$(2)}_c
261 ${call RBUILD_intermediate_path_noext
,$(2)}_c
: $(2) $(3) $$(widl_TARGET
) |
${call RBUILD_intermediate_dir
,$(2)}
263 $$(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)
264 $${checkpoint} $$@
>$(NUL
)
266 ${call RBUILD_CC
,$(1),${call RBUILD_intermediate_path_noext
,$(2)}_c.c
,,,${call RBUILD_intermediate_path_noext
,$(2)}_c.o
}
270 #(module, source, dependencies, cflags)
271 define RBUILD_WIDL_SERVER_RULE
273 $(2): $${$(1)_precondition
}
275 ${call RBUILD_intermediate_path_noext
,$(2)}_s.c
${call RBUILD_intermediate_path_noext
,$(2)}_s.h
: ${call RBUILD_intermediate_path_noext
,$(2)}_s
277 ${call RBUILD_intermediate_path_noext
,$(2)}_s
: $(2) $(3) $$(widl_TARGET
) |
${call RBUILD_intermediate_dir
,$(2)}
279 $$(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)
280 $${checkpoint} $$@
>$(NUL
)
282 ${call RBUILD_CC
,$(1),${call RBUILD_intermediate_path_noext
,$(2)}_s.c
,,,${call RBUILD_intermediate_path_noext
,$(2)}_s.o
}
286 #(module, source, dependencies, cflags)
287 define RBUILD_WIDL_PROXY_RULE
289 $(2): $${$(1)_precondition
}
291 ${call RBUILD_intermediate_path_noext
,$(2)}_p.c
${call RBUILD_intermediate_path_noext
,$(2)}_p.h
: ${call RBUILD_intermediate_path_noext
,$(2)}_p
293 ${call RBUILD_intermediate_path_noext
,$(2)}_p
: $(2) $(3) $$(widl_TARGET
) |
${call RBUILD_intermediate_dir
,$(2)}
295 $$(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)
296 $${checkpoint} $$@
>$(NUL
)
298 ${call RBUILD_CC
,$(1),${call RBUILD_intermediate_path_noext
,$(2)}_p.c
,,,${call RBUILD_intermediate_path_noext
,$(2)}_p.o
}
302 #(module, source, dependencies, cflags)
303 define RBUILD_WIDL_INTERFACE_RULE
305 $(2): $${$(1)_precondition
}
307 ${call RBUILD_intermediate_path_noext
,$(2)}_i.c
: $(2) $(3) $$(widl_TARGET
) |
${call RBUILD_intermediate_dir
,$(2)}
309 $$(Q
)$$(widl_TARGET
) ${call RBUILD_midlflags
,$(1),$(4),-I
${call RBUILD_dir
,$(2)}} -u
-U
$$@
$$<
311 ${call RBUILD_CC
,$(1),${call RBUILD_intermediate_path_noext
,$(2)}_i.c
,,,${call RBUILD_intermediate_path_noext
,$(2)}_i.o
}
315 # FIXME: this rule sucks
316 #(module, source, dependencies, cflags, bare_dependencies)
317 define RBUILD_WIDL_DLLDATA_RULE
319 $(2): $(3) ${$(1)_precondition
} $$(widl_TARGET
) |
${call RBUILD_intermediate_dir
,$(2)}
321 $$(Q
)$$(widl_TARGET
) ${call RBUILD_midlflags
,$(1),$(4)} --dlldata-only
--dlldata
=$(2) $(5)
323 ${call RBUILD_CC
,$(1),$(2),,,${call RBUILD_intermediate_path_noext
,$(2)}.o
}
327 #(module, source, dependencies, cflags)
328 define RBUILD_WIDL_TLB_RULE
330 $(2): $${$(1)_precondition
}
332 ${call RBUILD_intermediate_dir
,$(2)}$$(SEP
)$(1).tlb
: $(2) $(3) $$(widl_TARGET
) |
${call RBUILD_intermediate_dir
,$(2)}
334 $$(Q
)$$(widl_TARGET
) ${call RBUILD_midlflags
,$(1),$(4),-I
${call RBUILD_dir
,$(2)}} -t
-T
$$@
$$<
338 #(module, source, dependencies, cflags)
339 define RBUILD_HOST_GCC_RULE
341 $(2): $${$(1)_precondition
}
343 ${call RBUILD_intermediate_path_unique
,$(1),$(2)}.o
: $(2) $(3) |
${call RBUILD_intermediate_dir
,$(2)}
345 $${host_gcc} -o
$$@
${call RBUILD_host_cflags
,$(1),$(4)} -c
$$<
349 #(module, source, dependencies, cflags)
350 define RBUILD_HOST_GPP_RULE
352 $(2): $${$(1)_precondition
}
354 ${call RBUILD_intermediate_path_unique
,$(1),$(2)}.o
: $(2) $(3) |
${call RBUILD_intermediate_dir
,$(2)}
356 $${host_gpp} -o
$$@
${call RBUILD_host_cxxflags
,$(1),$(4)} -c
$$<