source: trunk/kBuild/tools/LLVMGXX42MACHO.kmk@ 3392

Last change on this file since 3392 was 3392, checked in by bird, 5 years ago

LLVM*: Cleanups.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 21.7 KB
Line 
1# $Id: LLVMGXX42MACHO.kmk 3392 2020-06-30 11:32:54Z bird $
2## @file
3# kBuild Tool Config - LLVM 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_LLVMGXX42MACHO := LLVM GCC v4.2.x targeting Darwin (Mac OS X) Mach-O, for building C++ code.
35
36# Tool Specific Properties
37ifndef TOOL_LLVMGXX42MACHO_PREFIX
38 TOOL_LLVMGXX42MACHO_PREFIX := llvm-
39endif
40ifndef TOOL_LLVMGXX42MACHO_SUFFIX
41 TOOL_LLVMGXX42MACHO_SUFFIX := -4.2$(HOSTSUFF_EXE)
42endif
43TOOL_LLVMGXX42MACHO_CC ?= $(TOOL_LLVMGXX42MACHO_PREFIX)gcc$(TOOL_LLVMGXX42MACHO_SUFFIX)
44TOOL_LLVMGXX42MACHO_CXX ?= $(TOOL_LLVMGXX42MACHO_PREFIX)g++$(TOOL_LLVMGXX42MACHO_SUFFIX)
45TOOL_LLVMGXX42MACHO_PCH ?= $(TOOL_LLVMGXX42MACHO_CXX)
46TOOL_LLVMGXX42MACHO_OBJC ?= $(TOOL_LLVMGXX42MACHO_PREFIX)gcc$(TOOL_LLVMGXX42MACHO_SUFFIX)
47TOOL_LLVMGXX42MACHO_OBJCXX ?= $(TOOL_LLVMGXX42MACHO_PREFIX)gcc$(TOOL_LLVMGXX42MACHO_SUFFIX)
48TOOL_LLVMGXX42MACHO_AS ?= $(TOOL_LLVMGXX42MACHO_PREFIX)gcc$(TOOL_LLVMGXX42MACHO_SUFFIX)
49TOOL_LLVMGXX42MACHO_LD ?= $(TOOL_LLVMGXX42MACHO_PREFIX)g++$(TOOL_LLVMGXX42MACHO_SUFFIX)
50TOOL_LLVMGXX42MACHO_LD_SYSMOD ?= $(TOOL_LLVMGXX42MACHO_PREFIX)g++$(TOOL_LLVMGXX42MACHO_SUFFIX)
51TOOL_LLVMGXX42MACHO_LDFLAGS.dll ?= -dynamiclib
52TOOL_LLVMGXX42MACHO_LDFLAGS.sysmod ?= -r
53#TOOL_LLVMGXX42MACHO_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)))
54
55TOOL_LLVMGXX42MACHO_DSYMUTIL_PREFIX ?=
56TOOL_LLVMGXX42MACHO_DSYMUTIL_SUFFIX ?= $(HOSTSUFF_EXE)
57TOOL_LLVMGXX42MACHO_DSYMUTIL ?= $(TOOL_LLVMGXX42MACHO_DSYMUTIL_PREFIX)dsymutil$(TOOL_LLVMGXX42MACHO_DSYMUTIL_SUFFIX)
58
59ifdef SLKRUNS
60TOOL_LLVMGXX42MACHO_CC += -fmessage-length=0
61TOOL_LLVMGXX42MACHO_CXX += -fmessage-length=0
62TOOL_LLVMGXX42MACHO_OBJC += -fmessage-length=0
63TOOL_LLVMGXX42MACHO_OBJCXX += -fmessage-length=0
64endif
65
66# General Properties used by kBuild
67TOOL_LLVMGXX42MACHO_COBJSUFF ?= .o
68TOOL_LLVMGXX42MACHO_CFLAGS ?=
69TOOL_LLVMGXX42MACHO_CFLAGS.debug ?= -g
70TOOL_LLVMGXX42MACHO_CFLAGS.profile ?= -O2 #-g -pg
71TOOL_LLVMGXX42MACHO_CFLAGS.release ?= -O2
72TOOL_LLVMGXX42MACHO_CINCS ?=
73TOOL_LLVMGXX42MACHO_CDEFS ?=
74
75TOOL_LLVMGXX42MACHO_CXXOBJSUFF ?= .o
76TOOL_LLVMGXX42MACHO_CXXFLAGS ?=
77TOOL_LLVMGXX42MACHO_CXXFLAGS.debug ?= -g
78TOOL_LLVMGXX42MACHO_CXXFLAGS.profile ?= -O2 #-g -pg
79TOOL_LLVMGXX42MACHO_CXXFLAGS.release ?= -O2
80TOOL_LLVMGXX42MACHO_CXXINCS ?=
81TOOL_LLVMGXX42MACHO_CXXDEFS ?=
82
83TOOL_LLVMGXX42MACHO_PCHOBJSUFF ?= .h.gch
84TOOL_LLVMGXX42MACHO_PCHFLAGS ?= $(TOOL_LLVMGXX42MACHO_CXXFLAGS)
85TOOL_LLVMGXX42MACHO_PCHFLAGS.debug ?= $(TOOL_LLVMGXX42MACHO_CXXFLAGS.debug)
86TOOL_LLVMGXX42MACHO_PCHFLAGS.profile ?= $(TOOL_LLVMGXX42MACHO_CXXFLAGS.profile)
87TOOL_LLVMGXX42MACHO_PCHFLAGS.release ?= $(TOOL_LLVMGXX42MACHO_CXXFLAGS.release)
88TOOL_LLVMGXX42MACHO_PCHINCS ?= $(TOOL_LLVMGXX42MACHO_CXXINCS)
89TOOL_LLVMGXX42MACHO_PCHDEFS ?= $(TOOL_LLVMGXX42MACHO_CXXDEFS)
90
91TOOL_LLVMGXX42MACHO_OBJCOBJSUFF ?= .o
92TOOL_LLVMGXX42MACHO_OBJCFLAGS ?=
93TOOL_LLVMGXX42MACHO_OBJCFLAGS.debug ?= -g
94TOOL_LLVMGXX42MACHO_OBJCFLAGS.profile?= -O2 #-g -pg
95TOOL_LLVMGXX42MACHO_OBJCFLAGS.release?= -O2
96TOOL_LLVMGXX42MACHO_OBJCINCS ?=
97TOOL_LLVMGXX42MACHO_OBJCDEFS ?=
98
99TOOL_LLVMGXX42MACHO_OBJCXXOBJSUFF ?= .o
100TOOL_LLVMGXX42MACHO_OBJCXXFLAGS ?=
101TOOL_LLVMGXX42MACHO_OBJCXXFLAGS.debug ?= -g
102TOOL_LLVMGXX42MACHO_OBJCXXFLAGS.profile ?= -O2 #-g -pg
103TOOL_LLVMGXX42MACHO_OBJCXXFLAGS.release ?= -O2
104TOOL_LLVMGXX42MACHO_OBJCXXINCS ?=
105TOOL_LLVMGXX42MACHO_OBJCXXDEFS ?=
106
107TOOL_LLVMGXX42MACHO_ASFLAGS ?= -x assembler-with-cpp
108TOOL_LLVMGXX42MACHO_ASFLAGS.debug ?= -g
109TOOL_LLVMGXX42MACHO_ASFLAGS.profile ?= -g
110TOOL_LLVMGXX42MACHO_ASOBJSUFF ?= .o
111
112TOOL_LLVMGXX42MACHO_AR ?= ar$(HOSTSUFF_EXE)
113TOOL_LLVMGXX42MACHO_ARFLAGS ?= -c -rs
114TOOL_LLVMGXX42MACHO_ARLIBSUFF ?= .a
115
116TOOL_LLVMGXX42MACHO_LDFLAGS ?=
117TOOL_LLVMGXX42MACHO_LDFLAGS.debug ?= -g
118TOOL_LLVMGXX42MACHO_LDFLAGS.profile ?= -g
119
120TOOL_LLVMGXX42MACHO_STRIP_PROGRAM ?= strip -SXxru
121TOOL_LLVMGXX42MACHO_STRIP_DLL ?= strip -Sxru
122TOOL_LLVMGXX42MACHO_STRIP_SYSMOD ?= strip -Sru
123
124
125##
126# Calculate the files in the debug bundle.
127# @param 1 The whole output filename.
128# @param 2 The output filename sans suffix.
129TOOL_LLVMGXX42MACHO_DEBUG_BUNDLE_FN = \
130 $(1).dSYM/ \
131 $(1).dSYM/Contents/ \
132 $(1).dSYM/Contents/Resources/ \
133 $(1).dSYM/Contents/Resources/DWARF/ \
134 $(1).dSYM/Contents/Info.plist \
135 $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1))
136
137##
138# Calculate the files in the debug bundle.
139# @param 1 The whole linker output filename.
140# @param 2 The linker output filename sans suffix.
141# @param 3 The desired install name (no dir slash).
142# @remarks The Info.plist has some reference to the original name, but gdb
143# does not care and only check for a symbol file in the DWARF
144# directory with the same name as the debugged module.
145TOOL_LLVMGXX42MACHO_DEBUG_INSTALL_FN= \
146 $(3).dSYM/ \
147 $(3).dSYM/Contents/ \
148 $(3).dSYM/Contents/Resources/ \
149 $(3).dSYM/Contents/Resources/DWARF/ \
150 $(1).dSYM/Contents/Info.plist=>$(3).dSYM/Contents/Info.plist \
151 $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1))=>$(3).dSYM/Contents/Resources/DWARF/$(notdir $(3))
152
153
154## Compile C source.
155# @param $(target) Normalized main target name.
156# @param $(source) Source filename (relative).
157# @param $(obj) Object file name. This shall be (re)created by the compilation.
158# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
159# @param $(flags) Flags.
160# @param $(defs) Definitions. No -D or something.
161# @param $(incs) Includes. No -I or something.
162# @param $(dirdep) Directory creation dependency.
163# @param $(deps) Other dependencies.
164#
165# @param $(outbase) Output basename (full). Use this for list files and such.
166# @param $(objsuff) Object suffix.
167TOOL_LLVMGXX42MACHO_COMPILE_C_DEPEND =
168TOOL_LLVMGXX42MACHO_COMPILE_C_DEPORD =
169TOOL_LLVMGXX42MACHO_COMPILE_C_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).i,)
170TOOL_LLVMGXX42MACHO_COMPILE_C_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
171define TOOL_LLVMGXX42MACHO_COMPILE_C_CMDS
172if "$(use_objcache)" != ""
173 $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
174 --kObjCache-cpp $(outbase).i\
175 $(TOOL_LLVMGXX42MACHO_CC) -E -o -\
176 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
177 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
178 $(abspath $(source))\
179 --kObjCache-cc $(obj)\
180 $(TOOL_LLVMGXX42MACHO_CC) -c\
181 $(flags) -fpreprocessed -x c\
182 -o $(obj)\
183 -
184else
185 $(QUIET)$(TOOL_LLVMGXX42MACHO_CC) -c\
186 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
187 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
188 -o $(obj)\
189 $(abspath $(source))
190endif
191 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
192endef
193
194
195## Compile C++ source.
196# @param $(target) Normalized main target name.
197# @param $(source) Source filename (relative).
198# @param $(obj) Object file name. This shall be (re)created by the compilation.
199# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
200# @param $(flags) Flags.
201# @param $(defs) Definitions. No -D or something.
202# @param $(incs) Includes. No -I or something.
203# @param $(dirdep) Directory creation dependency.
204# @param $(deps) Other dependencies.
205# @param $(outbase) Output basename (full). Use this for list files and such.
206# @param $(objsuff) Object suffix.
207TOOL_LLVMGXX42MACHO_COMPILE_CXX_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).ii,)
208TOOL_LLVMGXX42MACHO_COMPILE_CXX_DEPEND = $($(target)_1_GCC_PCH_FILE)
209TOOL_LLVMGXX42MACHO_COMPILE_CXX_DEPORD =
210TOOL_LLVMGXX42MACHO_COMPILE_CXX_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
211define TOOL_LLVMGXX42MACHO_COMPILE_CXX_CMDS
212if "$(use_objcache)" != ""
213 $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
214 --kObjCache-cpp $(outbase).ii\
215 $(TOOL_LLVMGXX42MACHO_CXX) -E -o - $(if-expr defined($(target)_PCH_HDR)\
216 ,-fpch-preprocess -Winvalid-pch -I$($(target)_1_GCC_PCH_DIR) -include $(basename $($(target)_1_GCC_PCH_FILE)),)\
217 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
218 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
219 $(abspath $(source))\
220 --kObjCache-cc $(obj)\
221 $(TOOL_LLVMGXX42MACHO_CXX) -c\
222 $(flags) -fpreprocessed $(if-expr defined($(target)_PCH_HDR),-fpch-preprocess,) -x c++\
223 -o $(obj)\
224 -
225else
226 $(QUIET)$(TOOL_LLVMGXX42MACHO_CXX) -c\
227 $(flags) $(addprefix -I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(addprefix -D, $(defs))\
228 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
229 -o $(obj) $(if-expr defined($(target)_PCH_HDR) \
230 ,-Winvalid-pch -include $(basename $($(target)_1_GCC_PCH_FILE)),) \
231 $(abspath $(source))
232endif
233 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
234endef
235
236
237## Precompile C++ header.
238# @param $(target) Normalized main target name.
239# @param $(source) Source filename (relative).
240# @param $(obj) Object file name. This shall be (re)created by the compilation.
241# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
242# @param $(flags) Flags.
243# @param $(defs) Definitions. No -D or something.
244# @param $(incs) Includes. No -I or something.
245# @param $(dirdep) Directory creation dependency.
246# @param $(deps) Other dependencies.
247# @param $(outbase) Output basename (full). Use this for list files and such.
248# @param $(objsuff) Object suffix.
249TOOL_LLVMGXX42MACHO_COMPILE_PCH_OUTPUT = $($(target)_1_GCC_PCH_FILE)
250TOOL_LLVMGXX42MACHO_COMPILE_PCH_DEPEND =
251TOOL_LLVMGXX42MACHO_COMPILE_PCH_DEPORD = $($(target)_1_GCC_PCH_DIR)
252define TOOL_LLVMGXX42MACHO_COMPILE_PCH_CMDS
253 $(QUIET)$(TOOL_LLVMGXX42MACHO_PCH) -c\
254 $(flags) $(addprefix -I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(addprefix -D, $(defs))\
255 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
256 -o $(obj)\
257 $(abspath $(source))
258 $(INSTALL) --hard-link-files-when-possible -m 0644 -- "$(obj)" "$($(target)_1_GCC_PCH_FILE)"
259 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
260endef
261
262
263## Compile Objective-C source.
264# @param $(target) Normalized main target name.
265# @param $(source) Source filename (relative).
266# @param $(obj) Object file name. This shall be (re)created by the compilation.
267# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
268# @param $(flags) Flags.
269# @param $(defs) Definitions. No -D or something.
270# @param $(incs) Includes. No -I or something.
271# @param $(dirdep) Directory creation dependency.
272# @param $(deps) Other dependencies.
273# @param $(outbase) Output basename (full). Use this for list files and such.
274# @param $(objsuff) Object suffix.
275TOOL_LLVMGXX42MACHO_COMPILE_OBJC_DEPEND =
276TOOL_LLVMGXX42MACHO_COMPILE_OBJC_DEPORD =
277ifdef KBUILD_USE_KOBJCACHE
278TOOL_LLVMGXX42MACHO_COMPILE_OBJC_USES_KOBJCACHE = 1
279TOOL_LLVMGXX42MACHO_COMPILE_OBJC_OUTPUT = $(outbase).mi
280define TOOL_LLVMGXX42MACHO_COMPILE_OBJC_CMDS
281 $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
282 --kObjCache-cpp $(outbase).ii\
283 $(TOOL_LLVMGXX42MACHO_OBJC) -E -o -\
284 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
285 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
286 $(abspath $(source))\
287 --kObjCache-cc $(obj)\
288 $(TOOL_LLVMGXX42MACHO_OBJC) -c\
289 $(flags) -fpreprocessed -x objective-c \
290 -o $(obj)\
291 -
292 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
293endef
294else # !KBUILD_USE_KOBJCACHE
295TOOL_LLVMGXX42MACHO_COMPILE_OBJC_OUTPUT =
296define TOOL_LLVMGXX42MACHO_COMPILE_OBJC_CMDS
297 $(QUIET)$(TOOL_LLVMGXX42MACHO_OBJC) -c\
298 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
299 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
300 -o $(obj)\
301 $(abspath $(source))
302 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
303endef
304endif # !KBUILD_USE_KOBJCACHE
305
306
307## Compile Objective-C++ source.
308# @param $(target) Normalized main target name.
309# @param $(source) Source filename (relative).
310# @param $(obj) Object file name. This shall be (re)created by the compilation.
311# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
312# @param $(flags) Flags.
313# @param $(defs) Definitions. No -D or something.
314# @param $(incs) Includes. No -I or something.
315# @param $(dirdep) Directory creation dependency.
316# @param $(deps) Other dependencies.
317# @param $(outbase) Output basename (full). Use this for list files and such.
318# @param $(objsuff) Object suffix.
319TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_DEPEND =
320TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_DEPORD =
321ifdef KBUILD_USE_KOBJCACHE
322TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_USES_KOBJCACHE = 1
323TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_OUTPUT = $(outbase).mii
324define TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_CMDS
325 $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
326 --kObjCache-cpp $(outbase).mii\
327 $(TOOL_LLVMGXX42MACHO_OBJCXX) -E -o -\
328 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
329 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
330 $(abspath $(source))\
331 --kObjCache-cc $(obj)\
332 $(TOOL_LLVMGXX42MACHO_OBJCXX) -c\
333 $(flags) -fpreprocessed -x objective-c++ \
334 -o $(obj)\
335 -
336 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
337endef
338else # !KBUILD_USE_KOBJCACHE
339TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_OUTPUT =
340define TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_CMDS
341 $(QUIET)$(TOOL_LLVMGXX42MACHO_OBJCXX) -c\
342 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
343 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
344 -o $(obj)\
345 $(abspath $(source))
346 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
347endef
348endif # !KBUILD_USE_KOBJCACHE
349
350
351## Compile Assembly source.
352# @param $(target) Normalized main target name.
353# @param $(source) Source filename (relative).
354# @param $(obj) Object file name. This shall be (re)created by the compilation.
355# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
356# @param $(flags) Flags.
357# @param $(defs) Definitions. No -D or something.
358# @param $(incs) Includes. No -I or something.
359# @param $(dirdep) Directory creation dependency.
360# @param $(deps) Other dependencies.
361# @param $(outbase) Output basename (full). Use this for list files and such.
362# @param $(objsuff) Object suffix.
363#
364TOOL_LLVMGXX42MACHO_COMPILE_AS_OUTPUT =
365TOOL_LLVMGXX42MACHO_COMPILE_AS_DEPEND =
366TOOL_LLVMGXX42MACHO_COMPILE_AS_DEPORD =
367define TOOL_LLVMGXX42MACHO_COMPILE_AS_CMDS
368 $(QUIET)$(TOOL_LLVMGXX42MACHO_AS) -c\
369 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
370 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
371 -o $(obj)\
372 $(abspath $(source))
373 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
374endef
375
376
377## Link library
378# @param $(target) Normalized main target name.
379# @param $(out) Library name.
380# @param $(objs) Object files to put in the library.
381# @param $(flags) Flags.
382# @param $(dirdep) Directory creation dependency.
383# @param $(deps) Other dependencies.
384# @param $(othersrc) Unhandled sources.
385# @param $(outbase) Output basename (full). Use this for list files and such.
386TOOL_LLVMGXX42MACHO_LINK_LIBRARY_OUTPUT =
387TOOL_LLVMGXX42MACHO_LINK_LIBRARY_DEPEND = $(othersrc)
388TOOL_LLVMGXX42MACHO_LINK_LIBRARY_DEPORD =
389define TOOL_LLVMGXX42MACHO_LINK_LIBRARY_CMDS
390 $(if $(strip $(filter-out %.h.gch,$(objs))),$(call xargs,$(QUIET)$(TOOL_LLVMGXX42MACHO_AR) $(flags) $(out),$(filter-out %.h.gch,$(objs))))
391 $(foreach lib,$(othersrc)\
392 ,$(NL)$(TAB)$(call MSG_AR_MERGE,$(target),$(out),$(lib)) \
393 $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))ar.tmp.dir/* \
394 $(NL)$(TAB)$(QUIET)$(MKDIR) -p $(dir $(outbase))/ar.tmp.dir/ \
395 $(NL)$(TAB)$(QUIET)(cd $(dir $(outbase))ar.tmp.dir/ \
396 && $(TOOL_LLVMGXX42MACHO_AR) -x $(abspath $(lib)) \
397 && $(RM_EXT) -f ./__.SYMDEF* \
398 && $(TOOL_LLVMGXX42MACHO_AR) $(flags) $(out) *) \
399 $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))/ar.tmp.dir/* \
400 $(NL)$(TAB)$(QUIET)$(RMDIR) $(dir $(outbase))ar.tmp.dir/)
401endef
402
403
404## Link program
405# @param $(target) Normalized main target name.
406# @param $(out) Program name.
407# @param $(objs) Object files to link together.
408# @param $(libs) Libraries to search.
409# @param $(libpath) Library search paths.
410# @param $(flags) Flags.
411# @param $(dirdep) Directory creation dependency.
412# @param $(deps) Other dependencies.
413# @param $(othersrc) Unhandled sources.
414# @param $(custom_pre) Custom step invoked before linking.
415# @param $(custom_post) Custom step invoked after linking.
416# @param $(outbase) Output basename (full). Use this for list files and such.
417TOOL_LLVMGXX42MACHO_LINK_PROGRAM_OUTPUT = $(outbase).rsp
418TOOL_LLVMGXX42MACHO_LINK_PROGRAM_OUTPUT_DEBUG = $(call TOOL_LLVMGXX42MACHO_DEBUG_BUNDLE_FN,$(out))
419TOOL_LLVMGXX42MACHO_LINK_PROGRAM_DEBUG_INSTALL_FN = $(TOOL_LLVMGXX42MACHO_DEBUG_INSTALL_FN)
420TOOL_LLVMGXX42MACHO_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
421TOOL_LLVMGXX42MACHO_LINK_PROGRAM_DEPORD =
422define TOOL_LLVMGXX42MACHO_LINK_PROGRAM_CMDS
423 $(QUIET)$(APPEND) -n $(outbase).rsp $(filter-out %.h.gch,$(objs))
424 $(QUIET)$(TOOL_LLVMGXX42MACHO_LD) $(flags) -o $(out)\
425 -filelist $(outbase).rsp\
426 $(foreach p,$(libpath), -L$(p))\
427 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
428 ifeq ($(ld_debug),split)
429 $(QUIET)$(TOOL_LLVMGXX42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
430 $(QUIET)$(TOOL_LLVMGXX42MACHO_STRIP_PROGRAM) $(out)
431 endif
432endef
433
434
435## Link DLL
436# @param $(target) Normalized main target name.
437# @param $(out) Program name.
438# @param $(objs) Object files to link together.
439# @param $(libs) Libraries to search.
440# @param $(libpath) Library search paths.
441# @param $(flags) Flags.
442# @param $(dirdep) Directory creation dependency.
443# @param $(deps) Other dependencies.
444# @param $(othersrc) Unhandled sources.
445# @param $(custom_pre) Custom step invoked before linking.
446# @param $(custom_post) Custom step invoked after linking.
447# @param $(outbase) Output basename (full). Use this for list files and such.
448TOOL_LLVMGXX42MACHO_LINK_DLL_OUTPUT = $(outbase).rsp
449TOOL_LLVMGXX42MACHO_LINK_DLL_OUTPUT_DEBUG = $(call TOOL_LLVMGXX42MACHO_DEBUG_BUNDLE_FN,$(out))
450TOOL_LLVMGXX42MACHO_LINK_DLL_DEBUG_INSTALL_FN = $(TOOL_LLVMGXX42MACHO_DEBUG_INSTALL_FN)
451TOOL_LLVMGXX42MACHO_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
452TOOL_LLVMGXX42MACHO_LINK_DLL_DEPORD =
453define TOOL_LLVMGXX42MACHO_LINK_DLL_CMDS
454 $(QUIET)$(APPEND) -n $(outbase).rsp $(filter-out %.h.gch,$(objs))
455 $(QUIET)$(TOOL_LLVMGXX42MACHO_LD) $(TOOL_LLVMGXX42MACHO_LDFLAGS.dll) $(flags) -o $(out)\
456 $(call TOOL_LLVMGXX42MACHO_LD_SONAME,$(target),$(out))\
457 -filelist $(outbase).rsp\
458 $(foreach p,$(libpath), -L$(p))\
459 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
460 ifeq ($(ld_debug),split)
461 $(QUIET)$(TOOL_LLVMGXX42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
462 $(QUIET)$(TOOL_LLVMGXX42MACHO_STRIP_DLL) $(out)
463 endif
464endef
465
466
467## Link system module (windows aka driver, linux aka kernel module)
468# @param $(target) Normalized main target name.
469# @param $(out) System module name.
470# @param $(objs) Object files to link together.
471# @param $(libs) Libraries to search.
472# @param $(libpath) Library search paths.
473# @param $(flags) Flags.
474# @param $(dirdep) Directory creation dependency.
475# @param $(deps) Other dependencies.
476# @param $(othersrc) Unhandled sources.
477# @param $(custom_pre) Custom step invoked before linking.
478# @param $(custom_post) Custom step invoked after linking.
479# @param $(outbase) Output basename (full). Use this for list files and such.
480TOOL_LLVMGXX42MACHO_LINK_SYSMOD_OUTPUT = $(outbase).rsp
481TOOL_LLVMGXX42MACHO_LINK_SYSMOD_OUTPUT_DEBUG = $(call TOOL_LLVMGXX42MACHO_DEBUG_BUNDLE_FN,$(out))
482TOOL_LLVMGXX42MACHO_LINK_SYSMOD_DEBUG_INSTALL_FN = $(TOOL_LLVMGXX42MACHO_DEBUG_INSTALL_FN)
483TOOL_LLVMGXX42MACHO_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
484TOOL_LLVMGXX42MACHO_LINK_SYSMOD_DEPORD =
485define TOOL_LLVMGXX42MACHO_LINK_SYSMOD_CMDS
486 $(QUIET)$(APPEND) -n $(outbase).rsp $(filter-out %.h.gch,$(objs))
487 $(QUIET)$(TOOL_LLVMGXX42MACHO_LD_SYSMOD) $(TOOL_LLVMGXX42MACHO_LDFLAGS.sysmod) $(flags) -o $(out)\
488 -filelist $(outbase).rsp\
489 $(foreach p,$(libpath), -L$(p))\
490 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
491 ifeq ($(ld_debug),split)
492 $(QUIET)$(TOOL_LLVMGXX42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
493 $(QUIET)$(TOOL_LLVMGXX42MACHO_STRIP_SYSMOD) $(out)
494 endif
495endef
496
Note: See TracBrowser for help on using the repository browser.