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 |
|
---|
34 | TOOL_LLVMGXX42MACHO := LLVM GCC v4.2.x targeting Darwin (Mac OS X) Mach-O, for building C++ code.
|
---|
35 |
|
---|
36 | # Tool Specific Properties
|
---|
37 | ifndef TOOL_LLVMGXX42MACHO_PREFIX
|
---|
38 | TOOL_LLVMGXX42MACHO_PREFIX := llvm-
|
---|
39 | endif
|
---|
40 | ifndef TOOL_LLVMGXX42MACHO_SUFFIX
|
---|
41 | TOOL_LLVMGXX42MACHO_SUFFIX := -4.2$(HOSTSUFF_EXE)
|
---|
42 | endif
|
---|
43 | TOOL_LLVMGXX42MACHO_CC ?= $(TOOL_LLVMGXX42MACHO_PREFIX)gcc$(TOOL_LLVMGXX42MACHO_SUFFIX)
|
---|
44 | TOOL_LLVMGXX42MACHO_CXX ?= $(TOOL_LLVMGXX42MACHO_PREFIX)g++$(TOOL_LLVMGXX42MACHO_SUFFIX)
|
---|
45 | TOOL_LLVMGXX42MACHO_PCH ?= $(TOOL_LLVMGXX42MACHO_CXX)
|
---|
46 | TOOL_LLVMGXX42MACHO_OBJC ?= $(TOOL_LLVMGXX42MACHO_PREFIX)gcc$(TOOL_LLVMGXX42MACHO_SUFFIX)
|
---|
47 | TOOL_LLVMGXX42MACHO_OBJCXX ?= $(TOOL_LLVMGXX42MACHO_PREFIX)gcc$(TOOL_LLVMGXX42MACHO_SUFFIX)
|
---|
48 | TOOL_LLVMGXX42MACHO_AS ?= $(TOOL_LLVMGXX42MACHO_PREFIX)gcc$(TOOL_LLVMGXX42MACHO_SUFFIX)
|
---|
49 | TOOL_LLVMGXX42MACHO_LD ?= $(TOOL_LLVMGXX42MACHO_PREFIX)g++$(TOOL_LLVMGXX42MACHO_SUFFIX)
|
---|
50 | TOOL_LLVMGXX42MACHO_LD_SYSMOD ?= $(TOOL_LLVMGXX42MACHO_PREFIX)g++$(TOOL_LLVMGXX42MACHO_SUFFIX)
|
---|
51 | TOOL_LLVMGXX42MACHO_LDFLAGS.dll ?= -dynamiclib
|
---|
52 | TOOL_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 |
|
---|
55 | TOOL_LLVMGXX42MACHO_DSYMUTIL_PREFIX ?=
|
---|
56 | TOOL_LLVMGXX42MACHO_DSYMUTIL_SUFFIX ?= $(HOSTSUFF_EXE)
|
---|
57 | TOOL_LLVMGXX42MACHO_DSYMUTIL ?= $(TOOL_LLVMGXX42MACHO_DSYMUTIL_PREFIX)dsymutil$(TOOL_LLVMGXX42MACHO_DSYMUTIL_SUFFIX)
|
---|
58 |
|
---|
59 | ifdef SLKRUNS
|
---|
60 | TOOL_LLVMGXX42MACHO_CC += -fmessage-length=0
|
---|
61 | TOOL_LLVMGXX42MACHO_CXX += -fmessage-length=0
|
---|
62 | TOOL_LLVMGXX42MACHO_OBJC += -fmessage-length=0
|
---|
63 | TOOL_LLVMGXX42MACHO_OBJCXX += -fmessage-length=0
|
---|
64 | endif
|
---|
65 |
|
---|
66 | # General Properties used by kBuild
|
---|
67 | TOOL_LLVMGXX42MACHO_COBJSUFF ?= .o
|
---|
68 | TOOL_LLVMGXX42MACHO_CFLAGS ?=
|
---|
69 | TOOL_LLVMGXX42MACHO_CFLAGS.debug ?= -g
|
---|
70 | TOOL_LLVMGXX42MACHO_CFLAGS.profile ?= -O2 #-g -pg
|
---|
71 | TOOL_LLVMGXX42MACHO_CFLAGS.release ?= -O2
|
---|
72 | TOOL_LLVMGXX42MACHO_CINCS ?=
|
---|
73 | TOOL_LLVMGXX42MACHO_CDEFS ?=
|
---|
74 |
|
---|
75 | TOOL_LLVMGXX42MACHO_CXXOBJSUFF ?= .o
|
---|
76 | TOOL_LLVMGXX42MACHO_CXXFLAGS ?=
|
---|
77 | TOOL_LLVMGXX42MACHO_CXXFLAGS.debug ?= -g
|
---|
78 | TOOL_LLVMGXX42MACHO_CXXFLAGS.profile ?= -O2 #-g -pg
|
---|
79 | TOOL_LLVMGXX42MACHO_CXXFLAGS.release ?= -O2
|
---|
80 | TOOL_LLVMGXX42MACHO_CXXINCS ?=
|
---|
81 | TOOL_LLVMGXX42MACHO_CXXDEFS ?=
|
---|
82 |
|
---|
83 | TOOL_LLVMGXX42MACHO_PCHOBJSUFF ?= .h.gch
|
---|
84 | TOOL_LLVMGXX42MACHO_PCHFLAGS ?= $(TOOL_LLVMGXX42MACHO_CXXFLAGS)
|
---|
85 | TOOL_LLVMGXX42MACHO_PCHFLAGS.debug ?= $(TOOL_LLVMGXX42MACHO_CXXFLAGS.debug)
|
---|
86 | TOOL_LLVMGXX42MACHO_PCHFLAGS.profile ?= $(TOOL_LLVMGXX42MACHO_CXXFLAGS.profile)
|
---|
87 | TOOL_LLVMGXX42MACHO_PCHFLAGS.release ?= $(TOOL_LLVMGXX42MACHO_CXXFLAGS.release)
|
---|
88 | TOOL_LLVMGXX42MACHO_PCHINCS ?= $(TOOL_LLVMGXX42MACHO_CXXINCS)
|
---|
89 | TOOL_LLVMGXX42MACHO_PCHDEFS ?= $(TOOL_LLVMGXX42MACHO_CXXDEFS)
|
---|
90 |
|
---|
91 | TOOL_LLVMGXX42MACHO_OBJCOBJSUFF ?= .o
|
---|
92 | TOOL_LLVMGXX42MACHO_OBJCFLAGS ?=
|
---|
93 | TOOL_LLVMGXX42MACHO_OBJCFLAGS.debug ?= -g
|
---|
94 | TOOL_LLVMGXX42MACHO_OBJCFLAGS.profile?= -O2 #-g -pg
|
---|
95 | TOOL_LLVMGXX42MACHO_OBJCFLAGS.release?= -O2
|
---|
96 | TOOL_LLVMGXX42MACHO_OBJCINCS ?=
|
---|
97 | TOOL_LLVMGXX42MACHO_OBJCDEFS ?=
|
---|
98 |
|
---|
99 | TOOL_LLVMGXX42MACHO_OBJCXXOBJSUFF ?= .o
|
---|
100 | TOOL_LLVMGXX42MACHO_OBJCXXFLAGS ?=
|
---|
101 | TOOL_LLVMGXX42MACHO_OBJCXXFLAGS.debug ?= -g
|
---|
102 | TOOL_LLVMGXX42MACHO_OBJCXXFLAGS.profile ?= -O2 #-g -pg
|
---|
103 | TOOL_LLVMGXX42MACHO_OBJCXXFLAGS.release ?= -O2
|
---|
104 | TOOL_LLVMGXX42MACHO_OBJCXXINCS ?=
|
---|
105 | TOOL_LLVMGXX42MACHO_OBJCXXDEFS ?=
|
---|
106 |
|
---|
107 | TOOL_LLVMGXX42MACHO_ASFLAGS ?= -x assembler-with-cpp
|
---|
108 | TOOL_LLVMGXX42MACHO_ASFLAGS.debug ?= -g
|
---|
109 | TOOL_LLVMGXX42MACHO_ASFLAGS.profile ?= -g
|
---|
110 | TOOL_LLVMGXX42MACHO_ASOBJSUFF ?= .o
|
---|
111 |
|
---|
112 | TOOL_LLVMGXX42MACHO_AR ?= ar$(HOSTSUFF_EXE)
|
---|
113 | TOOL_LLVMGXX42MACHO_ARFLAGS ?= -c -rs
|
---|
114 | TOOL_LLVMGXX42MACHO_ARLIBSUFF ?= .a
|
---|
115 |
|
---|
116 | TOOL_LLVMGXX42MACHO_LDFLAGS ?=
|
---|
117 | TOOL_LLVMGXX42MACHO_LDFLAGS.debug ?= -g
|
---|
118 | TOOL_LLVMGXX42MACHO_LDFLAGS.profile ?= -g
|
---|
119 |
|
---|
120 | TOOL_LLVMGXX42MACHO_STRIP_PROGRAM ?= strip -SXxru
|
---|
121 | TOOL_LLVMGXX42MACHO_STRIP_DLL ?= strip -Sxru
|
---|
122 | TOOL_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.
|
---|
129 | TOOL_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.
|
---|
145 | TOOL_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.
|
---|
167 | TOOL_LLVMGXX42MACHO_COMPILE_C_DEPEND =
|
---|
168 | TOOL_LLVMGXX42MACHO_COMPILE_C_DEPORD =
|
---|
169 | TOOL_LLVMGXX42MACHO_COMPILE_C_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).i,)
|
---|
170 | TOOL_LLVMGXX42MACHO_COMPILE_C_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
|
---|
171 | define TOOL_LLVMGXX42MACHO_COMPILE_C_CMDS
|
---|
172 | if "$(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 | -
|
---|
184 | else
|
---|
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))
|
---|
190 | endif
|
---|
191 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
192 | endef
|
---|
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.
|
---|
207 | TOOL_LLVMGXX42MACHO_COMPILE_CXX_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).ii,)
|
---|
208 | TOOL_LLVMGXX42MACHO_COMPILE_CXX_DEPEND = $($(target)_1_GCC_PCH_FILE)
|
---|
209 | TOOL_LLVMGXX42MACHO_COMPILE_CXX_DEPORD =
|
---|
210 | TOOL_LLVMGXX42MACHO_COMPILE_CXX_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
|
---|
211 | define TOOL_LLVMGXX42MACHO_COMPILE_CXX_CMDS
|
---|
212 | if "$(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 | -
|
---|
225 | else
|
---|
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))
|
---|
232 | endif
|
---|
233 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
234 | endef
|
---|
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.
|
---|
249 | TOOL_LLVMGXX42MACHO_COMPILE_PCH_OUTPUT = $($(target)_1_GCC_PCH_FILE)
|
---|
250 | TOOL_LLVMGXX42MACHO_COMPILE_PCH_DEPEND =
|
---|
251 | TOOL_LLVMGXX42MACHO_COMPILE_PCH_DEPORD = $($(target)_1_GCC_PCH_DIR)
|
---|
252 | define 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):" ""
|
---|
260 | endef
|
---|
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.
|
---|
275 | TOOL_LLVMGXX42MACHO_COMPILE_OBJC_DEPEND =
|
---|
276 | TOOL_LLVMGXX42MACHO_COMPILE_OBJC_DEPORD =
|
---|
277 | ifdef KBUILD_USE_KOBJCACHE
|
---|
278 | TOOL_LLVMGXX42MACHO_COMPILE_OBJC_USES_KOBJCACHE = 1
|
---|
279 | TOOL_LLVMGXX42MACHO_COMPILE_OBJC_OUTPUT = $(outbase).mi
|
---|
280 | define 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):" ""
|
---|
293 | endef
|
---|
294 | else # !KBUILD_USE_KOBJCACHE
|
---|
295 | TOOL_LLVMGXX42MACHO_COMPILE_OBJC_OUTPUT =
|
---|
296 | define 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):" ""
|
---|
303 | endef
|
---|
304 | endif # !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.
|
---|
319 | TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_DEPEND =
|
---|
320 | TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_DEPORD =
|
---|
321 | ifdef KBUILD_USE_KOBJCACHE
|
---|
322 | TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_USES_KOBJCACHE = 1
|
---|
323 | TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_OUTPUT = $(outbase).mii
|
---|
324 | define 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):" ""
|
---|
337 | endef
|
---|
338 | else # !KBUILD_USE_KOBJCACHE
|
---|
339 | TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_OUTPUT =
|
---|
340 | define 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):" ""
|
---|
347 | endef
|
---|
348 | endif # !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 | #
|
---|
364 | TOOL_LLVMGXX42MACHO_COMPILE_AS_OUTPUT =
|
---|
365 | TOOL_LLVMGXX42MACHO_COMPILE_AS_DEPEND =
|
---|
366 | TOOL_LLVMGXX42MACHO_COMPILE_AS_DEPORD =
|
---|
367 | define 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):" ""
|
---|
374 | endef
|
---|
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.
|
---|
386 | TOOL_LLVMGXX42MACHO_LINK_LIBRARY_OUTPUT =
|
---|
387 | TOOL_LLVMGXX42MACHO_LINK_LIBRARY_DEPEND = $(othersrc)
|
---|
388 | TOOL_LLVMGXX42MACHO_LINK_LIBRARY_DEPORD =
|
---|
389 | define 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/)
|
---|
401 | endef
|
---|
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.
|
---|
417 | TOOL_LLVMGXX42MACHO_LINK_PROGRAM_OUTPUT = $(outbase).rsp
|
---|
418 | TOOL_LLVMGXX42MACHO_LINK_PROGRAM_OUTPUT_DEBUG = $(call TOOL_LLVMGXX42MACHO_DEBUG_BUNDLE_FN,$(out))
|
---|
419 | TOOL_LLVMGXX42MACHO_LINK_PROGRAM_DEBUG_INSTALL_FN = $(TOOL_LLVMGXX42MACHO_DEBUG_INSTALL_FN)
|
---|
420 | TOOL_LLVMGXX42MACHO_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
|
---|
421 | TOOL_LLVMGXX42MACHO_LINK_PROGRAM_DEPORD =
|
---|
422 | define 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
|
---|
432 | endef
|
---|
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.
|
---|
448 | TOOL_LLVMGXX42MACHO_LINK_DLL_OUTPUT = $(outbase).rsp
|
---|
449 | TOOL_LLVMGXX42MACHO_LINK_DLL_OUTPUT_DEBUG = $(call TOOL_LLVMGXX42MACHO_DEBUG_BUNDLE_FN,$(out))
|
---|
450 | TOOL_LLVMGXX42MACHO_LINK_DLL_DEBUG_INSTALL_FN = $(TOOL_LLVMGXX42MACHO_DEBUG_INSTALL_FN)
|
---|
451 | TOOL_LLVMGXX42MACHO_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
|
---|
452 | TOOL_LLVMGXX42MACHO_LINK_DLL_DEPORD =
|
---|
453 | define 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
|
---|
464 | endef
|
---|
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.
|
---|
480 | TOOL_LLVMGXX42MACHO_LINK_SYSMOD_OUTPUT = $(outbase).rsp
|
---|
481 | TOOL_LLVMGXX42MACHO_LINK_SYSMOD_OUTPUT_DEBUG = $(call TOOL_LLVMGXX42MACHO_DEBUG_BUNDLE_FN,$(out))
|
---|
482 | TOOL_LLVMGXX42MACHO_LINK_SYSMOD_DEBUG_INSTALL_FN = $(TOOL_LLVMGXX42MACHO_DEBUG_INSTALL_FN)
|
---|
483 | TOOL_LLVMGXX42MACHO_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
|
---|
484 | TOOL_LLVMGXX42MACHO_LINK_SYSMOD_DEPORD =
|
---|
485 | define 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
|
---|
495 | endef
|
---|
496 |
|
---|