source: trunk/kBuild/tools/GXX42MACHO.kmk@ 3258

Last change on this file since 3258 was 3258, checked in by bird, 7 years ago

tools/*GXX*: Precompiled header and some kObjCache updates.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 20.9 KB
Line 
1# $Id: GXX42MACHO.kmk 3258 2019-01-03 05:34:09Z bird $
2## @file
3# kBuild Tool Config - GCC v4.2.x targeting Darwin (Mac OS X) Mach-O, for building C++ code.
4#
5
6#
7# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
8#
9# This file is part of kBuild.
10#
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.
15#
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.
20#
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
24#
25#
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.
31#
32#
33
34TOOL_GXX42MACHO := GCC v4.2.x targeting Darwin (Mac OS X) Mach-O, for building C++ code.
35
36# Tool Specific Properties
37TOOL_GXX42MACHO_PREFIX ?=
38TOOL_GXX42MACHO_SUFFIX ?= -4.2$(HOSTSUFF_EXE)
39TOOL_GXX42MACHO_CC ?= $(TOOL_GXX42MACHO_PREFIX)gcc$(TOOL_GXX42MACHO_SUFFIX)
40TOOL_GXX42MACHO_CXX ?= $(TOOL_GXX42MACHO_PREFIX)g++$(TOOL_GXX42MACHO_SUFFIX)
41TOOL_GXX42MACHO_PCH ?= $(TOOL_GXX42MACHO_CXX)
42TOOL_GXX42MACHO_OBJC ?= $(TOOL_GXX42MACHO_PREFIX)gcc$(TOOL_GXX42MACHO_SUFFIX)
43TOOL_GXX42MACHO_OBJCXX ?= $(TOOL_GXX42MACHO_PREFIX)gcc$(TOOL_GXX42MACHO_SUFFIX)
44TOOL_GXX42MACHO_AS ?= $(TOOL_GXX42MACHO_PREFIX)gcc$(TOOL_GXX42MACHO_SUFFIX)
45TOOL_GXX42MACHO_LD ?= $(TOOL_GXX42MACHO_PREFIX)g++$(TOOL_GXX42MACHO_SUFFIX)
46TOOL_GXX42MACHO_LD_SYSMOD ?= $(TOOL_GXX42MACHO_PREFIX)g++$(TOOL_GXX42MACHO_SUFFIX)
47ifndef TOOL_GXX42MACHO_LDFLAGS.$(KBUILD_TARGET)
48TOOL_GXX42MACHO_LDFLAGS.dll ?= -dynamiclib
49else
50TOOL_GXX42MACHO_LDFLAGS.dll ?= $(TOOL_GXX42MACHO_LDFLAGS.$(KBUILD_TARGET))
51endif
52TOOL_GXX42MACHO_LDFLAGS.sysmod ?= -r
53#TOOL_GXX42MACHO_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)))
54TOOL_GXX42MACHO_DSYMUTIL ?= dsymutil
55
56ifdef SLKRUNS
57TOOL_GXX42MACHO_CC += -fmessage-length=0
58TOOL_GXX42MACHO_CXX += -fmessage-length=0
59TOOL_GXX42MACHO_OBJC += -fmessage-length=0
60TOOL_GXX42MACHO_OBJCXX += -fmessage-length=0
61endif
62
63# General Properties used by kBuild
64TOOL_GXX42MACHO_COBJSUFF ?= .o
65TOOL_GXX42MACHO_CFLAGS ?=
66TOOL_GXX42MACHO_CFLAGS.debug ?= -g
67TOOL_GXX42MACHO_CFLAGS.profile ?= -O2 #-g -pg
68TOOL_GXX42MACHO_CFLAGS.release ?= -O2
69TOOL_GXX42MACHO_CINCS ?=
70TOOL_GXX42MACHO_CDEFS ?=
71
72TOOL_GXX42MACHO_CXXOBJSUFF ?= .o
73TOOL_GXX42MACHO_CXXFLAGS ?=
74TOOL_GXX42MACHO_CXXFLAGS.debug ?= -g
75TOOL_GXX42MACHO_CXXFLAGS.profile ?= -O2 #-g -pg
76TOOL_GXX42MACHO_CXXFLAGS.release ?= -O2
77TOOL_GXX42MACHO_CXXINCS ?=
78TOOL_GXX42MACHO_CXXDEFS ?=
79
80TOOL_GXX42MACHO_PCHOBJSUFF ?= .h.gch
81TOOL_GXX42MACHO_PCHFLAGS ?= $(TOOL_GXX42MACHO_CXXFLAGS)
82TOOL_GXX42MACHO_PCHFLAGS.debug ?= $(TOOL_GXX42MACHO_CXXFLAGS.debug)
83TOOL_GXX42MACHO_PCHFLAGS.profile ?= $(TOOL_GXX42MACHO_CXXFLAGS.profile)
84TOOL_GXX42MACHO_PCHFLAGS.release ?= $(TOOL_GXX42MACHO_CXXFLAGS.release)
85TOOL_GXX42MACHO_PCHINCS ?= $(TOOL_GXX42MACHO_CXXINCS)
86TOOL_GXX42MACHO_PCHDEFS ?= $(TOOL_GXX42MACHO_CXXDEFS)
87
88TOOL_GXX42MACHO_OBJCOBJSUFF ?= .o
89TOOL_GXX42MACHO_OBJCFLAGS ?=
90TOOL_GXX42MACHO_OBJCFLAGS.debug ?= -g
91TOOL_GXX42MACHO_OBJCFLAGS.profile?= -O2 #-g -pg
92TOOL_GXX42MACHO_OBJCFLAGS.release?= -O2
93TOOL_GXX42MACHO_OBJCINCS ?=
94TOOL_GXX42MACHO_OBJCDEFS ?=
95
96TOOL_GXX42MACHO_OBJCXXOBJSUFF ?= .o
97TOOL_GXX42MACHO_OBJCXXFLAGS ?=
98TOOL_GXX42MACHO_OBJCXXFLAGS.debug ?= -g
99TOOL_GXX42MACHO_OBJCXXFLAGS.profile ?= -O2 #-g -pg
100TOOL_GXX42MACHO_OBJCXXFLAGS.release ?= -O2
101TOOL_GXX42MACHO_OBJCXXINCS ?=
102TOOL_GXX42MACHO_OBJCXXDEFS ?=
103
104TOOL_GXX42MACHO_ASFLAGS ?= -x assembler-with-cpp
105TOOL_GXX42MACHO_ASFLAGS.debug ?= -g
106TOOL_GXX42MACHO_ASFLAGS.profile ?= -g
107TOOL_GXX42MACHO_ASOBJSUFF ?= .o
108
109TOOL_GXX42MACHO_AR ?= ar$(HOSTSUFF_EXE)
110TOOL_GXX42MACHO_ARFLAGS ?= -c -rs
111TOOL_GXX42MACHO_ARLIBSUFF ?= .a
112
113TOOL_GXX42MACHO_LDFLAGS ?=
114TOOL_GXX42MACHO_LDFLAGS.debug ?= -g
115TOOL_GXX42MACHO_LDFLAGS.profile ?= -g
116
117TOOL_GXX42MACHO_STRIP_PROGRAM ?= strip -SXxru
118TOOL_GXX42MACHO_STRIP_DLL ?= strip -Sxru
119TOOL_GXX42MACHO_STRIP_SYSMOD ?= strip -Sru
120
121
122##
123# Calculate the files in the debug bundle.
124# @param 1 The whole output filename.
125# @param 2 The output filename sans suffix.
126TOOL_GXX42MACHO_DEBUG_BUNDLE_FN = \
127 $(1).dSYM/ \
128 $(1).dSYM/Contents/ \
129 $(1).dSYM/Contents/Resources/ \
130 $(1).dSYM/Contents/Resources/DWARF/ \
131 $(1).dSYM/Contents/Info.plist \
132 $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1))
133
134##
135# Calculate the files in the debug bundle.
136# @param 1 The whole linker output filename.
137# @param 2 The linker output filename sans suffix.
138# @param 3 The desired install name (no dir slash).
139# @remarks The Info.plist has some reference to the original name, but gdb
140# does not care and only check for a symbol file in the DWARF
141# directory with the same name as the debugged module.
142TOOL_GXX42MACHO_DEBUG_INSTALL_FN= \
143 $(3).dSYM/ \
144 $(3).dSYM/Contents/ \
145 $(3).dSYM/Contents/Resources/ \
146 $(3).dSYM/Contents/Resources/DWARF/ \
147 $(1).dSYM/Contents/Info.plist=>$(3).dSYM/Contents/Info.plist \
148 $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1))=>$(3).dSYM/Contents/Resources/DWARF/$(notdir $(3))
149
150
151## Compile C source.
152# @param $(target) Normalized main target name.
153# @param $(source) Source filename (relative).
154# @param $(obj) Object file name. This shall be (re)created by the compilation.
155# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
156# @param $(flags) Flags.
157# @param $(defs) Definitions. No -D or something.
158# @param $(incs) Includes. No -I or something.
159# @param $(dirdep) Directory creation dependency.
160# @param $(deps) Other dependencies.
161#
162# @param $(outbase) Output basename (full). Use this for list files and such.
163# @param $(objsuff) Object suffix.
164TOOL_GXX42MACHO_COMPILE_C_DEPEND =
165TOOL_GXX42MACHO_COMPILE_C_DEPORD =
166TOOL_GXX42MACHO_COMPILE_C_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).i,)
167TOOL_GXX42MACHO_COMPILE_C_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
168define TOOL_GXX42MACHO_COMPILE_C_CMDS
169if "$(use_objcache)" != ""
170 $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
171 --kObjCache-cpp $(outbase).i\
172 $(TOOL_GXX42MACHO_CC) -E -o -\
173 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
174 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
175 $(abspath $(source))\
176 --kObjCache-cc $(obj)\
177 $(TOOL_GXX42MACHO_CC) -c\
178 $(flags) -fpreprocessed -x c\
179 -o $(obj)\
180 -
181else
182 $(QUIET)$(TOOL_GXX42MACHO_CC) -c\
183 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
184 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
185 -o $(obj)\
186 $(abspath $(source))
187endif
188 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
189endef
190
191
192## Compile C++ source.
193# @param $(target) Normalized main target name.
194# @param $(source) Source filename (relative).
195# @param $(obj) Object file name. This shall be (re)created by the compilation.
196# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
197# @param $(flags) Flags.
198# @param $(defs) Definitions. No -D or something.
199# @param $(incs) Includes. No -I or something.
200# @param $(dirdep) Directory creation dependency.
201# @param $(deps) Other dependencies.
202# @param $(outbase) Output basename (full). Use this for list files and such.
203# @param $(objsuff) Object suffix.
204TOOL_GXX42MACHO_COMPILE_CXX_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).ii,)
205TOOL_GXX42MACHO_COMPILE_CXX_DEPEND = $($(target)_1_GCC_PCH_FILE)
206TOOL_GXX42MACHO_COMPILE_CXX_DEPORD =
207TOOL_GXX42MACHO_COMPILE_CXX_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
208define TOOL_GXX42MACHO_COMPILE_CXX_CMDS
209if "$(use_objcache)" != ""
210 $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
211 --kObjCache-cpp $(outbase).ii\
212 $(TOOL_GXX42MACHO_CXX) -E -o - $(if-expr defined($(target)_PCH_HDR)\
213 ,-fpch-preprocess -Winvalid-pch -I$($(target)_1_GCC_PCH_DIR) -include $(basename $($(target)_1_GCC_PCH_FILE)),)\
214 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
215 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
216 $(abspath $(source))\
217 --kObjCache-cc $(obj)\
218 $(TOOL_GXX42MACHO_CXX) -c\
219 $(flags) -fpreprocessed $(if-expr defined($(target)_PCH_HDR),-fpch-preprocess,) -x c++\
220 -o $(obj)\
221 -
222else
223 $(QUIET)$(TOOL_GXX42MACHO_CXX) -c\
224 $(flags) $(addprefix -I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(addprefix -D, $(defs))\
225 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
226 -o $(obj) $(if-expr defined($(target)_PCH_HDR) \
227 ,-Winvalid-pch -include $(basename $($(target)_1_GCC_PCH_FILE)),) \
228 $(abspath $(source))
229endif
230 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
231endef
232
233
234## Precompile C++ header.
235# @param $(target) Normalized main target name.
236# @param $(source) Source filename (relative).
237# @param $(obj) Object file name. This shall be (re)created by the compilation.
238# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
239# @param $(flags) Flags.
240# @param $(defs) Definitions. No -D or something.
241# @param $(incs) Includes. No -I or something.
242# @param $(dirdep) Directory creation dependency.
243# @param $(deps) Other dependencies.
244# @param $(outbase) Output basename (full). Use this for list files and such.
245# @param $(objsuff) Object suffix.
246TOOL_GXX42MACHO_COMPILE_PCH_OUTPUT = $($(target)_1_GCC_PCH_FILE)
247TOOL_GXX42MACHO_COMPILE_PCH_DEPEND =
248TOOL_GXX42MACHO_COMPILE_PCH_DEPORD = $($(target)_1_GCC_PCH_DIR)
249define TOOL_GXX42MACHO_COMPILE_PCH_CMDS
250 $(QUIET)$(TOOL_GXX42MACHO_PCH) -c\
251 $(flags) $(addprefix -I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(addprefix -D, $(defs))\
252 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
253 -o $(obj)\
254 $(abspath $(source))
255 $(INSTALL) --hard-link-files-when-possible -m 0644 -- "$(obj)" "$($(target)_1_GCC_PCH_FILE)"
256 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
257endef
258
259
260## Compile Objective-C source.
261# @param $(target) Normalized main target name.
262# @param $(source) Source filename (relative).
263# @param $(obj) Object file name. This shall be (re)created by the compilation.
264# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
265# @param $(flags) Flags.
266# @param $(defs) Definitions. No -D or something.
267# @param $(incs) Includes. No -I or something.
268# @param $(dirdep) Directory creation dependency.
269# @param $(deps) Other dependencies.
270# @param $(outbase) Output basename (full). Use this for list files and such.
271# @param $(objsuff) Object suffix.
272TOOL_GXX42MACHO_COMPILE_OBJC_DEPEND =
273TOOL_GXX42MACHO_COMPILE_OBJC_DEPORD =
274ifdef KBUILD_USE_KOBJCACHE
275TOOL_GXX42MACHO_COMPILE_OBJC_USES_KOBJCACHE = 1
276TOOL_GXX42MACHO_COMPILE_OBJC_OUTPUT = $(outbase).mi
277define TOOL_GXX42MACHO_COMPILE_OBJC_CMDS
278 $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
279 --kObjCache-cpp $(outbase).ii\
280 $(TOOL_GXX42MACHO_OBJC) -E -o -\
281 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
282 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
283 $(abspath $(source))\
284 --kObjCache-cc $(obj)\
285 $(TOOL_GXX42MACHO_OBJC) -c\
286 $(flags) -fpreprocessed -x objective-c \
287 -o $(obj)\
288 -
289 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
290endef
291else # !KBUILD_USE_KOBJCACHE
292TOOL_GXX42MACHO_COMPILE_OBJC_OUTPUT =
293define TOOL_GXX42MACHO_COMPILE_OBJC_CMDS
294 $(QUIET)$(TOOL_GXX42MACHO_OBJC) -c\
295 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
296 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
297 -o $(obj)\
298 $(abspath $(source))
299 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
300endef
301endif # !KBUILD_USE_KOBJCACHE
302
303
304## Compile Objective-C++ source.
305# @param $(target) Normalized main target name.
306# @param $(source) Source filename (relative).
307# @param $(obj) Object file name. This shall be (re)created by the compilation.
308# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
309# @param $(flags) Flags.
310# @param $(defs) Definitions. No -D or something.
311# @param $(incs) Includes. No -I or something.
312# @param $(dirdep) Directory creation dependency.
313# @param $(deps) Other dependencies.
314# @param $(outbase) Output basename (full). Use this for list files and such.
315# @param $(objsuff) Object suffix.
316TOOL_GXX42MACHO_COMPILE_OBJCXX_DEPEND =
317TOOL_GXX42MACHO_COMPILE_OBJCXX_DEPORD =
318ifdef KBUILD_USE_KOBJCACHE
319TOOL_GXX42MACHO_COMPILE_OBJCXX_USES_KOBJCACHE = 1
320TOOL_GXX42MACHO_COMPILE_OBJCXX_OUTPUT = $(outbase).mii
321define TOOL_GXX42MACHO_COMPILE_OBJCXX_CMDS
322 $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
323 --kObjCache-cpp $(outbase).mii\
324 $(TOOL_GXX42MACHO_OBJCXX) -E -o -\
325 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
326 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
327 $(abspath $(source))\
328 --kObjCache-cc $(obj)\
329 $(TOOL_GXX42MACHO_OBJCXX) -c\
330 $(flags) -fpreprocessed -x objective-c++ \
331 -o $(obj)\
332 -
333 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
334endef
335else # !KBUILD_USE_KOBJCACHE
336TOOL_GXX42MACHO_COMPILE_OBJCXX_OUTPUT =
337define TOOL_GXX42MACHO_COMPILE_OBJCXX_CMDS
338 $(QUIET)$(TOOL_GXX42MACHO_OBJCXX) -c\
339 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
340 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
341 -o $(obj)\
342 $(abspath $(source))
343 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
344endef
345endif # !KBUILD_USE_KOBJCACHE
346
347
348## Compile Assembly source.
349# @param $(target) Normalized main target name.
350# @param $(source) Source filename (relative).
351# @param $(obj) Object file name. This shall be (re)created by the compilation.
352# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
353# @param $(flags) Flags.
354# @param $(defs) Definitions. No -D or something.
355# @param $(incs) Includes. No -I or something.
356# @param $(dirdep) Directory creation dependency.
357# @param $(deps) Other dependencies.
358# @param $(outbase) Output basename (full). Use this for list files and such.
359# @param $(objsuff) Object suffix.
360#
361TOOL_GXX42MACHO_COMPILE_AS_OUTPUT =
362TOOL_GXX42MACHO_COMPILE_AS_DEPEND =
363TOOL_GXX42MACHO_COMPILE_AS_DEPORD =
364define TOOL_GXX42MACHO_COMPILE_AS_CMDS
365 $(QUIET)$(TOOL_GXX42MACHO_AS) -c\
366 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
367 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
368 -o $(obj)\
369 $(abspath $(source))
370 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
371endef
372
373
374## Link library
375# @param $(target) Normalized main target name.
376# @param $(out) Library name.
377# @param $(objs) Object files to put in the library.
378# @param $(flags) Flags.
379# @param $(dirdep) Directory creation dependency.
380# @param $(deps) Other dependencies.
381# @param $(othersrc) Unhandled sources.
382# @param $(outbase) Output basename (full). Use this for list files and such.
383TOOL_GXX42MACHO_LINK_LIBRARY_OUTPUT =
384TOOL_GXX42MACHO_LINK_LIBRARY_DEPEND = $(othersrc)
385TOOL_GXX42MACHO_LINK_LIBRARY_DEPORD =
386define TOOL_GXX42MACHO_LINK_LIBRARY_CMDS
387 $(if $(strip $(filter-out %.h.gch,$(objs))),$(call xargs,$(QUIET)$(TOOL_GXX42MACHO_AR) $(flags) $(out),$(filter-out %.h.gch,$(objs))))
388 $(foreach lib,$(othersrc)\
389 ,$(NL)$(TAB)$(call MSG_AR_MERGE,$(target),$(out),$(lib)) \
390 $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))ar.tmp.dir/* \
391 $(NL)$(TAB)$(QUIET)$(MKDIR) -p $(dir $(outbase))/ar.tmp.dir/ \
392 $(NL)$(TAB)$(QUIET)(cd $(dir $(outbase))ar.tmp.dir/ \
393 && $(TOOL_GXX42MACHO_AR) -x $(abspath $(lib)) \
394 && $(RM_EXT) -f ./__.SYMDEF* \
395 && $(TOOL_GXX42MACHO_AR) $(flags) $(out) *) \
396 $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))/ar.tmp.dir/* \
397 $(NL)$(TAB)$(QUIET)$(RMDIR) $(dir $(outbase))ar.tmp.dir/)
398endef
399
400
401## Link program
402# @param $(target) Normalized main target name.
403# @param $(out) Program name.
404# @param $(objs) Object files to link together.
405# @param $(libs) Libraries to search.
406# @param $(libpath) Library search paths.
407# @param $(flags) Flags.
408# @param $(dirdep) Directory creation dependency.
409# @param $(deps) Other dependencies.
410# @param $(othersrc) Unhandled sources.
411# @param $(custom_pre) Custom step invoked before linking.
412# @param $(custom_post) Custom step invoked after linking.
413# @param $(outbase) Output basename (full). Use this for list files and such.
414TOOL_GXX42MACHO_LINK_PROGRAM_OUTPUT = $(outbase).rsp
415TOOL_GXX42MACHO_LINK_PROGRAM_OUTPUT_DEBUG = $(call TOOL_GXX42MACHO_DEBUG_BUNDLE_FN,$(out))
416TOOL_GXX42MACHO_LINK_PROGRAM_DEBUG_INSTALL_FN = $(TOOL_GXX42MACHO_DEBUG_INSTALL_FN)
417TOOL_GXX42MACHO_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
418TOOL_GXX42MACHO_LINK_PROGRAM_DEPORD =
419define TOOL_GXX42MACHO_LINK_PROGRAM_CMDS
420 $(QUIET)$(APPEND) -n $(outbase).rsp $(filter-out %.h.gch,$(objs))
421 $(QUIET)$(TOOL_GXX42MACHO_LD) $(flags) -o $(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_GXX42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
427 $(QUIET)$(TOOL_GXX42MACHO_STRIP_PROGRAM) $(out)
428 endif
429endef
430
431
432## Link DLL
433# @param $(target) Normalized main target name.
434# @param $(out) Program 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.
445TOOL_GXX42MACHO_LINK_DLL_OUTPUT = $(outbase).rsp
446TOOL_GXX42MACHO_LINK_DLL_OUTPUT_DEBUG = $(call TOOL_GXX42MACHO_DEBUG_BUNDLE_FN,$(out))
447TOOL_GXX42MACHO_LINK_DLL_DEBUG_INSTALL_FN = $(TOOL_GXX42MACHO_DEBUG_INSTALL_FN)
448TOOL_GXX42MACHO_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
449TOOL_GXX42MACHO_LINK_DLL_DEPORD =
450define TOOL_GXX42MACHO_LINK_DLL_CMDS
451 $(QUIET)$(APPEND) -n $(outbase).rsp $(filter-out %.h.gch,$(objs))
452 $(QUIET)$(TOOL_GXX42MACHO_LD) $(TOOL_GXX42MACHO_LDFLAGS.dll) $(flags) -o $(out)\
453 $(call TOOL_GXX42MACHO_LD_SONAME,$(target),$(out))\
454 -filelist $(outbase).rsp\
455 $(foreach p,$(libpath), -L$(p))\
456 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
457 ifeq ($(ld_debug),split)
458 $(QUIET)$(TOOL_GXX42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
459 $(QUIET)$(TOOL_GXX42MACHO_STRIP_DLL) $(out)
460 endif
461endef
462
463
464## Link system module (windows aka driver, linux aka kernel module)
465# @param $(target) Normalized main target name.
466# @param $(out) System module name.
467# @param $(objs) Object files to link together.
468# @param $(libs) Libraries to search.
469# @param $(libpath) Library search paths.
470# @param $(flags) Flags.
471# @param $(dirdep) Directory creation dependency.
472# @param $(deps) Other dependencies.
473# @param $(othersrc) Unhandled sources.
474# @param $(custom_pre) Custom step invoked before linking.
475# @param $(custom_post) Custom step invoked after linking.
476# @param $(outbase) Output basename (full). Use this for list files and such.
477TOOL_GXX42MACHO_LINK_SYSMOD_OUTPUT = $(outbase).rsp
478TOOL_GXX42MACHO_LINK_SYSMOD_OUTPUT_DEBUG = $(call TOOL_GXX42MACHO_DEBUG_BUNDLE_FN,$(out))
479TOOL_GXX42MACHO_LINK_SYSMOD_DEBUG_INSTALL_FN = $(TOOL_GXX42MACHO_DEBUG_INSTALL_FN)
480TOOL_GXX42MACHO_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
481TOOL_GXX42MACHO_LINK_SYSMOD_DEPORD =
482define TOOL_GXX42MACHO_LINK_SYSMOD_CMDS
483 $(QUIET)$(APPEND) -n $(outbase).rsp $(filter-out %.h.gch,$(objs))
484 $(QUIET)$(TOOL_GXX42MACHO_LD_SYSMOD) $(TOOL_GXX42MACHO_LDFLAGS.sysmod) $(flags) -o $(out)\
485 -filelist $(outbase).rsp\
486 $(foreach p,$(libpath), -L$(p))\
487 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
488 ifeq ($(ld_debug),split)
489 $(QUIET)$(TOOL_GXX42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
490 $(QUIET)$(TOOL_GXX42MACHO_STRIP_SYSMOD) $(out)
491 endif
492endef
493
Note: See TracBrowser for help on using the repository browser.