1 | # $Id: GCC3.kmk 3393 2020-06-30 17:11:42Z bird $
|
---|
2 | ## @file
|
---|
3 | # kBuild Tool Config - Generic GCC v3.2.x or later Using The System GCC and Binutils.
|
---|
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_GCC3 := Generic GCC v3.2.x or later Using The System GCC and Binutils.
|
---|
35 |
|
---|
36 | # Tool Specific Properties
|
---|
37 | ifndef TOOL_GCC3_PREFIX
|
---|
38 | TOOL_GCC3_PREFIX :=
|
---|
39 | endif
|
---|
40 | ifndef TOOL_GCC3_SUFFIX
|
---|
41 | TOOL_GCC3_SUFFIX := $(HOSTSUFF_EXE)
|
---|
42 | endif
|
---|
43 | if1of ($(KBUILD_HOST), solaris)
|
---|
44 | TOOL_GCC3_PREFIX2 ?= g
|
---|
45 | else
|
---|
46 | TOOL_GCC3_PREFIX2 ?=
|
---|
47 | endif
|
---|
48 | TOOL_GCC3_SUFFIX2 ?= $(HOSTSUFF_EXE)
|
---|
49 | TOOL_GCC3_PREFIX3 ?=
|
---|
50 | TOOL_GCC3_SUFFIX3 ?= $(HOSTSUFF_EXE)
|
---|
51 | TOOL_GCC3_CC ?= $(TOOL_GCC3_PREFIX)gcc$(TOOL_GCC3_SUFFIX)
|
---|
52 | TOOL_GCC3_CXX ?= $(TOOL_GCC3_PREFIX)g++$(TOOL_GCC3_SUFFIX)
|
---|
53 | TOOL_GCC3_AS ?= $(TOOL_GCC3_PREFIX)gcc$(TOOL_GCC3_SUFFIX)
|
---|
54 | TOOL_GCC3_AR ?= $(TOOL_GCC3_PREFIX2)ar$(TOOL_GCC3_SUFFIX2)
|
---|
55 | ifeq ($(KBUILD_TARGET),os2)
|
---|
56 | TOOL_GCC3_AR_IMP ?= $(TOOL_GCC3_PREFIX3)emximp$(TOOL_GCC3_SUFFIX3)
|
---|
57 | else
|
---|
58 | TOOL_GCC3_AR_IMP ?= $(ECHO) not supported!
|
---|
59 | endif
|
---|
60 | TOOL_GCC3_LD ?= $(TOOL_GCC3_PREFIX)gcc$(TOOL_GCC3_SUFFIX)
|
---|
61 | if1of ($(KBUILD_HOST), solaris)
|
---|
62 | TOOL_GCC3_LD_SYSMOD ?= $(TOOL_GCC3_PREFIX3)ld$(TOOL_GCC3_SUFFIX3)
|
---|
63 | else
|
---|
64 | TOOL_GCC3_LD_SYSMOD ?= $(TOOL_GCC3_PREFIX2)ld$(TOOL_GCC3_SUFFIX2)
|
---|
65 | endif
|
---|
66 | ifndef TOOL_GCC3_LDFLAGS.$(KBUILD_TARGET)
|
---|
67 | TOOL_GCC3_LDFLAGS.dll ?= -shared
|
---|
68 | else
|
---|
69 | TOOL_GCC3_LDFLAGS.dll ?= $(TOOL_GCC3_LDFLAGS.$(KBUILD_TARGET))
|
---|
70 | endif
|
---|
71 | TOOL_GCC3_LDFLAGS.sysmod ?= -r
|
---|
72 | TOOL_GCC3_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
|
---|
73 | ifeq ($(KBUILD_TARGET),os2)
|
---|
74 | TOOL_GCC3_LD_MAP ?= -Zmap=$(1)
|
---|
75 | TOOL_GCC3_LD_SYSMOD_MAP ?= -Zmap=$(1)
|
---|
76 | else
|
---|
77 | TOOL_GCC3_LD_MAP ?=
|
---|
78 | TOOL_GCC3_LD_SYSMOD_MAP ?=
|
---|
79 | endif
|
---|
80 | TOOL_GCC3_OBJCOPY ?= $(TOOL_GCC3_PREFIX2)objcopy$(TOOL_GCC3_SUFFIX2)
|
---|
81 |
|
---|
82 | ifdef SLKRUNS
|
---|
83 | TOOL_GCC3_CC += -fmessage-length=0
|
---|
84 | TOOL_GCC3_CXX += -fmessage-length=0
|
---|
85 | endif
|
---|
86 |
|
---|
87 | # General Properties used by kBuild
|
---|
88 | TOOL_GCC3_COBJSUFF ?= .o
|
---|
89 | TOOL_GCC3_CFLAGS ?=
|
---|
90 | TOOL_GCC3_CFLAGS.debug ?= -g
|
---|
91 | TOOL_GCC3_CFLAGS.profile ?= -O2 #-g -pg
|
---|
92 | TOOL_GCC3_CFLAGS.release ?= -O2
|
---|
93 | TOOL_GCC3_CINCS ?=
|
---|
94 | TOOL_GCC3_CDEFS ?=
|
---|
95 |
|
---|
96 | TOOL_GCC3_CXXOBJSUFF ?= .o
|
---|
97 | TOOL_GCC3_CXXOBJSUFF ?= .o
|
---|
98 | TOOL_GCC3_CXXFLAGS ?=
|
---|
99 | TOOL_GCC3_CXXFLAGS.debug ?= -g
|
---|
100 | TOOL_GCC3_CXXFLAGS.profile ?= -O2 #-g -pg
|
---|
101 | TOOL_GCC3_CXXFLAGS.release ?= -O2
|
---|
102 | TOOL_GCC3_CXXINCS ?=
|
---|
103 | TOOL_GCC3_CXXDEFS ?=
|
---|
104 |
|
---|
105 | TOOL_GCC3_ASFLAGS ?= -x assembler-with-cpp
|
---|
106 | TOOL_GCC3_ASFLAGS.debug ?= -g
|
---|
107 | TOOL_GCC3_ASFLAGS.profile ?= -g
|
---|
108 | TOOL_GCC3_ASOBJSUFF ?= .o
|
---|
109 |
|
---|
110 | TOOL_GCC3_ARFLAGS ?= cr
|
---|
111 | TOOL_GCC3_ARLIBSUFF ?= .a
|
---|
112 |
|
---|
113 | TOOL_GCC3_LDFLAGS ?=
|
---|
114 | TOOL_GCC3_LDFLAGS.debug ?= -g
|
---|
115 | TOOL_GCC3_LDFLAGS.profile ?= -g
|
---|
116 |
|
---|
117 |
|
---|
118 | ## Compile C source.
|
---|
119 | # @param $(target) Normalized main target name.
|
---|
120 | # @param $(source) Source filename (relative).
|
---|
121 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
122 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
123 | # @param $(flags) Flags.
|
---|
124 | # @param $(defs) Definitions. No -D or something.
|
---|
125 | # @param $(incs) Includes. No -I or something.
|
---|
126 | # @param $(dirdep) Directory creation dependency.
|
---|
127 | # @param $(deps) Other dependencies.
|
---|
128 | #
|
---|
129 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
130 | # @param $(objsuff) Object suffix.
|
---|
131 | TOOL_GCC3_COMPILE_C_DEPEND =
|
---|
132 | TOOL_GCC3_COMPILE_C_DEPORD =
|
---|
133 | ifdef KBUILD_USE_KOBJCACHE
|
---|
134 | TOOL_GCC3_COMPILE_C_USES_KOBJCACHE = 1
|
---|
135 | TOOL_GCC3_COMPILE_C_OUTPUT = $(outbase).i
|
---|
136 | define TOOL_GCC3_COMPILE_C_CMDS
|
---|
137 | $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
|
---|
138 | --kObjCache-cpp $(outbase).i\
|
---|
139 | $(TOOL_GCC3_CC) -E -o -\
|
---|
140 | $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
|
---|
141 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
142 | $(abspath $(source))\
|
---|
143 | --kObjCache-cc $(obj)\
|
---|
144 | $(TOOL_GCC3_CC) -c\
|
---|
145 | $(flags) -fpreprocessed -x c\
|
---|
146 | -o $(obj)\
|
---|
147 | -
|
---|
148 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
149 | endef
|
---|
150 | else # !KBUILD_USE_KOBJCACHE
|
---|
151 | TOOL_GCC3_COMPILE_C_OUTPUT =
|
---|
152 | define TOOL_GCC3_COMPILE_C_CMDS
|
---|
153 | $(QUIET)$(TOOL_GCC3_CC) -c\
|
---|
154 | $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
|
---|
155 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
156 | -o $(obj)\
|
---|
157 | $(abspath $(source))
|
---|
158 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
159 | endef
|
---|
160 | endif # !KBUILD_USE_KOBJCACHE
|
---|
161 |
|
---|
162 |
|
---|
163 | ## Compile C++ source.
|
---|
164 | # @param $(target) Normalized main target name.
|
---|
165 | # @param $(source) Source filename (relative).
|
---|
166 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
167 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
168 | # @param $(flags) Flags.
|
---|
169 | # @param $(defs) Definitions. No -D or something.
|
---|
170 | # @param $(incs) Includes. No -I or something.
|
---|
171 | # @param $(dirdep) Directory creation dependency.
|
---|
172 | # @param $(deps) Other dependencies.
|
---|
173 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
174 | # @param $(objsuff) Object suffix.
|
---|
175 | TOOL_GCC3_COMPILE_CXX_DEPEND =
|
---|
176 | TOOL_GCC3_COMPILE_CXX_DEPORD =
|
---|
177 | ifdef KBUILD_USE_KOBJCACHE
|
---|
178 | TOOL_GCC3_COMPILE_CXX_USES_KOBJCACHE = 1
|
---|
179 | TOOL_GCC3_COMPILE_CXX_OUTPUT = $(outbase).ii
|
---|
180 | define TOOL_GCC3_COMPILE_CXX_CMDS
|
---|
181 | $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
|
---|
182 | --kObjCache-cpp $(outbase).ii\
|
---|
183 | $(TOOL_GCC3_CXX) -E -o -\
|
---|
184 | $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
|
---|
185 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
186 | $(abspath $(source))\
|
---|
187 | --kObjCache-cc $(obj)\
|
---|
188 | $(TOOL_GCC3_CXX) -c\
|
---|
189 | $(flags) -fpreprocessed -x c++\
|
---|
190 | -o $(obj)\
|
---|
191 | -
|
---|
192 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
193 | endef
|
---|
194 | else # !KBUILD_USE_KOBJCACHE
|
---|
195 | TOOL_GCC3_COMPILE_CXX_OUTPUT =
|
---|
196 | define TOOL_GCC3_COMPILE_CXX_CMDS
|
---|
197 | $(QUIET)$(TOOL_GCC3_CXX) -c\
|
---|
198 | $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
|
---|
199 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
200 | -o $(obj)\
|
---|
201 | $(abspath $(source))
|
---|
202 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
203 | endef
|
---|
204 | endif # !KBUILD_USE_KOBJCACHE
|
---|
205 |
|
---|
206 |
|
---|
207 | ## Compile Assembly source.
|
---|
208 | # @param $(target) Normalized main target name.
|
---|
209 | # @param $(source) Source filename (relative).
|
---|
210 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
211 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
212 | # @param $(flags) Flags.
|
---|
213 | # @param $(defs) Definitions. No -D or something.
|
---|
214 | # @param $(incs) Includes. No -I or something.
|
---|
215 | # @param $(dirdep) Directory creation dependency.
|
---|
216 | # @param $(deps) Other dependencies.
|
---|
217 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
218 | # @param $(objsuff) Object suffix.
|
---|
219 | #
|
---|
220 | TOOL_GCC3_COMPILE_AS_OUTPUT =
|
---|
221 | TOOL_GCC3_COMPILE_AS_DEPEND =
|
---|
222 | TOOL_GCC3_COMPILE_AS_DEPORD =
|
---|
223 | define TOOL_GCC3_COMPILE_AS_CMDS
|
---|
224 | $(QUIET)$(TOOL_GCC3_AS) -c\
|
---|
225 | $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
|
---|
226 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
227 | -o $(obj)\
|
---|
228 | $(abspath $(source))
|
---|
229 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
230 | endef
|
---|
231 |
|
---|
232 |
|
---|
233 | ## Link library
|
---|
234 | # @param $(target) Normalized main target name.
|
---|
235 | # @param $(out) Library name.
|
---|
236 | # @param $(objs) Object files to put in the library.
|
---|
237 | # @param $(flags) Flags.
|
---|
238 | # @param $(dirdep) Directory creation dependency.
|
---|
239 | # @param $(deps) Other dependencies.
|
---|
240 | # @param $(othersrc) Unhandled sources.
|
---|
241 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
242 | TOOL_GCC3_LINK_LIBRARY_OUTPUT = $(out).ar-script
|
---|
243 | TOOL_GCC3_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).imp.a
|
---|
244 | TOOL_GCC3_LINK_LIBRARY_DEPEND = $(othersrc)
|
---|
245 | TOOL_GCC3_LINK_LIBRARY_DEPORD =
|
---|
246 | define TOOL_GCC3_LINK_LIBRARY_CMDS
|
---|
247 | $(QUIET)$(APPEND) $(out).ar-script 'CREATE $(out)'
|
---|
248 | $(QUIET)$(APPEND) -n $(out).ar-script \
|
---|
249 | $(foreach o,$(objs), 'ADDMOD $(o)') \
|
---|
250 | $(foreach o,$(filter-out %.def %.imp %.dll,$(othersrc)), 'ADDLIB $(o)')
|
---|
251 | $(if $(filter %.def %.imp %.dll,$(othersrc))\
|
---|
252 | ,$(TOOL_GCC3_AR_IMP) -o $(outbase).imp.a $(filter %.def %.imp %.dll,$(othersrc))\
|
---|
253 | $(NL)$(TAB)$(QUIET)$(APPEND) $(out).ar-script 'ADDLIB $(outbase).imp.a')
|
---|
254 | $(QUIET)$(APPEND) $(out).ar-script 'SAVE'
|
---|
255 | $(QUIET)$(APPEND) $(out).ar-script 'END'
|
---|
256 | $(QUIET)$(REDIRECT) -rti $(out).ar-script -- $(TOOL_GCC3_AR) -M
|
---|
257 | endef
|
---|
258 |
|
---|
259 |
|
---|
260 | ## Link program
|
---|
261 | # @param $(target) Normalized main target name.
|
---|
262 | # @param $(out) Program name.
|
---|
263 | # @param $(objs) Object files to link together.
|
---|
264 | # @param $(libs) Libraries to search.
|
---|
265 | # @param $(libpath) Library search paths.
|
---|
266 | # @param $(flags) Flags.
|
---|
267 | # @param $(dirdep) Directory creation dependency.
|
---|
268 | # @param $(deps) Other dependencies.
|
---|
269 | # @param $(othersrc) Unhandled sources.
|
---|
270 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
271 | # @param $(custom_post) Custom step invoked after linking.
|
---|
272 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
273 | TOOL_GCC3_LINK_PROGRAM_OUTPUT =
|
---|
274 | TOOL_GCC3_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).map
|
---|
275 | TOOL_GCC3_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).debug
|
---|
276 | TOOL_GCC3_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
|
---|
277 | TOOL_GCC3_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
|
---|
278 | $(filter %.def, $(othersrc))
|
---|
279 | TOOL_GCC3_LINK_PROGRAM_DEPORD =
|
---|
280 | define TOOL_GCC3_LINK_PROGRAM_CMDS
|
---|
281 | $(QUIET)$(TOOL_GCC3_LD) $(flags) -o $(out) $(objs)\
|
---|
282 | $(filter %.def, $(othersrc))\
|
---|
283 | $(foreach p,$(libpath), -L$(p))\
|
---|
284 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
|
---|
285 | $(call TOOL_GCC3_LD_MAP,$(outbase).map)
|
---|
286 | ifeq ($(ld_debug),split)
|
---|
287 | $(QUIET)$(TOOL_GCC3_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
|
---|
288 | $(QUIET)$(CHMOD) a-x $(outbase).debug
|
---|
289 | $(QUIET)$(TOOL_GCC3_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
|
---|
290 | endif
|
---|
291 | endef
|
---|
292 |
|
---|
293 |
|
---|
294 | ## Link DLL
|
---|
295 | # @param $(target) Normalized main target name.
|
---|
296 | # @param $(out) Program name.
|
---|
297 | # @param $(objs) Object files to link together.
|
---|
298 | # @param $(libs) Libraries to search.
|
---|
299 | # @param $(libpath) Library search paths.
|
---|
300 | # @param $(flags) Flags.
|
---|
301 | # @param $(dirdep) Directory creation dependency.
|
---|
302 | # @param $(deps) Other dependencies.
|
---|
303 | # @param $(othersrc) Unhandled sources.
|
---|
304 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
305 | # @param $(custom_post) Custom step invoked after linking.
|
---|
306 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
307 | TOOL_GCC3_LINK_DLL_OUTPUT =
|
---|
308 | TOOL_GCC3_LINK_DLL_OUTPUT_MAYBE = $(outbase).map
|
---|
309 | TOOL_GCC3_LINK_DLL_OUTPUT_DEBUG = $(outbase).debug
|
---|
310 | TOOL_GCC3_LINK_DLL_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
|
---|
311 | TOOL_GCC3_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
|
---|
312 | $(filter %.def, $(othersrc))
|
---|
313 | TOOL_GCC3_LINK_DLL_DEPORD =
|
---|
314 | define TOOL_GCC3_LINK_DLL_CMDS
|
---|
315 | $(QUIET)$(TOOL_GCC3_LD) $(TOOL_GCC3_LDFLAGS.dll) $(flags) -o $(out)\
|
---|
316 | $(if $(filter-out win os2, $(KBUILD_TARGET)),$(call TOOL_GCC3_LD_SONAME,$(target),$(out)))\
|
---|
317 | $(objs)\
|
---|
318 | $(filter %.def, $(othersrc))\
|
---|
319 | $(foreach p,$(libpath), -L$(p))\
|
---|
320 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
|
---|
321 | $(call TOOL_GCC3_LD_MAP,$(outbase).map)
|
---|
322 | ifeq ($(ld_debug),split)
|
---|
323 | $(QUIET)$(TOOL_GCC3_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
|
---|
324 | $(QUIET)$(CHMOD) a-x $(outbase).debug
|
---|
325 | $(QUIET)$(TOOL_GCC3_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
|
---|
326 | endif
|
---|
327 | endef
|
---|
328 |
|
---|
329 |
|
---|
330 | ## Link system module (windows aka driver, linux aka kernel module)
|
---|
331 | # @param $(target) Normalized main target name.
|
---|
332 | # @param $(out) System module name.
|
---|
333 | # @param $(objs) Object files to link together.
|
---|
334 | # @param $(libs) Libraries to search.
|
---|
335 | # @param $(libpath) Library search paths.
|
---|
336 | # @param $(flags) Flags.
|
---|
337 | # @param $(dirdep) Directory creation dependency.
|
---|
338 | # @param $(deps) Other dependencies.
|
---|
339 | # @param $(othersrc) Unhandled sources.
|
---|
340 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
341 | # @param $(custom_post) Custom step invoked after linking.
|
---|
342 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
343 | TOOL_GCC3_LINK_SYSMOD_OUTPUT =
|
---|
344 | TOOL_GCC3_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).map
|
---|
345 | TOOL_GCC3_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).debug
|
---|
346 | TOOL_GCC3_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
|
---|
347 | TOOL_GCC3_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
|
---|
348 | $(filter %.def, $(othersrc))
|
---|
349 | TOOL_GCC3_LINK_SYSMOD_DEPORD =
|
---|
350 | define TOOL_GCC3_LINK_SYSMOD_CMDS
|
---|
351 | $(QUIET)$(TOOL_GCC3_LD_SYSMOD) $(TOOL_GCC3_LDFLAGS.sysmod) $(flags) -o $(out) $(objs)\
|
---|
352 | $(filter %.def, $(othersrc))\
|
---|
353 | $(foreach p,$(libpath), -L$(p))\
|
---|
354 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
|
---|
355 | $(call TOOL_GCC3_LD_SYSMOD_MAP,$(outbase).map)
|
---|
356 | ifeq ($(ld_debug),split)
|
---|
357 | $(QUIET)$(TOOL_GCC3_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
|
---|
358 | $(QUIET)$(CHMOD) a-x $(outbase).debug
|
---|
359 | $(QUIET)$(TOOL_GCC3_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
|
---|
360 | endif
|
---|
361 | endef
|
---|
362 |
|
---|