src/Makefile.kmk: new sed on windows
[kbuild-mirror.git] / kBuild / tools / GCC42MACHO.kmk
blob2dcaec022a74121f02040ae122aae161b108f900
1 # $Id$
2 ## @file
3 # kBuild Tool Config - GCC v4.2.x targeting Darwin (Mac OS X) Mach-O.
7 # Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
9 # This file is part of kBuild.
11 # kBuild is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2 of the License, or
14 # (at your option) any later version.
16 # kBuild is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with kBuild; if not, write to the Free Software
23 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 # As a special exception you are granted permission to include this file, via
27 # the kmk include directive, as you wish without this in itself causing the
28 # resulting makefile, program or whatever to be covered by the GPL license.
29 # This exception does not however invalidate any other reasons why the makefile,
30 # program, whatever should not be covered the GPL.
34 TOOL_GCC42MACHO := GCC v4.2.x targeting Darwin (Mac OS X) Mach-O.
36 # Tool Specific Properties
37 ifndef TOOL_GCC42MACHO_PREFIX
38 TOOL_GCC42MACHO_PREFIX :=
39 endif
40 ifndef TOOL_GCC42MACHO_SUFFIX
41 TOOL_GCC42MACHO_SUFFIX := -4.2$(HOSTSUFF_EXE)
42 endif
43 TOOL_GCC42MACHO_PREFIX2 ?=
44 TOOL_GCC42MACHO_SUFFIX2 ?=
45 TOOL_GCC42MACHO_CC ?= $(TOOL_GCC42MACHO_PREFIX)gcc$(TOOL_GCC42MACHO_SUFFIX)
46 TOOL_GCC42MACHO_CXX ?= $(TOOL_GCC42MACHO_PREFIX)g++$(TOOL_GCC42MACHO_SUFFIX)
47 TOOL_GCC42MACHO_OBJC ?= $(TOOL_GCC42MACHO_PREFIX)gcc$(TOOL_GCC42MACHO_SUFFIX)
48 TOOL_GCC42MACHO_OBJCXX ?= $(TOOL_GCC42MACHO_PREFIX)gcc$(TOOL_GCC42MACHO_SUFFIX)
49 TOOL_GCC42MACHO_AS ?= $(TOOL_GCC42MACHO_PREFIX)gcc$(TOOL_GCC42MACHO_SUFFIX)
50 TOOL_GCC42MACHO_LD ?= $(TOOL_GCC42MACHO_PREFIX)gcc$(TOOL_GCC42MACHO_SUFFIX)
51 TOOL_GCC42MACHO_LD_SYSMOD ?= $(TOOL_GCC42MACHO_PREFIX)gcc$(TOOL_GCC42MACHO_SUFFIX)
52 TOOL_GCC42MACHO_LDFLAGS.dll ?= -dynamiclib
53 TOOL_GCC42MACHO_LDFLAGS.sysmod ?= -r
54 #TOOL_GCC42MACHO_LD_SONAME = -Wl,-dylib_install_name $(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
56 TOOL_GCC42MACHO_AR ?= $(TOOL_GCC4MACHO_PREFIX2)ar$(TOOL_GCC4MACHO_SUFFIX2)
57 TOOL_GCC42MACHO_DSYMUTIL ?= $(TOOL_GCC4MACHO_PREFIX2)dsymutil$(TOOL_GCC4MACHO_SUFFIX2)
58 TOOL_GCC42MACHO_STRIP ?= $(TOOL_GCC4MACHO_PREFIX2)strip$(TOOL_GCC4MACHO_SUFFIX2)
59 TOOL_GCC42MACHO_STRIP_PROGRAM ?= $(TOOL_GCC42MACHO_STRIP) -SXxru
60 TOOL_GCC42MACHO_STRIP_DLL ?= $(TOOL_GCC42MACHO_STRIP) -Sxru
61 TOOL_GCC42MACHO_STRIP_SYSMOD ?= $(TOOL_GCC42MACHO_STRIP) -Sru
63 # General Properties used by kBuild
64 TOOL_GCC42MACHO_COBJSUFF ?= .o
65 TOOL_GCC42MACHO_CFLAGS ?=
66 TOOL_GCC42MACHO_CFLAGS.debug ?= -g
67 TOOL_GCC42MACHO_CFLAGS.profile ?= -g -O2 #-pg
68 TOOL_GCC42MACHO_CFLAGS.release ?= -O2
69 TOOL_GCC42MACHO_CINCS ?=
70 TOOL_GCC42MACHO_CDEFS ?=
72 TOOL_GCC42MACHO_CXXOBJSUFF ?= .o
73 TOOL_GCC42MACHO_CXXFLAGS ?=
74 TOOL_GCC42MACHO_CXXFLAGS.debug ?= -g
75 TOOL_GCC42MACHO_CXXFLAGS.profile ?= -g -O2 #-pg
76 TOOL_GCC42MACHO_CXXFLAGS.release ?= -O2
77 TOOL_GCC42MACHO_CXXINCS ?=
78 TOOL_GCC42MACHO_CXXDEFS ?=
80 TOOL_GCC42MACHO_OBJCOBJSUFF ?= .o
81 TOOL_GCC42MACHO_OBJCFLAGS ?=
82 TOOL_GCC42MACHO_OBJCFLAGS.debug ?= -g
83 TOOL_GCC42MACHO_OBJCFLAGS.profile?= -O2 #-g -pg
84 TOOL_GCC42MACHO_OBJCFLAGS.release?= -O2
85 TOOL_GCC42MACHO_OBJCINCS ?=
86 TOOL_GCC42MACHO_OBJCDEFS ?=
88 TOOL_GCC42MACHO_OBJCXXOBJSUFF ?= .o
89 TOOL_GCC42MACHO_OBJCXXFLAGS ?=
90 TOOL_GCC42MACHO_OBJCXXFLAGS.debug ?= -g
91 TOOL_GCC42MACHO_OBJCXXFLAGS.profile ?= -O2 #-g -pg
92 TOOL_GCC42MACHO_OBJCXXFLAGS.release ?= -O2
93 TOOL_GCC42MACHO_OBJCXXINCS ?=
94 TOOL_GCC42MACHO_OBJCXXDEFS ?=
96 TOOL_GCC42MACHO_ASFLAGS ?= -x assembler-with-cpp
97 TOOL_GCC42MACHO_ASFLAGS.debug ?= -g
98 TOOL_GCC42MACHO_ASFLAGS.profile ?= -g
99 TOOL_GCC42MACHO_ASOBJSUFF ?= .o
101 TOOL_GCC42MACHO_ARFLAGS ?= -c -rs
102 TOOL_GCC42MACHO_ARLIBSUFF ?= .a
104 TOOL_GCC42MACHO_LDFLAGS ?=
105 TOOL_GCC42MACHO_LDFLAGS.debug ?= -g
106 TOOL_GCC42MACHO_LDFLAGS.profile ?= -g
110 # Calculate the files in the debug bundle.
111 # @param 1 The whole output filename.
112 # @param 2 The output filename sans suffix.
113 TOOL_GCC42MACHO_DEBUG_BUNDLE_FN = \
114 $(1).dSYM/ \
115 $(1).dSYM/Contents/ \
116 $(1).dSYM/Contents/Resources/ \
117 $(1).dSYM/Contents/Resources/DWARF/ \
118 $(1).dSYM/Contents/Info.plist \
119 $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1))
122 # Calculate the files in the debug bundle.
123 # @param 1 The whole linker output filename.
124 # @param 2 The linker output filename sans suffix.
125 # @param 3 The desired install name (no dir slash).
126 # @remarks The Info.plist has some reference to the original name, but gdb
127 # does not care and only check for a symbol file in the DWARF
128 # directory with the same name as the debugged module.
129 TOOL_GCC42MACHO_DEBUG_INSTALL_FN= \
130 $(3).dSYM/ \
131 $(3).dSYM/Contents/ \
132 $(3).dSYM/Contents/Resources/ \
133 $(3).dSYM/Contents/Resources/DWARF/ \
134 $(1).dSYM/Contents/Info.plist=>$(3).dSYM/Contents/Info.plist \
135 $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1))=>$(3).dSYM/Contents/Resources/DWARF/$(notdir $(3))
138 ## Compile C source.
139 # @param $(target) Normalized main target name.
140 # @param $(source) Source filename (relative).
141 # @param $(obj) Object file name. This shall be (re)created by the compilation.
142 # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
143 # @param $(flags) Flags.
144 # @param $(defs) Definitions. No -D or something.
145 # @param $(incs) Includes. No -I or something.
146 # @param $(dirdep) Directory creation dependency.
147 # @param $(deps) Other dependencies.
149 # @param $(outbase) Output basename (full). Use this for list files and such.
150 # @param $(objsuff) Object suffix.
151 TOOL_GCC42MACHO_COMPILE_C_DEPEND =
152 TOOL_GCC42MACHO_COMPILE_C_DEPORD =
153 ifdef KBUILD_USE_KOBJCACHE
154 TOOL_GCC42MACHO_COMPILE_C_USES_KOBJCACHE = 1
155 TOOL_GCC42MACHO_COMPILE_C_OUTPUT = $(outbase).i
156 define TOOL_GCC42MACHO_COMPILE_C_CMDS
157 $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
158 --kObjCache-cpp $(outbase).i\
159 $(TOOL_GCC42MACHO_CC) -E -o -\
160 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
161 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
162 $(abspath $(source))\
163 --kObjCache-cc $(obj)\
164 $(TOOL_GCC42MACHO_CC) -c\
165 $(flags) -fpreprocessed -x c\
166 -o $(obj)\
168 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
169 endef
170 else # !KBUILD_USE_KOBJCACHE
171 TOOL_GCC42MACHO_COMPILE_C_OUTPUT =
172 define TOOL_GCC42MACHO_COMPILE_C_CMDS
173 $(QUIET)$(TOOL_GCC42MACHO_CC) -c\
174 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
175 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
176 -o $(obj)\
177 $(abspath $(source))
178 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
179 endef
180 endif # !KUSE_OBJCACHE
183 ## Compile C++ source.
184 # @param $(target) Normalized main target name.
185 # @param $(source) Source filename (relative).
186 # @param $(obj) Object file name. This shall be (re)created by the compilation.
187 # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
188 # @param $(flags) Flags.
189 # @param $(defs) Definitions. No -D or something.
190 # @param $(incs) Includes. No -I or something.
191 # @param $(dirdep) Directory creation dependency.
192 # @param $(deps) Other dependencies.
193 # @param $(outbase) Output basename (full). Use this for list files and such.
194 # @param $(objsuff) Object suffix.
195 TOOL_GCC42MACHO_COMPILE_CXX_DEPEND =
196 TOOL_GCC42MACHO_COMPILE_CXX_DEPORD =
197 ifdef KBUILD_USE_KOBJCACHE
198 TOOL_GCC42MACHO_COMPILE_CXX_USES_KOBJCACHE = 1
199 TOOL_GCC42MACHO_COMPILE_CXX_OUTPUT = $(outbase).ii
200 define TOOL_GCC42MACHO_COMPILE_CXX_CMDS
201 $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
202 --kObjCache-cpp $(outbase).ii\
203 $(TOOL_GCC42MACHO_CXX) -E -o -\
204 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
205 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
206 $(abspath $(source))\
207 --kObjCache-cc $(obj)\
208 $(TOOL_GCC42MACHO_CXX) -c\
209 $(flags) -fpreprocessed -x c++\
210 -o $(obj)\
212 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
213 endef
214 else # !KBUILD_USE_KOBJCACHE
215 TOOL_GCC42MACHO_COMPILE_CXX_OUTPUT =
216 define TOOL_GCC42MACHO_COMPILE_CXX_CMDS
217 $(QUIET)$(TOOL_GCC42MACHO_CXX) -c\
218 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
219 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
220 -o $(obj)\
221 $(abspath $(source))
222 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
223 endef
224 endif # !KBUILD_USE_KOBJCACHE
227 ## Compile Objective-C source.
228 # @param $(target) Normalized main target name.
229 # @param $(source) Source filename (relative).
230 # @param $(obj) Object file name. This shall be (re)created by the compilation.
231 # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
232 # @param $(flags) Flags.
233 # @param $(defs) Definitions. No -D or something.
234 # @param $(incs) Includes. No -I or something.
235 # @param $(dirdep) Directory creation dependency.
236 # @param $(deps) Other dependencies.
237 # @param $(outbase) Output basename (full). Use this for list files and such.
238 # @param $(objsuff) Object suffix.
239 TOOL_GCC42MACHO_COMPILE_OBJC_DEPEND =
240 TOOL_GCC42MACHO_COMPILE_OBJC_DEPORD =
241 ifdef KBUILD_USE_KOBJCACHE
242 TOOL_GCC42MACHO_COMPILE_OBJC_USES_KOBJCACHE = 1
243 TOOL_GCC42MACHO_COMPILE_OBJC_OUTPUT = $(outbase).mi
244 define TOOL_GCC42MACHO_COMPILE_OBJC_CMDS
245 $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
246 --kObjCache-cpp $(outbase).ii\
247 $(TOOL_GCC42MACHO_OBJC) -E -o -\
248 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
249 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
250 $(abspath $(source))\
251 --kObjCache-cc $(obj)\
252 $(TOOL_GCC42MACHO_OBJC) -c\
253 $(flags) -fpreprocessed -x cbjective-c\
254 -o $(obj)\
256 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
257 endef
258 else # !KBUILD_USE_KOBJCACHE
259 TOOL_GCC42MACHO_COMPILE_OBJC_OUTPUT =
260 define TOOL_GCC42MACHO_COMPILE_OBJC_CMDS
261 $(QUIET)$(TOOL_GCC42MACHO_OBJC) -c\
262 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
263 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
264 -o $(obj)\
265 $(abspath $(source))
266 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
267 endef
268 endif # !KBUILD_USE_KOBJCACHE
271 ## Compile Objective-C++ source.
272 # @param $(target) Normalized main target name.
273 # @param $(source) Source filename (relative).
274 # @param $(obj) Object file name. This shall be (re)created by the compilation.
275 # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
276 # @param $(flags) Flags.
277 # @param $(defs) Definitions. No -D or something.
278 # @param $(incs) Includes. No -I or something.
279 # @param $(dirdep) Directory creation dependency.
280 # @param $(deps) Other dependencies.
281 # @param $(outbase) Output basename (full). Use this for list files and such.
282 # @param $(objsuff) Object suffix.
283 TOOL_GCC42MACHO_COMPILE_OBJCXX_DEPEND =
284 TOOL_GCC42MACHO_COMPILE_OBJCXX_DEPORD =
285 ifdef KBUILD_USE_KOBJCACHE
286 TOOL_GCC42MACHO_COMPILE_OBJCXX_USES_KOBJCACHE = 1
287 TOOL_GCC42MACHO_COMPILE_OBJCXX_OUTPUT = $(outbase).mii
288 define TOOL_GCC42MACHO_COMPILE_OBJCXX_CMDS
289 $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
290 --kObjCache-cpp $(outbase).mii\
291 $(TOOL_GCC42MACHO_OBJCXX) -E -o -\
292 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
293 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
294 $(abspath $(source))\
295 --kObjCache-cc $(obj)\
296 $(TOOL_GCC42MACHO_OBJCXX) -c\
297 $(flags) -fpreprocessed -x objective-c++\
298 -o $(obj)\
300 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
301 endef
302 else # !KBUILD_USE_KOBJCACHE
303 TOOL_GCC42MACHO_COMPILE_OBJCXX_OUTPUT =
304 define TOOL_GCC42MACHO_COMPILE_OBJCXX_CMDS
305 $(QUIET)$(TOOL_GCC42MACHO_OBJCXX) -c\
306 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
307 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
308 -o $(obj)\
309 $(abspath $(source))
310 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
311 endef
312 endif # !KBUILD_USE_KOBJCACHE
315 ## Compile Assembly source.
316 # @param $(target) Normalized main target name.
317 # @param $(source) Source filename (relative).
318 # @param $(obj) Object file name. This shall be (re)created by the compilation.
319 # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
320 # @param $(flags) Flags.
321 # @param $(defs) Definitions. No -D or something.
322 # @param $(incs) Includes. No -I or something.
323 # @param $(dirdep) Directory creation dependency.
324 # @param $(deps) Other dependencies.
325 # @param $(outbase) Output basename (full). Use this for list files and such.
326 # @param $(objsuff) Object suffix.
328 TOOL_GCC42MACHO_COMPILE_AS_OUTPUT =
329 TOOL_GCC42MACHO_COMPILE_AS_DEPEND =
330 TOOL_GCC42MACHO_COMPILE_AS_DEPORD =
331 define TOOL_GCC42MACHO_COMPILE_AS_CMDS
332 $(QUIET)$(TOOL_GCC42MACHO_AS) -c\
333 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
334 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
335 -o $(obj)\
336 $(abspath $(source))
337 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
338 endef
341 ## Link library
342 # @param $(target) Normalized main target name.
343 # @param $(out) Library name.
344 # @param $(objs) Object files to put in the library.
345 # @param $(flags) Flags.
346 # @param $(dirdep) Directory creation dependency.
347 # @param $(deps) Other dependencies.
348 # @param $(othersrc) Unhandled sources.
349 # @param $(outbase) Output basename (full). Use this for list files and such.
350 TOOL_GCC42MACHO_LINK_LIBRARY_OUTPUT =
351 TOOL_GCC42MACHO_LINK_LIBRARY_DEPEND = $(othersrc)
352 TOOL_GCC42MACHO_LINK_LIBRARY_DEPORD =
353 define TOOL_GCC42MACHO_LINK_LIBRARY_CMDS
354 $(if $(strip $(objs)),$(call xargs,$(QUIET)$(TOOL_GCC42MACHO_AR) $(flags) $(out),$(objs)))
355 $(foreach lib,$(othersrc)\
356 ,$(NL)$(TAB)$(call MSG_AR_MERGE,$(target),$(out),$(lib)) \
357 $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))ar.tmp.dir/* \
358 $(NL)$(TAB)$(QUIET)$(MKDIR) -p $(dir $(outbase))/ar.tmp.dir/ \
359 $(NL)$(TAB)$(QUIET)(cd $(dir $(outbase))ar.tmp.dir/ \
360 && $(TOOL_GCC42MACHO_AR) -x $(abspath $(lib)) \
361 && $(RM_EXT) -f ./__.SYMDEF* \
362 && $(TOOL_GCC42MACHO_AR) $(flags) $(out) *) \
363 $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))/ar.tmp.dir/* \
364 $(NL)$(TAB)$(QUIET)$(RMDIR) $(dir $(outbase))ar.tmp.dir/)
365 endef
368 ## Link program
369 # @param $(target) Normalized main target name.
370 # @param $(out) Program name.
371 # @param $(objs) Object files to link together.
372 # @param $(libs) Libraries to search.
373 # @param $(libpath) Library search paths.
374 # @param $(flags) Flags.
375 # @param $(dirdep) Directory creation dependency.
376 # @param $(deps) Other dependencies.
377 # @param $(othersrc) Unhandled sources.
378 # @param $(custom_pre) Custom step invoked before linking.
379 # @param $(custom_post) Custom step invoked after linking.
380 # @param $(outbase) Output basename (full). Use this for list files and such.
381 TOOL_GCC42MACHO_LINK_PROGRAM_OUTPUT = $(outbase).rsp
382 TOOL_GCC42MACHO_LINK_PROGRAM_OUTPUT_DEBUG = $(call TOOL_GCC42MACHO_DEBUG_BUNDLE_FN,$(out))
383 TOOL_GCC42MACHO_LINK_PROGRAM_DEBUG_INSTALL_FN = $(TOOL_GCC42MACHO_DEBUG_INSTALL_FN)
384 TOOL_GCC42MACHO_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
385 TOOL_GCC42MACHO_LINK_PROGRAM_DEPORD =
386 define TOOL_GCC42MACHO_LINK_PROGRAM_CMDS
387 $(QUIET)$(APPEND) -n $(outbase).rsp $(objs)
388 $(QUIET)$(TOOL_GCC42MACHO_LD) $(flags) -o $(out)\
389 -filelist $(outbase).rsp\
390 $(foreach p,$(libpath), -L$(p))\
391 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
392 ifeq ($(ld_debug),split)
393 $(QUIET)$(TOOL_GCC42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
394 $(QUIET)$(TOOL_GCC42MACHO_STRIP_PROGRAM) $(out)
395 endif
396 endef
400 ## Link DLL
401 # @param $(target) Normalized main target name.
402 # @param $(out) Program name.
403 # @param $(objs) Object files to link together.
404 # @param $(libs) Libraries to search.
405 # @param $(libpath) Library search paths.
406 # @param $(flags) Flags.
407 # @param $(dirdep) Directory creation dependency.
408 # @param $(deps) Other dependencies.
409 # @param $(othersrc) Unhandled sources.
410 # @param $(custom_pre) Custom step invoked before linking.
411 # @param $(custom_post) Custom step invoked after linking.
412 # @param $(outbase) Output basename (full). Use this for list files and such.
413 TOOL_GCC42MACHO_LINK_DLL_OUTPUT = $(outbase).rsp
414 TOOL_GCC42MACHO_LINK_DLL_OUTPUT_DEBUG = $(call TOOL_GCC42MACHO_DEBUG_BUNDLE_FN,$(out))
415 TOOL_GCC42MACHO_LINK_DLL_DEBUG_INSTALL_FN = $(TOOL_GCC42MACHO_DEBUG_INSTALL_FN)
416 TOOL_GCC42MACHO_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
417 TOOL_GCC42MACHO_LINK_DLL_DEPORD =
418 define TOOL_GCC42MACHO_LINK_DLL_CMDS
419 $(QUIET)$(APPEND) -n $(outbase).rsp $(objs)
420 $(QUIET)$(TOOL_GCC42MACHO_LD) $(TOOL_GCC42MACHO_LDFLAGS.dll) $(flags) -o $(out)\
421 $(call TOOL_GCC42MACHO_LD_SONAME,$(target),$(out))\
422 -filelist $(outbase).rsp\
423 $(foreach p,$(libpath), -L$(p))\
424 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
425 ifeq ($(ld_debug),split)
426 $(QUIET)$(TOOL_GCC42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
427 $(QUIET)$(TOOL_GCC42MACHO_STRIP_DLL) $(out)
428 endif
429 endef
432 ## Link system module (windows aka driver, linux aka kernel module)
433 # @param $(target) Normalized main target name.
434 # @param $(out) System module name.
435 # @param $(objs) Object files to link together.
436 # @param $(libs) Libraries to search.
437 # @param $(libpath) Library search paths.
438 # @param $(flags) Flags.
439 # @param $(dirdep) Directory creation dependency.
440 # @param $(deps) Other dependencies.
441 # @param $(othersrc) Unhandled sources.
442 # @param $(custom_pre) Custom step invoked before linking.
443 # @param $(custom_post) Custom step invoked after linking.
444 # @param $(outbase) Output basename (full). Use this for list files and such.
445 TOOL_GCC42MACHO_LINK_SYSMOD_OUTPUT = $(outbase).rsp
446 TOOL_GCC42MACHO_LINK_SYSMOD_OUTPUT_DEBUG = $(call TOOL_GCC42MACHO_DEBUG_BUNDLE_FN,$(out))
447 TOOL_GCC42MACHO_LINK_SYSMOD_DEBUG_INSTALL_FN = $(TOOL_GCC42MACHO_DEBUG_INSTALL_FN)
448 TOOL_GCC42MACHO_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
449 TOOL_GCC42MACHO_LINK_SYSMOD_DEPORD =
450 define TOOL_GCC42MACHO_LINK_SYSMOD_CMDS
451 $(QUIET)$(APPEND) -n $(outbase).rsp $(objs)
452 $(QUIET)$(TOOL_GCC42MACHO_LD_SYSMOD) $(TOOL_GCC42MACHO_LDFLAGS.sysmod) $(flags) -o $(out)\
453 -filelist $(outbase).rsp\
454 $(foreach p,$(libpath), -L$(p))\
455 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
456 ifeq ($(ld_debug),split)
457 $(QUIET)$(TOOL_GCC42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
458 $(QUIET)$(TOOL_GCC42MACHO_STRIP_SYSMOD) $(out)
459 endif
460 endef