1 | # $Id: GXX4MACHO.kmk 3258 2019-01-03 05:34:09Z bird $
|
---|
2 | ## @file
|
---|
3 | # kBuild Tool Config - GCC v4 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_GXX4MACHO := GCC v4 targeting Darwin (Mac OS X) Mach-O, for building C++ code.
|
---|
35 |
|
---|
36 | # Tool Specific Properties
|
---|
37 | TOOL_GXX4MACHO_PREFIX ?=
|
---|
38 | TOOL_GXX4MACHO_SUFFIX ?= $(HOSTSUFF_EXE)
|
---|
39 | TOOL_GXX4MACHO_CC ?= $(TOOL_GXX4MACHO_PREFIX)gcc$(TOOL_GXX4MACHO_SUFFIX)
|
---|
40 | TOOL_GXX4MACHO_CXX ?= $(TOOL_GXX4MACHO_PREFIX)g++$(TOOL_GXX4MACHO_SUFFIX)
|
---|
41 | TOOL_GXX4MACHO_PCH ?= $(TOOL_GXX4MACHO_CXX)
|
---|
42 | TOOL_GXX4MACHO_OBJC ?= $(TOOL_GXX4MACHO_PREFIX)gcc$(TOOL_GXX4MACHO_SUFFIX)
|
---|
43 | TOOL_GXX4MACHO_OBJCXX ?= $(TOOL_GXX4MACHO_PREFIX)gcc$(TOOL_GXX4MACHO_SUFFIX)
|
---|
44 | TOOL_GXX4MACHO_AS ?= $(TOOL_GXX4MACHO_PREFIX)gcc$(TOOL_GXX4MACHO_SUFFIX)
|
---|
45 | TOOL_GXX4MACHO_LD ?= $(TOOL_GXX4MACHO_PREFIX)g++$(TOOL_GXX4MACHO_SUFFIX)
|
---|
46 | TOOL_GXX4MACHO_LD_SYSMOD ?= $(TOOL_GXX4MACHO_PREFIX)g++$(TOOL_GXX4MACHO_SUFFIX)
|
---|
47 | ifndef TOOL_GXX4MACHO_LDFLAGS.$(KBUILD_TARGET)
|
---|
48 | TOOL_GXX4MACHO_LDFLAGS.dll ?= -dynamiclib
|
---|
49 | else
|
---|
50 | TOOL_GXX4MACHO_LDFLAGS.dll ?= $(TOOL_GXX4MACHO_LDFLAGS.$(KBUILD_TARGET))
|
---|
51 | endif
|
---|
52 | TOOL_GXX4MACHO_LDFLAGS.sysmod ?= -r
|
---|
53 | #TOOL_GXX4MACHO_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 | TOOL_GXX4MACHO_DSYMUTIL ?= dsymutil
|
---|
55 |
|
---|
56 | ifdef SLKRUNS
|
---|
57 | TOOL_GXX4MACHO_CC += -fmessage-length=0
|
---|
58 | TOOL_GXX4MACHO_CXX += -fmessage-length=0
|
---|
59 | TOOL_GXX4MACHO_OBJC += -fmessage-length=0
|
---|
60 | TOOL_GXX4MACHO_OBJCXX += -fmessage-length=0
|
---|
61 | endif
|
---|
62 |
|
---|
63 | # General Properties used by kBuild
|
---|
64 | TOOL_GXX4MACHO_COBJSUFF ?= .o
|
---|
65 | TOOL_GXX4MACHO_CFLAGS ?=
|
---|
66 | TOOL_GXX4MACHO_CFLAGS.debug ?= -g
|
---|
67 | TOOL_GXX4MACHO_CFLAGS.profile ?= -O2 #-g -pg
|
---|
68 | TOOL_GXX4MACHO_CFLAGS.release ?= -O2
|
---|
69 | TOOL_GXX4MACHO_CINCS ?=
|
---|
70 | TOOL_GXX4MACHO_CDEFS ?=
|
---|
71 |
|
---|
72 | TOOL_GXX4MACHO_CXXOBJSUFF ?= .o
|
---|
73 | TOOL_GXX4MACHO_CXXFLAGS ?=
|
---|
74 | TOOL_GXX4MACHO_CXXFLAGS.debug ?= -g
|
---|
75 | TOOL_GXX4MACHO_CXXFLAGS.profile ?= -O2 #-g -pg
|
---|
76 | TOOL_GXX4MACHO_CXXFLAGS.release ?= -O2
|
---|
77 | TOOL_GXX4MACHO_CXXINCS ?=
|
---|
78 | TOOL_GXX4MACHO_CXXDEFS ?=
|
---|
79 |
|
---|
80 | TOOL_GXX4MACHO_PCHOBJSUFF ?= .h.gch
|
---|
81 | TOOL_GXX4MACHO_PCHFLAGS ?= $(TOOL_GXX4MACHO_CXXFLAGS)
|
---|
82 | TOOL_GXX4MACHO_PCHFLAGS.debug ?= $(TOOL_GXX4MACHO_CXXFLAGS.debug)
|
---|
83 | TOOL_GXX4MACHO_PCHFLAGS.profile ?= $(TOOL_GXX4MACHO_CXXFLAGS.profile)
|
---|
84 | TOOL_GXX4MACHO_PCHFLAGS.release ?= $(TOOL_GXX4MACHO_CXXFLAGS.release)
|
---|
85 | TOOL_GXX4MACHO_PCHINCS ?= $(TOOL_GXX4MACHO_CXXINCS)
|
---|
86 | TOOL_GXX4MACHO_PCHDEFS ?= $(TOOL_GXX4MACHO_CXXDEFS)
|
---|
87 |
|
---|
88 | TOOL_GXX4MACHO_OBJCOBJSUFF ?= .o
|
---|
89 | TOOL_GXX4MACHO_OBJCFLAGS ?=
|
---|
90 | TOOL_GXX4MACHO_OBJCFLAGS.debug ?= -g
|
---|
91 | TOOL_GXX4MACHO_OBJCFLAGS.profile?= -O2 #-g -pg
|
---|
92 | TOOL_GXX4MACHO_OBJCFLAGS.release?= -O2
|
---|
93 | TOOL_GXX4MACHO_OBJCINCS ?=
|
---|
94 | TOOL_GXX4MACHO_OBJCDEFS ?=
|
---|
95 |
|
---|
96 | TOOL_GXX4MACHO_OBJCXXOBJSUFF ?= .o
|
---|
97 | TOOL_GXX4MACHO_OBJCXXFLAGS ?=
|
---|
98 | TOOL_GXX4MACHO_OBJCXXFLAGS.debug ?= -g
|
---|
99 | TOOL_GXX4MACHO_OBJCXXFLAGS.profile ?= -O2 #-g -pg
|
---|
100 | TOOL_GXX4MACHO_OBJCXXFLAGS.release ?= -O2
|
---|
101 | TOOL_GXX4MACHO_OBJCXXINCS ?=
|
---|
102 | TOOL_GXX4MACHO_OBJCXXDEFS ?=
|
---|
103 |
|
---|
104 | TOOL_GXX4MACHO_ASFLAGS ?= -x assembler-with-cpp
|
---|
105 | TOOL_GXX4MACHO_ASFLAGS.debug ?= -g
|
---|
106 | TOOL_GXX4MACHO_ASFLAGS.profile ?= -g
|
---|
107 | TOOL_GXX4MACHO_ASOBJSUFF ?= .o
|
---|
108 |
|
---|
109 | TOOL_GXX4MACHO_AR ?= ar$(HOSTSUFF_EXE)
|
---|
110 | TOOL_GXX4MACHO_ARFLAGS ?= -c -rs
|
---|
111 | TOOL_GXX4MACHO_ARLIBSUFF ?= .a
|
---|
112 |
|
---|
113 | TOOL_GXX4MACHO_LDFLAGS ?=
|
---|
114 | TOOL_GXX4MACHO_LDFLAGS.debug ?= -g
|
---|
115 | TOOL_GXX4MACHO_LDFLAGS.profile ?= -g
|
---|
116 |
|
---|
117 | TOOL_GXX4MACHO_STRIP_PROGRAM ?= strip -SXxru
|
---|
118 | TOOL_GXX4MACHO_STRIP_DLL ?= strip -Sxru
|
---|
119 | TOOL_GXX4MACHO_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.
|
---|
126 | TOOL_GXX4MACHO_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.
|
---|
142 | TOOL_GXX4MACHO_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.
|
---|
164 | TOOL_GXX4MACHO_COMPILE_C_DEPEND =
|
---|
165 | TOOL_GXX4MACHO_COMPILE_C_DEPORD =
|
---|
166 | TOOL_GXX4MACHO_COMPILE_C_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).i,)
|
---|
167 | TOOL_GXX4MACHO_COMPILE_C_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
|
---|
168 | define TOOL_GXX4MACHO_COMPILE_C_CMDS
|
---|
169 | if "$(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_GXX4MACHO_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_GXX4MACHO_CC) -c\
|
---|
178 | $(flags) -fpreprocessed -x c\
|
---|
179 | -o $(obj)\
|
---|
180 | -
|
---|
181 | else
|
---|
182 | $(QUIET)$(TOOL_GXX4MACHO_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))
|
---|
187 | endif
|
---|
188 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
189 | endef
|
---|
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.
|
---|
204 | TOOL_GXX4MACHO_COMPILE_CXX_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).ii,)
|
---|
205 | TOOL_GXX4MACHO_COMPILE_CXX_DEPEND = $($(target)_1_GCC_PCH_FILE)
|
---|
206 | TOOL_GXX4MACHO_COMPILE_CXX_DEPORD =
|
---|
207 | TOOL_GXX4MACHO_COMPILE_CXX_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
|
---|
208 | define TOOL_GXX4MACHO_COMPILE_CXX_CMDS
|
---|
209 | if "$(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_GXX4MACHO_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_GXX4MACHO_CXX) -c\
|
---|
219 | $(flags) -fpreprocessed $(if-expr defined($(target)_PCH_HDR),-fpch-preprocess,) -x c++\
|
---|
220 | -o $(obj)\
|
---|
221 | -
|
---|
222 | else
|
---|
223 | $(QUIET)$(TOOL_GXX4MACHO_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))
|
---|
229 | endif
|
---|
230 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
231 | endef
|
---|
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.
|
---|
246 | TOOL_GXX4MACHO_COMPILE_PCH_OUTPUT = $($(target)_1_GCC_PCH_FILE)
|
---|
247 | TOOL_GXX4MACHO_COMPILE_PCH_DEPEND =
|
---|
248 | TOOL_GXX4MACHO_COMPILE_PCH_DEPORD = $($(target)_1_GCC_PCH_DIR)
|
---|
249 | define TOOL_GXX4MACHO_COMPILE_PCH_CMDS
|
---|
250 | $(QUIET)$(TOOL_GXX4MACHO_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):" ""
|
---|
257 | endef
|
---|
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.
|
---|
272 | TOOL_GXX4MACHO_COMPILE_OBJCXX_DEPEND =
|
---|
273 | TOOL_GXX4MACHO_COMPILE_OBJCXX_DEPORD =
|
---|
274 | ifdef KBUILD_USE_KOBJCACHE
|
---|
275 | TOOL_GXX4MACHO_COMPILE_OBJCXX_USES_KOBJCACHE = 1
|
---|
276 | TOOL_GXX4MACHO_COMPILE_OBJCXX_OUTPUT = $(outbase).mii
|
---|
277 | define TOOL_GXX4MACHO_COMPILE_OBJCXX_CMDS
|
---|
278 | $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
|
---|
279 | --kObjCache-cpp $(outbase).mii\
|
---|
280 | $(TOOL_GXX4MACHO_OBJCXX) -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_GXX4MACHO_OBJCXX) -c\
|
---|
286 | $(flags) -fpreprocessed -x objective-c++ \
|
---|
287 | -o $(obj)\
|
---|
288 | -
|
---|
289 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
290 | endef
|
---|
291 | else # !KBUILD_USE_KOBJCACHE
|
---|
292 | TOOL_GXX4MACHO_COMPILE_OBJCXX_OUTPUT =
|
---|
293 | define TOOL_GXX4MACHO_COMPILE_OBJCXX_CMDS
|
---|
294 | $(QUIET)$(TOOL_GXX4MACHO_OBJCXX) -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):" ""
|
---|
300 | endef
|
---|
301 | endif # !KBUILD_USE_KOBJCACHE
|
---|
302 |
|
---|
303 |
|
---|
304 | ## Compile Assembly 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.
|
---|
316 | #
|
---|
317 | TOOL_GXX4MACHO_COMPILE_AS_OUTPUT =
|
---|
318 | TOOL_GXX4MACHO_COMPILE_AS_DEPEND =
|
---|
319 | TOOL_GXX4MACHO_COMPILE_AS_DEPORD =
|
---|
320 | define TOOL_GXX4MACHO_COMPILE_AS_CMDS
|
---|
321 | $(QUIET)$(TOOL_GXX4MACHO_AS) -c\
|
---|
322 | $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
|
---|
323 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
324 | -o $(obj)\
|
---|
325 | $(abspath $(source))
|
---|
326 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
327 | endef
|
---|
328 |
|
---|
329 |
|
---|
330 | ## Link library
|
---|
331 | # @param $(target) Normalized main target name.
|
---|
332 | # @param $(out) Library name.
|
---|
333 | # @param $(objs) Object files to put in the library.
|
---|
334 | # @param $(flags) Flags.
|
---|
335 | # @param $(dirdep) Directory creation dependency.
|
---|
336 | # @param $(deps) Other dependencies.
|
---|
337 | # @param $(othersrc) Unhandled sources.
|
---|
338 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
339 | TOOL_GXX4MACHO_LINK_LIBRARY_OUTPUT =
|
---|
340 | TOOL_GXX4MACHO_LINK_LIBRARY_DEPEND = $(othersrc)
|
---|
341 | TOOL_GXX4MACHO_LINK_LIBRARY_DEPORD =
|
---|
342 | define TOOL_GXX4MACHO_LINK_LIBRARY_CMDS
|
---|
343 | $(if $(strip $(filter-out %.h.gch,$(objs))),$(call xargs,$(QUIET)$(TOOL_GXX4MACHO_AR) $(flags) $(out),$(filter-out %.h.gch,$(objs))))
|
---|
344 | $(foreach lib,$(othersrc)\
|
---|
345 | ,$(NL)$(TAB)$(call MSG_AR_MERGE,$(target),$(out),$(lib)) \
|
---|
346 | $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))ar.tmp.dir/* \
|
---|
347 | $(NL)$(TAB)$(QUIET)$(MKDIR) -p $(dir $(outbase))/ar.tmp.dir/ \
|
---|
348 | $(NL)$(TAB)$(QUIET)(cd $(dir $(outbase))ar.tmp.dir/ \
|
---|
349 | && $(TOOL_GXX4MACHO_AR) -x $(abspath $(lib)) \
|
---|
350 | && $(RM_EXT) -f ./__.SYMDEF* \
|
---|
351 | && $(TOOL_GXX4MACHO_AR) $(flags) $(out) *) \
|
---|
352 | $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))/ar.tmp.dir/* \
|
---|
353 | $(NL)$(TAB)$(QUIET)$(RMDIR) $(dir $(outbase))ar.tmp.dir/)
|
---|
354 | endef
|
---|
355 |
|
---|
356 |
|
---|
357 | ## Link program
|
---|
358 | # @param $(target) Normalized main target name.
|
---|
359 | # @param $(out) Program name.
|
---|
360 | # @param $(objs) Object files to link together.
|
---|
361 | # @param $(libs) Libraries to search.
|
---|
362 | # @param $(libpath) Library search paths.
|
---|
363 | # @param $(flags) Flags.
|
---|
364 | # @param $(dirdep) Directory creation dependency.
|
---|
365 | # @param $(deps) Other dependencies.
|
---|
366 | # @param $(othersrc) Unhandled sources.
|
---|
367 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
368 | # @param $(custom_post) Custom step invoked after linking.
|
---|
369 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
370 | TOOL_GXX4MACHO_LINK_PROGRAM_OUTPUT = $(outbase).rsp
|
---|
371 | TOOL_GXX4MACHO_LINK_PROGRAM_OUTPUT_DEBUG = $(call TOOL_GXX4MACHO_DEBUG_BUNDLE_FN,$(out))
|
---|
372 | TOOL_GXX4MACHO_LINK_PROGRAM_DEBUG_INSTALL_FN = $(TOOL_GXX4MACHO_DEBUG_INSTALL_FN)
|
---|
373 | TOOL_GXX4MACHO_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
|
---|
374 | TOOL_GXX4MACHO_LINK_PROGRAM_DEPORD =
|
---|
375 | define TOOL_GXX4MACHO_LINK_PROGRAM_CMDS
|
---|
376 | $(QUIET)$(APPEND) -n $(outbase).rsp $(filter-out %.h.gch,$(objs))
|
---|
377 | $(QUIET)$(TOOL_GXX4MACHO_LD) $(flags) -o $(out)\
|
---|
378 | -filelist $(outbase).rsp\
|
---|
379 | $(foreach p,$(libpath), -L$(p))\
|
---|
380 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
|
---|
381 | ifeq ($(ld_debug),split)
|
---|
382 | $(QUIET)$(TOOL_GXX4MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
|
---|
383 | $(QUIET)$(TOOL_GXX4MACHO_STRIP_PROGRAM) $(out)
|
---|
384 | endif
|
---|
385 | endef
|
---|
386 |
|
---|
387 |
|
---|
388 | ## Link DLL
|
---|
389 | # @param $(target) Normalized main target name.
|
---|
390 | # @param $(out) Program name.
|
---|
391 | # @param $(objs) Object files to link together.
|
---|
392 | # @param $(libs) Libraries to search.
|
---|
393 | # @param $(libpath) Library search paths.
|
---|
394 | # @param $(flags) Flags.
|
---|
395 | # @param $(dirdep) Directory creation dependency.
|
---|
396 | # @param $(deps) Other dependencies.
|
---|
397 | # @param $(othersrc) Unhandled sources.
|
---|
398 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
399 | # @param $(custom_post) Custom step invoked after linking.
|
---|
400 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
401 | TOOL_GXX4MACHO_LINK_DLL_OUTPUT = $(outbase).rsp
|
---|
402 | TOOL_GXX4MACHO_LINK_DLL_OUTPUT_DEBUG = $(call TOOL_GXX4MACHO_DEBUG_BUNDLE_FN,$(out))
|
---|
403 | TOOL_GXX4MACHO_LINK_DLL_DEBUG_INSTALL_FN = $(TOOL_GXX4MACHO_DEBUG_INSTALL_FN)
|
---|
404 | TOOL_GXX4MACHO_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
|
---|
405 | TOOL_GXX4MACHO_LINK_DLL_DEPORD =
|
---|
406 | define TOOL_GXX4MACHO_LINK_DLL_CMDS
|
---|
407 | $(QUIET)$(APPEND) -n $(outbase).rsp $(filter-out %.h.gch,$(objs))
|
---|
408 | $(QUIET)$(TOOL_GXX4MACHO_LD) $(TOOL_GXX4MACHO_LDFLAGS.dll) $(flags) -o $(out)\
|
---|
409 | $(call TOOL_GXX4MACHO_LD_SONAME,$(target),$(out))\
|
---|
410 | -filelist $(outbase).rsp\
|
---|
411 | $(foreach p,$(libpath), -L$(p))\
|
---|
412 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
|
---|
413 | ifeq ($(ld_debug),split)
|
---|
414 | $(QUIET)$(TOOL_GXX4MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
|
---|
415 | $(QUIET)$(TOOL_GXX4MACHO_STRIP_DLL) $(out)
|
---|
416 | endif
|
---|
417 | endef
|
---|
418 |
|
---|
419 |
|
---|
420 | ## Link system module (windows aka driver, linux aka kernel module)
|
---|
421 | # @param $(target) Normalized main target name.
|
---|
422 | # @param $(out) System module name.
|
---|
423 | # @param $(objs) Object files to link together.
|
---|
424 | # @param $(libs) Libraries to search.
|
---|
425 | # @param $(libpath) Library search paths.
|
---|
426 | # @param $(flags) Flags.
|
---|
427 | # @param $(dirdep) Directory creation dependency.
|
---|
428 | # @param $(deps) Other dependencies.
|
---|
429 | # @param $(othersrc) Unhandled sources.
|
---|
430 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
431 | # @param $(custom_post) Custom step invoked after linking.
|
---|
432 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
433 | TOOL_GXX4MACHO_LINK_SYSMOD_OUTPUT = $(outbase).rsp
|
---|
434 | TOOL_GXX4MACHO_LINK_SYSMOD_OUTPUT_DEBUG = $(call TOOL_GXX4MACHO_DEBUG_BUNDLE_FN,$(out))
|
---|
435 | TOOL_GXX4MACHO_LINK_SYSMOD_DEBUG_INSTALL_FN = $(TOOL_GXX4MACHO_DEBUG_INSTALL_FN)
|
---|
436 | TOOL_GXX4MACHO_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
|
---|
437 | TOOL_GXX4MACHO_LINK_SYSMOD_DEPORD =
|
---|
438 | define TOOL_GXX4MACHO_LINK_SYSMOD_CMDS
|
---|
439 | $(QUIET)$(APPEND) -n $(outbase).rsp $(filter-out %.h.gch,$(objs))
|
---|
440 | $(QUIET)$(TOOL_GXX4MACHO_LD_SYSMOD) $(TOOL_GXX4MACHO_LDFLAGS.sysmod) $(flags) -o $(out)\
|
---|
441 | -filelist $(outbase).rsp\
|
---|
442 | $(foreach p,$(libpath), -L$(p))\
|
---|
443 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
|
---|
444 | ifeq ($(ld_debug),split)
|
---|
445 | $(QUIET)$(TOOL_GXX4MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
|
---|
446 | $(QUIET)$(TOOL_GXX4MACHO_STRIP_SYSMOD) $(out)
|
---|
447 | endif
|
---|
448 | endef
|
---|
449 |
|
---|