1 | # $Id: GCC32.kmk 3567 2022-06-26 20:00:02Z bird $
|
---|
2 | ## @file
|
---|
3 | # kBuild Tool Config - Generic 32-bit GCC v3.2.x or later Using The System GCC.
|
---|
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_GCC32 := Generic 32-bit GCC v3.2.x or later Using The System GCC. \
|
---|
35 | More or less Linux/ELF specfic.
|
---|
36 |
|
---|
37 | # Tool Specific Properties
|
---|
38 | ifndef TOOL_GCC32_PREFIX
|
---|
39 | TOOL_GCC32_PREFIX :=
|
---|
40 | endif
|
---|
41 | ifndef TOOL_GCC32_SUFFIX
|
---|
42 | TOOL_GCC32_SUFFIX := $(HOSTSUFF_EXE)
|
---|
43 | endif
|
---|
44 | if1of ($(KBUILD_HOST), solaris)
|
---|
45 | TOOL_GCC32_PREFIX2 ?= g
|
---|
46 | else
|
---|
47 | TOOL_GCC32_PREFIX2 ?=
|
---|
48 | endif
|
---|
49 | TOOL_GCC32_SUFFIX2 ?= $(HOSTSUFF_EXE)
|
---|
50 | TOOL_GCC32_PREFIX3 ?=
|
---|
51 | TOOL_GCC32_SUFFIX3 ?= $(HOSTSUFF_EXE)
|
---|
52 |
|
---|
53 | TOOL_GCC32_CC ?= $(TOOL_GCC32_PREFIX)gcc$(TOOL_GCC32_SUFFIX) -m32
|
---|
54 | TOOL_GCC32_CXX ?= $(TOOL_GCC32_PREFIX)g++$(TOOL_GCC32_SUFFIX) -m32
|
---|
55 | TOOL_GCC32_AS ?= $(TOOL_GCC32_PREFIX)gcc$(TOOL_GCC32_SUFFIX) -m32
|
---|
56 | TOOL_GCC32_AR ?= $(TOOL_GCC32_PREFIX2)ar$(TOOL_GCC32_SUFFIX2)
|
---|
57 | TOOL_GCC32_LD ?= $(TOOL_GCC32_PREFIX)gcc$(TOOL_GCC32_SUFFIX) -m32
|
---|
58 | if1of ($(KBUILD_HOST), solaris)
|
---|
59 | TOOL_GCC32_LD_SYSMOD ?= $(TOOL_GCC32_PREFIX3)ld$(TOOL_GCC32_SUFFIX3)
|
---|
60 | else
|
---|
61 | TOOL_GCC32_LD_SYSMOD ?= $(TOOL_GCC32_PREFIX2)ld$(TOOL_GCC32_SUFFIX2)
|
---|
62 | endif
|
---|
63 | ifndef TOOL_GCC32_LDFLAGS.$(KBUILD_TARGET)
|
---|
64 | TOOL_GCC32_LDFLAGS.dll ?= -shared
|
---|
65 | else
|
---|
66 | TOOL_GCC32_LDFLAGS.dll ?= $(TOOL_GCC32_LDFLAGS.$(KBUILD_TARGET))
|
---|
67 | endif
|
---|
68 | TOOL_GCC32_LDFLAGS.sysmod ?= -r -m elf_i386$(if-expr "$(KBUILD_TARGET)" == "freebsd" || "$(KBUILD_TARGET)" == "gnukfbsd",_fbsd,)
|
---|
69 | TOOL_GCC32_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
|
---|
70 | ifeq ($(KBUILD_TARGET),os2)
|
---|
71 | TOOL_GCC32_LD_MAP ?= -Zmap=$(1)
|
---|
72 | else
|
---|
73 | TOOL_GCC32_LD_MAP ?=
|
---|
74 | endif
|
---|
75 | ifeq ($(KBUILD_TARGET),os2)
|
---|
76 | TOOL_GCC32_LD_SYSMOD_MAP ?= -Zmap=$(1)
|
---|
77 | else
|
---|
78 | TOOL_GCC32_LD_SYSMOD_MAP ?=
|
---|
79 | endif
|
---|
80 | TOOL_GCC32_OBJCOPY ?= $(TOOL_GCC32_PREFIX2)objcopy$(TOOL_GCC32_SUFFIX2)
|
---|
81 |
|
---|
82 | # General Properties used by kBuild
|
---|
83 | TOOL_GCC32_COBJSUFF ?= .o
|
---|
84 | TOOL_GCC32_CFLAGS ?=
|
---|
85 | TOOL_GCC32_CFLAGS.debug ?= -g
|
---|
86 | TOOL_GCC32_CFLAGS.profile ?= -O2 #-g -pg
|
---|
87 | TOOL_GCC32_CFLAGS.release ?= -O2
|
---|
88 | TOOL_GCC32_CINCS ?=
|
---|
89 | TOOL_GCC32_CDEFS ?=
|
---|
90 |
|
---|
91 | TOOL_GCC32_CXXOBJSUFF ?= .o
|
---|
92 | TOOL_GCC32_CXXOBJSUFF ?= .o
|
---|
93 | TOOL_GCC32_CXXFLAGS ?=
|
---|
94 | TOOL_GCC32_CXXFLAGS.debug ?= -g
|
---|
95 | TOOL_GCC32_CXXFLAGS.profile ?= -O2 #-g -pg
|
---|
96 | TOOL_GCC32_CXXFLAGS.release ?= -O2
|
---|
97 | TOOL_GCC32_CXXINCS ?=
|
---|
98 | TOOL_GCC32_CXXDEFS ?=
|
---|
99 |
|
---|
100 | TOOL_GCC32_ASFLAGS ?= -x assembler-with-cpp
|
---|
101 | TOOL_GCC32_ASFLAGS.debug ?= -g
|
---|
102 | TOOL_GCC32_ASFLAGS.profile ?= -g
|
---|
103 | TOOL_GCC32_ASOBJSUFF ?= .o
|
---|
104 |
|
---|
105 | TOOL_GCC32_ARFLAGS ?= cr
|
---|
106 | TOOL_GCC32_ARLIBSUFF ?= .a
|
---|
107 |
|
---|
108 | TOOL_GCC32_LDFLAGS ?=
|
---|
109 | TOOL_GCC32_LDFLAGS.debug ?= -g
|
---|
110 | TOOL_GCC32_LDFLAGS.profile ?= -g
|
---|
111 |
|
---|
112 |
|
---|
113 | ## Compile C source.
|
---|
114 | # @param $(target) Normalized main target name.
|
---|
115 | # @param $(source) Source filename (relative).
|
---|
116 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
117 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
118 | # @param $(flags) Flags.
|
---|
119 | # @param $(defs) Definitions. No -D or something.
|
---|
120 | # @param $(incs) Includes. No -I or something.
|
---|
121 | # @param $(dirdep) Directory creation dependency.
|
---|
122 | # @param $(deps) Other dependencies.
|
---|
123 | #
|
---|
124 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
125 | # @param $(objsuff) Object suffix.
|
---|
126 | TOOL_GCC32_COMPILE_C_DEPEND =
|
---|
127 | TOOL_GCC32_COMPILE_C_DEPORD =
|
---|
128 | ifdef KBUILD_USE_KOBJCACHE
|
---|
129 | TOOL_GCC32_COMPILE_C_USES_KOBJCACHE = 1
|
---|
130 | TOOL_GCC32_COMPILE_C_OUTPUT = $(outbase).i
|
---|
131 | define TOOL_GCC32_COMPILE_C_CMDS
|
---|
132 | $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
|
---|
133 | --kObjCache-cpp $(outbase).i\
|
---|
134 | $(TOOL_GCC32_CC) -E -o -\
|
---|
135 | $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
136 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
137 | $(abspath $(source))\
|
---|
138 | --kObjCache-cc $(obj)\
|
---|
139 | $(TOOL_GCC32_CC) -c\
|
---|
140 | $(flags) -fpreprocessed -x c\
|
---|
141 | -o $(obj)\
|
---|
142 | -
|
---|
143 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
144 | endef
|
---|
145 | else # !KBUILD_USE_KOBJCACHE
|
---|
146 | TOOL_GCC32_COMPILE_C_OUTPUT =
|
---|
147 | define TOOL_GCC32_COMPILE_C_CMDS
|
---|
148 | $(QUIET)$(TOOL_GCC32_CC) -c\
|
---|
149 | $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
150 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
151 | -o $(obj)\
|
---|
152 | $(abspath $(source))
|
---|
153 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
154 | endef
|
---|
155 | endif # !KBUILD_USE_KOBJCACHE
|
---|
156 |
|
---|
157 |
|
---|
158 | ## Compile C++ source.
|
---|
159 | # @param $(target) Normalized main target name.
|
---|
160 | # @param $(source) Source filename (relative).
|
---|
161 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
162 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
163 | # @param $(flags) Flags.
|
---|
164 | # @param $(defs) Definitions. No -D or something.
|
---|
165 | # @param $(incs) Includes. No -I or something.
|
---|
166 | # @param $(dirdep) Directory creation dependency.
|
---|
167 | # @param $(deps) Other dependencies.
|
---|
168 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
169 | # @param $(objsuff) Object suffix.
|
---|
170 | TOOL_GCC32_COMPILE_CXX_DEPEND =
|
---|
171 | TOOL_GCC32_COMPILE_CXX_DEPORD =
|
---|
172 | ifdef KBUILD_USE_KOBJCACHE
|
---|
173 | TOOL_GCC32_COMPILE_CXX_USES_KOBJCACHE = 1
|
---|
174 | TOOL_GCC32_COMPILE_CXX_OUTPUT = $(outbase).ii
|
---|
175 | define TOOL_GCC32_COMPILE_CXX_CMDS
|
---|
176 | $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
|
---|
177 | --kObjCache-cpp $(outbase).ii\
|
---|
178 | $(TOOL_GCC32_CXX) -E -o -\
|
---|
179 | $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
180 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
181 | $(abspath $(source))\
|
---|
182 | --kObjCache-cc $(obj)\
|
---|
183 | $(TOOL_GCC32_CXX) -c\
|
---|
184 | $(flags) -fpreprocessed -x c++\
|
---|
185 | -o $(obj)\
|
---|
186 | -
|
---|
187 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
188 | endef
|
---|
189 | else # !KBUILD_USE_KOBJCACHE
|
---|
190 |
|
---|
191 | TOOL_GCC32_COMPILE_CXX_OUTPUT =
|
---|
192 | define TOOL_GCC32_COMPILE_CXX_CMDS
|
---|
193 | $(QUIET)$(TOOL_GCC32_CXX) -c\
|
---|
194 | $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
195 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
196 | -o $(obj)\
|
---|
197 | $(abspath $(source))
|
---|
198 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
199 | endef
|
---|
200 | endif # !KBUILD_USE_KOBJCACHE
|
---|
201 |
|
---|
202 |
|
---|
203 | ## Compile Assembly source.
|
---|
204 | # @param $(target) Normalized main target name.
|
---|
205 | # @param $(source) Source filename (relative).
|
---|
206 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
207 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
208 | # @param $(flags) Flags.
|
---|
209 | # @param $(defs) Definitions. No -D or something.
|
---|
210 | # @param $(incs) Includes. No -I or something.
|
---|
211 | # @param $(dirdep) Directory creation dependency.
|
---|
212 | # @param $(deps) Other dependencies.
|
---|
213 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
214 | # @param $(objsuff) Object suffix.
|
---|
215 | #
|
---|
216 | TOOL_GCC32_COMPILE_AS_OUTPUT =
|
---|
217 | TOOL_GCC32_COMPILE_AS_DEPEND =
|
---|
218 | TOOL_GCC32_COMPILE_AS_DEPORD =
|
---|
219 | define TOOL_GCC32_COMPILE_AS_CMDS
|
---|
220 | $(QUIET)$(TOOL_GCC32_AS) -c\
|
---|
221 | $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
222 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
223 | -o $(obj)\
|
---|
224 | $(abspath $(source))
|
---|
225 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
226 | endef
|
---|
227 |
|
---|
228 |
|
---|
229 | ## Link library
|
---|
230 | # @param $(target) Normalized main target name.
|
---|
231 | # @param $(out) Library name.
|
---|
232 | # @param $(objs) Object files to put in the library.
|
---|
233 | # @param $(flags) Flags.
|
---|
234 | # @param $(dirdep) Directory creation dependency.
|
---|
235 | # @param $(deps) Other dependencies.
|
---|
236 | # @param $(othersrc) Unhandled sources.
|
---|
237 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
238 | TOOL_GCC32_LINK_LIBRARY_OUTPUT = $(out).ar-script
|
---|
239 | TOOL_GCC32_LINK_LIBRARY_DEPEND = $(othersrc)
|
---|
240 | TOOL_GCC32_LINK_LIBRARY_DEPORD =
|
---|
241 | define TOOL_GCC32_LINK_LIBRARY_CMDS
|
---|
242 | $(QUIET)$(APPEND) $(out).ar-script 'CREATE $(out)'
|
---|
243 | $(QUIET)$(APPEND) -n $(out).ar-script \
|
---|
244 | $(foreach o,$(objs), 'ADDMOD $(o)') \
|
---|
245 | $(foreach o,$(filter-out %.def %.imp %.dll,$(othersrc)), 'ADDLIB $(o)')
|
---|
246 | $(if $(filter %.def %.imp %.dll,$(othersrc))\
|
---|
247 | ,$(TOOL_GCC32_AR_IMP) -o $(outbase).imp.a $(filter %.def %.imp %.dll,$(othersrc))\
|
---|
248 | $(NL)$(TAB)$(QUIET)$(APPEND) $(out).ar-script 'ADDLIB $(outbase).imp.a')
|
---|
249 | $(QUIET)$(APPEND) $(out).ar-script 'SAVE'
|
---|
250 | $(QUIET)$(APPEND) $(out).ar-script 'END'
|
---|
251 | $(QUIET)$(REDIRECT) -rti $(out).ar-script -- $(TOOL_GCC32_AR) -M
|
---|
252 | endef
|
---|
253 |
|
---|
254 |
|
---|
255 | ## Link program
|
---|
256 | # @param $(target) Normalized main target name.
|
---|
257 | # @param $(out) Program name.
|
---|
258 | # @param $(objs) Object files to link together.
|
---|
259 | # @param $(libs) Libraries to search.
|
---|
260 | # @param $(libpath) Library search paths.
|
---|
261 | # @param $(flags) Flags.
|
---|
262 | # @param $(dirdep) Directory creation dependency.
|
---|
263 | # @param $(deps) Other dependencies.
|
---|
264 | # @param $(othersrc) Unhandled sources.
|
---|
265 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
266 | # @param $(custom_post) Custom step invoked after linking.
|
---|
267 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
268 | TOOL_GCC32_LINK_PROGRAM_OUTPUT =
|
---|
269 | TOOL_GCC32_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).map
|
---|
270 | TOOL_GCC32_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).debug
|
---|
271 | TOOL_GCC32_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
|
---|
272 | TOOL_GCC32_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
|
---|
273 | $(filter %.def, $(othersrc))
|
---|
274 | TOOL_GCC32_LINK_PROGRAM_DEPORD =
|
---|
275 | define TOOL_GCC32_LINK_PROGRAM_CMDS
|
---|
276 | $(QUIET)$(TOOL_GCC32_LD) $(flags) -o $(out) $(objs)\
|
---|
277 | $(foreach p,$(libpath), -L$(p))\
|
---|
278 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
|
---|
279 | $(call TOOL_GCC32_LD_MAP,$(outbase).map)
|
---|
280 | ifeq ($(ld_debug),split)
|
---|
281 | $(QUIET)$(TOOL_GCC32_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
|
---|
282 | $(QUIET)$(CHMOD) a-x $(outbase).debug
|
---|
283 | $(QUIET)$(TOOL_GCC32_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
|
---|
284 | endif
|
---|
285 | endef
|
---|
286 |
|
---|
287 |
|
---|
288 | ## Link DLL
|
---|
289 | # @param $(target) Normalized main target name.
|
---|
290 | # @param $(out) Program name.
|
---|
291 | # @param $(objs) Object files to link together.
|
---|
292 | # @param $(libs) Libraries to search.
|
---|
293 | # @param $(libpath) Library search paths.
|
---|
294 | # @param $(flags) Flags.
|
---|
295 | # @param $(dirdep) Directory creation dependency.
|
---|
296 | # @param $(deps) Other dependencies.
|
---|
297 | # @param $(othersrc) Unhandled sources.
|
---|
298 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
299 | # @param $(custom_post) Custom step invoked after linking.
|
---|
300 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
301 | TOOL_GCC32_LINK_DLL_OUTPUT =
|
---|
302 | TOOL_GCC32_LINK_DLL_OUTPUT_MAYBE = $(outbase).map
|
---|
303 | TOOL_GCC32_LINK_DLL_OUTPUT_DEBUG = $(outbase).debug
|
---|
304 | TOOL_GCC32_LINK_DLL_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
|
---|
305 | TOOL_GCC32_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
|
---|
306 | $(filter %.def, $(othersrc))
|
---|
307 | TOOL_GCC32_LINK_DLL_DEPORD =
|
---|
308 | define TOOL_GCC32_LINK_DLL_CMDS
|
---|
309 | $(QUIET)$(TOOL_GCC32_LD) $(TOOL_GCC32_LDFLAGS.dll) $(flags) -o $(out)\
|
---|
310 | $(if $(filter-out win os2, $(KBUILD_TARGET)),$(call TOOL_GCC32_LD_SONAME,$(target),$(out)))\
|
---|
311 | $(objs)\
|
---|
312 | $(foreach p,$(libpath), -L$(p))\
|
---|
313 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
|
---|
314 | $(call TOOL_GCC32_LD_MAP,$(outbase).map)
|
---|
315 | ifeq ($(ld_debug),split)
|
---|
316 | $(QUIET)$(TOOL_GCC32_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
|
---|
317 | $(QUIET)$(CHMOD) a-x $(outbase).debug
|
---|
318 | $(QUIET)$(TOOL_GCC32_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
|
---|
319 | endif
|
---|
320 | endef
|
---|
321 |
|
---|
322 |
|
---|
323 | ## Link system module (windows aka driver, linux aka kernel module)
|
---|
324 | # @param $(target) Normalized main target name.
|
---|
325 | # @param $(out) System module name.
|
---|
326 | # @param $(objs) Object files to link together.
|
---|
327 | # @param $(libs) Libraries to search.
|
---|
328 | # @param $(libpath) Library search paths.
|
---|
329 | # @param $(flags) Flags.
|
---|
330 | # @param $(dirdep) Directory creation dependency.
|
---|
331 | # @param $(deps) Other dependencies.
|
---|
332 | # @param $(othersrc) Unhandled sources.
|
---|
333 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
334 | # @param $(custom_post) Custom step invoked after linking.
|
---|
335 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
336 | TOOL_GCC32_LINK_SYSMOD_OUTPUT =
|
---|
337 | TOOL_GCC32_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).map
|
---|
338 | TOOL_GCC32_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).debug
|
---|
339 | TOOL_GCC32_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
|
---|
340 | TOOL_GCC32_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
|
---|
341 | $(filter %.def, $(othersrc))
|
---|
342 | TOOL_GCC32_LINK_SYSMOD_DEPORD =
|
---|
343 | define TOOL_GCC32_LINK_SYSMOD_CMDS
|
---|
344 | $(QUIET)$(TOOL_GCC32_LD_SYSMOD) $(TOOL_GCC32_LDFLAGS.sysmod) $(flags) -o $(out) $(objs)\
|
---|
345 | $(filter %.def, $(othersrc))\
|
---|
346 | $(foreach p,$(libpath), -L$(p))\
|
---|
347 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
|
---|
348 | $(call TOOL_GCC32_LD_SYSMOD_MAP,$(outbase).map)
|
---|
349 | ifeq ($(ld_debug),split)
|
---|
350 | $(QUIET)$(TOOL_GCC32_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
|
---|
351 | $(QUIET)$(CHMOD) a-x $(outbase).debug
|
---|
352 | $(QUIET)$(TOOL_GCC32_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
|
---|
353 | endif
|
---|
354 | endef
|
---|
355 |
|
---|