1 | # $Id: GXX3PLAIN.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, any Unix linker and Unix archiver to build 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_GXX3PLAIN := Generic GCC v3.2.x or later using the system GCC, any Unix linker and Unix archiver to build C++ code.
|
---|
35 |
|
---|
36 | # Tool Specific Properties
|
---|
37 | ifndef TOOL_GXX3PLAIN_PREFIX
|
---|
38 | TOOL_GXX3PLAIN_PREFIX :=
|
---|
39 | endif
|
---|
40 | ifndef TOOL_GXX3PLAIN_SUFFIX
|
---|
41 | TOOL_GXX3PLAIN_SUFFIX := $(HOSTSUFF_EXE)
|
---|
42 | endif
|
---|
43 | TOOL_GXX3PLAIN_PREFIX2 ?=
|
---|
44 | TOOL_GXX3PLAIN_SUFFIX2 ?= $(HOSTSUFF_EXE)
|
---|
45 | TOOL_GXX3PLAIN_CC ?= $(TOOL_GXX3PLAIN_PREFIX)gcc$(TOOL_GXX3PLAIN_SUFFIX)
|
---|
46 | TOOL_GXX3PLAIN_CXX ?= $(TOOL_GXX3PLAIN_PREFIX)g++$(TOOL_GXX3PLAIN_SUFFIX)
|
---|
47 | TOOL_GXX3PLAIN_PCH ?= $(TOOL_GXX3PLAIN_CXX)
|
---|
48 | TOOL_GXX3PLAIN_AS ?= $(TOOL_GXX3PLAIN_PREFIX)gcc$(TOOL_GXX3PLAIN_SUFFIX)
|
---|
49 | TOOL_GXX3PLAIN_AR ?= $(TOOL_GXX3PLAIN_PREFIX2)ar$(TOOL_GXX3PLAIN_SUFFIX2)
|
---|
50 | TOOL_GXX3PLAIN_RANLIB ?= $(TOOL_GXX3PLAIN_PREFIX2)ranlib$(TOOL_GXX3PLAIN_SUFFIX2)
|
---|
51 | TOOL_GXX3PLAIN_LD ?= $(TOOL_GXX3PLAIN_PREFIX)g++$(TOOL_GXX3PLAIN_SUFFIX)
|
---|
52 | TOOL_GXX3PLAIN_LD_SYSMOD ?= $(TOOL_GXX3PLAIN_PREFIX2)ld$(TOOL_GXX3PLAIN_SUFFIX2)
|
---|
53 | TOOL_GXX3PLAIN_LD_SYSMOD.os2 ?= $(TOOL_GXX3PLAIN_PREFIX)g++$(TOOL_GXX3PLAIN_SUFFIX)
|
---|
54 | TOOL_GXX3PLAIN_LDFLAGS.dll.os2 ?= -Zdll
|
---|
55 | TOOL_GXX3PLAIN_LDFLAGS.dll.darwin ?= -dynamiclib
|
---|
56 | ifndef TOOL_GXX3PLAIN_LDFLAGS.$(KBUILD_TARGET)
|
---|
57 | TOOL_GXX3PLAIN_LDFLAGS.dll ?= -shared
|
---|
58 | else
|
---|
59 | TOOL_GXX3PLAIN_LDFLAGS.dll ?= $(TOOL_GXX3PLAIN_LDFLAGS.$(KBUILD_TARGET))
|
---|
60 | endif
|
---|
61 | TOOL_GXX3PLAIN_LD_SONAME.darwin ?= $(NO_SUCH_VARIABLE)
|
---|
62 | TOOL_GXX3PLAIN_LD_SONAME.os2 ?= $(NO_SUCH_VARIABLE)
|
---|
63 | TOOL_GXX3PLAIN_LD_SONAME.solaris ?= -Wl,-h,$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
|
---|
64 | TOOL_GXX3PLAIN_LD_SONAME.win ?= $(NO_SUCH_VARIABLE)
|
---|
65 | ifndef TOOL_GXX3PLAIN_LD_SONAME.$(KBUILD_TARGET)
|
---|
66 | TOOL_GXX3PLAIN_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
|
---|
67 | else
|
---|
68 | TOOL_GXX3PLAIN_LD_SONAME ?= $(TOOL_GXX3PLAIN_LD_SONAME.$(KBUILD_TARGET))
|
---|
69 | endif
|
---|
70 | ifdef SLKRUNS
|
---|
71 | TOOL_GXX3PLAIN_CC += -fmessage-length=0
|
---|
72 | TOOL_GXX3PLAIN_CXX += -fmessage-length=0
|
---|
73 | endif
|
---|
74 |
|
---|
75 | # General Properties used by kBuild
|
---|
76 | TOOL_GXX3PLAIN_COBJSUFF ?= .o
|
---|
77 | TOOL_GXX3PLAIN_CFLAGS ?=
|
---|
78 | TOOL_GXX3PLAIN_CFLAGS.debug ?= -g
|
---|
79 | TOOL_GXX3PLAIN_CFLAGS.profile ?= -O2 #-g -pg
|
---|
80 | TOOL_GXX3PLAIN_CFLAGS.release ?= -O2
|
---|
81 | TOOL_GXX3PLAIN_CINCS ?=
|
---|
82 | TOOL_GXX3PLAIN_CDEFS ?=
|
---|
83 |
|
---|
84 | TOOL_GXX3PLAIN_CXXOBJSUFF ?= .o
|
---|
85 | TOOL_GXX3PLAIN_CXXFLAGS ?=
|
---|
86 | TOOL_GXX3PLAIN_CXXFLAGS.debug ?= -g
|
---|
87 | TOOL_GXX3PLAIN_CXXFLAGS.profile ?= -O2 #-g -pg
|
---|
88 | TOOL_GXX3PLAIN_CXXFLAGS.release ?= -O2
|
---|
89 | TOOL_GXX3PLAIN_CXXINCS ?=
|
---|
90 | TOOL_GXX3PLAIN_CXXDEFS ?=
|
---|
91 |
|
---|
92 | TOOL_GXX3PLAIN_PCHOBJSUFF ?= .h.gch
|
---|
93 | TOOL_GXX3PLAIN_PCHFLAGS ?= $(TOOL_GXX3PLAIN_CXXFLAGS)
|
---|
94 | TOOL_GXX3PLAIN_PCHFLAGS.debug ?= $(TOOL_GXX3PLAIN_CXXFLAGS.debug)
|
---|
95 | TOOL_GXX3PLAIN_PCHFLAGS.profile ?= $(TOOL_GXX3PLAIN_CXXFLAGS.profile)
|
---|
96 | TOOL_GXX3PLAIN_PCHFLAGS.release ?= $(TOOL_GXX3PLAIN_CXXFLAGS.release)
|
---|
97 | TOOL_GXX3PLAIN_PCHINCS ?= $(TOOL_GXX3PLAIN_CXXINCS)
|
---|
98 | TOOL_GXX3PLAIN_PCHDEFS ?= $(TOOL_GXX3PLAIN_CXXDEFS)
|
---|
99 |
|
---|
100 | TOOL_GXX3PLAIN_ASFLAGS ?= -x assembler-with-cpp
|
---|
101 | TOOL_GXX3PLAIN_ASFLAGS.debug ?= -g
|
---|
102 | TOOL_GXX3PLAIN_ASFLAGS.profile ?= -g
|
---|
103 | TOOL_GXX3PLAIN_ASOBJSUFF ?= .o
|
---|
104 |
|
---|
105 | TOOL_GXX3PLAIN_ARFLAGS ?= cr
|
---|
106 | TOOL_GXX3PLAIN_ARLIBSUFF ?= .a
|
---|
107 |
|
---|
108 | TOOL_GXX3PLAIN_LDFLAGS ?=
|
---|
109 |
|
---|
110 |
|
---|
111 | ## Compile C source.
|
---|
112 | # @param $(target) Normalized main target name.
|
---|
113 | # @param $(source) Source filename (relative).
|
---|
114 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
115 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
116 | # @param $(flags) Flags.
|
---|
117 | # @param $(defs) Definitions. No -D or something.
|
---|
118 | # @param $(incs) Includes. No -I or something.
|
---|
119 | # @param $(dirdep) Directory creation dependency.
|
---|
120 | # @param $(deps) Other dependencies.
|
---|
121 | #
|
---|
122 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
123 | # @param $(objsuff) Object suffix.
|
---|
124 | TOOL_GXX3PLAIN_COMPILE_C_DEPEND =
|
---|
125 | TOOL_GXX3PLAIN_COMPILE_C_DEPORD =
|
---|
126 | TOOL_GXX3PLAIN_COMPILE_C_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).i,)
|
---|
127 | TOOL_GXX3PLAIN_COMPILE_C_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
|
---|
128 | define TOOL_GXX3PLAIN_COMPILE_C_CMDS
|
---|
129 | if "$(use_objcache)" != ""
|
---|
130 | $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
|
---|
131 | --kObjCache-cpp $(outbase).i\
|
---|
132 | $(TOOL_GXX3PLAIN_CC) -E -o -\
|
---|
133 | $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
|
---|
134 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
135 | $(abspath $(source))\
|
---|
136 | --kObjCache-cc $(obj)\
|
---|
137 | $(TOOL_GXX3PLAIN_CC) -c\
|
---|
138 | $(flags) -fpreprocessed -x c\
|
---|
139 | -o $(obj)\
|
---|
140 | -
|
---|
141 | else
|
---|
142 | $(QUIET)$(TOOL_GXX3PLAIN_CC) -c\
|
---|
143 | $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
|
---|
144 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
145 | -o $(obj)\
|
---|
146 | $(abspath $(source))
|
---|
147 | endif
|
---|
148 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
149 | endef
|
---|
150 |
|
---|
151 |
|
---|
152 | ## Compile C++ source.
|
---|
153 | # @param $(target) Normalized main target name.
|
---|
154 | # @param $(source) Source filename (relative).
|
---|
155 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
156 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
157 | # @param $(flags) Flags.
|
---|
158 | # @param $(defs) Definitions. No -D or something.
|
---|
159 | # @param $(incs) Includes. No -I or something.
|
---|
160 | # @param $(dirdep) Directory creation dependency.
|
---|
161 | # @param $(deps) Other dependencies.
|
---|
162 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
163 | # @param $(objsuff) Object suffix.
|
---|
164 | TOOL_GXX3PLAIN_COMPILE_CXX_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).ii,)
|
---|
165 | TOOL_GXX3PLAIN_COMPILE_CXX_DEPEND = $($(target)_1_GCC_PCH_FILE)
|
---|
166 | TOOL_GXX3PLAIN_COMPILE_CXX_DEPORD =
|
---|
167 | TOOL_GXX3PLAIN_COMPILE_CXX_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
|
---|
168 | define TOOL_GXX3PLAIN_COMPILE_CXX_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).ii\
|
---|
172 | $(TOOL_GXX3PLAIN_CXX) -E -o - $(if-expr defined($(target)_PCH_HDR)\
|
---|
173 | ,-fpch-preprocess -Winvalid-pch -I$($(target)_1_GCC_PCH_DIR) -include $(basename $($(target)_1_GCC_PCH_FILE)),)\
|
---|
174 | $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
|
---|
175 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
176 | $(abspath $(source))\
|
---|
177 | --kObjCache-cc $(obj)\
|
---|
178 | $(TOOL_GXX3PLAIN_CXX) -c\
|
---|
179 | $(flags) -fpreprocessed $(if-expr defined($(target)_PCH_HDR),-fpch-preprocess,) -x c++\
|
---|
180 | -o $(obj)\
|
---|
181 | -
|
---|
182 | else
|
---|
183 | $(QUIET)$(TOOL_GXX3PLAIN_CXX) -c\
|
---|
184 | $(flags) $(addprefix -I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(addprefix -D, $(defs))\
|
---|
185 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
186 | -o $(obj) $(if-expr defined($(target)_PCH_HDR) \
|
---|
187 | ,-Winvalid-pch -include $(basename $($(target)_1_GCC_PCH_FILE)),) \
|
---|
188 | $(abspath $(source))
|
---|
189 | endif
|
---|
190 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
191 | endef
|
---|
192 |
|
---|
193 |
|
---|
194 | ## Precompile C++ header.
|
---|
195 | # @param $(target) Normalized main target name.
|
---|
196 | # @param $(source) Source filename (relative).
|
---|
197 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
198 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
199 | # @param $(flags) Flags.
|
---|
200 | # @param $(defs) Definitions. No -D or something.
|
---|
201 | # @param $(incs) Includes. No -I or something.
|
---|
202 | # @param $(dirdep) Directory creation dependency.
|
---|
203 | # @param $(deps) Other dependencies.
|
---|
204 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
205 | # @param $(objsuff) Object suffix.
|
---|
206 | TOOL_GXX3PLAIN_COMPILE_PCH_OUTPUT = $($(target)_1_GCC_PCH_FILE)
|
---|
207 | TOOL_GXX3PLAIN_COMPILE_PCH_DEPEND =
|
---|
208 | TOOL_GXX3PLAIN_COMPILE_PCH_DEPORD = $($(target)_1_GCC_PCH_DIR)
|
---|
209 | define TOOL_GXX3PLAIN_COMPILE_PCH_CMDS
|
---|
210 | $(QUIET)$(TOOL_GXX3PLAIN_PCH) -c\
|
---|
211 | $(flags) $(addprefix -I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(addprefix -D, $(defs))\
|
---|
212 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
213 | -o $(obj)\
|
---|
214 | $(abspath $(source))
|
---|
215 | $(INSTALL) --hard-link-files-when-possible -m 0644 -- "$(obj)" "$($(target)_1_GCC_PCH_FILE)"
|
---|
216 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
217 | endef
|
---|
218 |
|
---|
219 |
|
---|
220 | ## Compile Assembly source.
|
---|
221 | # @param $(target) Normalized main target name.
|
---|
222 | # @param $(source) Source filename (relative).
|
---|
223 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
224 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
225 | # @param $(flags) Flags.
|
---|
226 | # @param $(defs) Definitions. No -D or something.
|
---|
227 | # @param $(incs) Includes. No -I or something.
|
---|
228 | # @param $(dirdep) Directory creation dependency.
|
---|
229 | # @param $(deps) Other dependencies.
|
---|
230 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
231 | # @param $(objsuff) Object suffix.
|
---|
232 | #
|
---|
233 | TOOL_GXX3PLAIN_COMPILE_AS_OUTPUT =
|
---|
234 | TOOL_GXX3PLAIN_COMPILE_AS_DEPEND =
|
---|
235 | TOOL_GXX3PLAIN_COMPILE_AS_DEPORD =
|
---|
236 | define TOOL_GXX3PLAIN_COMPILE_AS_CMDS
|
---|
237 | $(QUIET)$(TOOL_GXX3PLAIN_AS) -c\
|
---|
238 | $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
|
---|
239 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
240 | -o $(obj)\
|
---|
241 | $(abspath $(source))
|
---|
242 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
243 | endef
|
---|
244 |
|
---|
245 |
|
---|
246 | ## Link library
|
---|
247 | # @param $(target) Normalized main target name.
|
---|
248 | # @param $(out) Library name.
|
---|
249 | # @param $(objs) Object files to put in the library.
|
---|
250 | # @param $(flags) Flags.
|
---|
251 | # @param $(dirdep) Directory creation dependency.
|
---|
252 | # @param $(deps) Other dependencies.
|
---|
253 | # @param $(othersrc) Unhandled sources.
|
---|
254 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
255 | TOOL_GXX3PLAIN_LINK_LIBRARY_OUTPUT =
|
---|
256 | TOOL_GXX3PLAIN_LINK_LIBRARY_DEPEND = $(othersrc)
|
---|
257 | TOOL_GXX3PLAIN_LINK_LIBRARY_DEPORD =
|
---|
258 | define TOOL_GXX3PLAIN_LINK_LIBRARY_CMDS
|
---|
259 | $(call xargs,$(QUIET)$(TOOL_GXX3PLAIN_AR) $(flags) $(out),$(filter-out %.h.gch,$(objs)))
|
---|
260 | $(foreach lib,$(othersrc)\
|
---|
261 | ,$(NL)$(TAB)$(call MSG_AR_MERGE,$(target),$(out),$(lib)) \
|
---|
262 | $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))ar.tmp.dir/* \
|
---|
263 | $(NL)$(TAB)$(QUIET)$(MKDIR) -p $(dir $(outbase))/ar.tmp.dir/ \
|
---|
264 | $(NL)$(TAB)$(QUIET)(cd $(dir $(outbase))ar.tmp.dir/ \
|
---|
265 | && $(TOOL_GXX3PLAIN_AR) x $(abspath $(lib)) \
|
---|
266 | && $(TOOL_GXX3PLAIN_AR) $(flags) $(out) *) \
|
---|
267 | $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))/ar.tmp.dir/* \
|
---|
268 | $(NL)$(TAB)$(QUIET)$(RMDIR) $(dir $(outbase))ar.tmp.dir/)
|
---|
269 | $(QUIET)$(TOOL_GXX3PLAIN_RANLIB) $(out)
|
---|
270 | endef
|
---|
271 |
|
---|
272 |
|
---|
273 | ## Link program
|
---|
274 | # @param $(target) Normalized main target name.
|
---|
275 | # @param $(out) Program name.
|
---|
276 | # @param $(objs) Object files to link together.
|
---|
277 | # @param $(libs) Libraries to search.
|
---|
278 | # @param $(libpath) Library search paths.
|
---|
279 | # @param $(flags) Flags.
|
---|
280 | # @param $(dirdep) Directory creation dependency.
|
---|
281 | # @param $(deps) Other dependencies.
|
---|
282 | # @param $(othersrc) Unhandled sources.
|
---|
283 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
284 | # @param $(custom_post) Custom step invoked after linking.
|
---|
285 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
286 | TOOL_GXX3PLAIN_LINK_PROGRAM_OUTPUT =
|
---|
287 | TOOL_GXX3PLAIN_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).map
|
---|
288 | TOOL_GXX3PLAIN_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
|
---|
289 | $(filter %.def, $(othersrc))
|
---|
290 | TOOL_GXX3PLAIN_LINK_PROGRAM_DEPORD =
|
---|
291 | define TOOL_GXX3PLAIN_LINK_PROGRAM_CMDS
|
---|
292 | $(QUIET)$(TOOL_GXX3PLAIN_LD) $(flags) -o $(out) $(filter-out %.h.gch,$(objs))\
|
---|
293 | $(filter %.def, $(othersrc))\
|
---|
294 | $(foreach p,$(libpath), -L$(p))\
|
---|
295 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
|
---|
296 | endef
|
---|
297 |
|
---|
298 |
|
---|
299 | ## Link DLL
|
---|
300 | # @param $(target) Normalized main target name.
|
---|
301 | # @param $(out) Program name.
|
---|
302 | # @param $(objs) Object files to link together.
|
---|
303 | # @param $(libs) Libraries to search.
|
---|
304 | # @param $(libpath) Library search paths.
|
---|
305 | # @param $(flags) Flags.
|
---|
306 | # @param $(dirdep) Directory creation dependency.
|
---|
307 | # @param $(deps) Other dependencies.
|
---|
308 | # @param $(othersrc) Unhandled sources.
|
---|
309 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
310 | # @param $(custom_post) Custom step invoked after linking.
|
---|
311 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
312 | TOOL_GXX3PLAIN_LINK_DLL_OUTPUT =
|
---|
313 | TOOL_GXX3PLAIN_LINK_DLL_OUTPUT_MAYBE = $(outbase).map
|
---|
314 | TOOL_GXX3PLAIN_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
|
---|
315 | $(filter %.def, $(othersrc))
|
---|
316 | TOOL_GXX3PLAIN_LINK_DLL_DEPORD =
|
---|
317 | define TOOL_GXX3PLAIN_LINK_DLL_CMDS
|
---|
318 | $(QUIET)$(TOOL_GXX3PLAIN_LD) $(TOOL_GXX3PLAIN_LDFLAGS.dll) $(flags) -o $(out)\
|
---|
319 | $(if $(filter-out win32 os2, $(KBUILD_TARGET)),$(call TOOL_GXX3PLAIN_LD_SONAME,$(target),$(out)))\
|
---|
320 | $(filter-out %.h.gch,$(objs))\
|
---|
321 | $(filter %.def, $(othersrc))\
|
---|
322 | $(foreach p,$(libpath), -L$(p))\
|
---|
323 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
|
---|
324 | endef
|
---|
325 |
|
---|
326 |
|
---|
327 | ## Link system module (windows aka driver, linux aka kernel module)
|
---|
328 | # This tool target might not work everywhere, but is provided for the
|
---|
329 | # platforms where it works (Solaris, etc).
|
---|
330 | #
|
---|
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_GXX3PLAIN_LINK_SYSMOD_OUTPUT =
|
---|
344 | TOOL_GXX3PLAIN_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).map
|
---|
345 | TOOL_GXX3PLAIN_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
|
---|
346 | $(filter %.def, $(othersrc))
|
---|
347 | TOOL_GXX3PLAIN_LINK_SYSMOD_DEPORD =
|
---|
348 | define TOOL_GXX3PLAIN_LINK_SYSMOD_CMDS
|
---|
349 | $(QUIET)$(if $(TOOL_GXX3PLAIN_LD_SYSMOD.$(bld_trg)),$(TOOL_GXX3PLAIN_LD_SYSMOD.$(bld_trg)),$(TOOL_GXX3PLAIN_LD_SYSMOD))\
|
---|
350 | $(TOOL_GXX3PLAIN_LDFLAGS_SYSMOD.$(bld_trg)) $(flags) -o $(out) \
|
---|
351 | $(filter-out %.h.gch,$(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 | endef
|
---|
356 |
|
---|