1 | # $Id: GCC3PLAIN.kmk 1505 2008-04-09 00:13:14Z bird $
|
---|
2 | ## @file
|
---|
3 | #
|
---|
4 | # kBuild Tool Config - Generic GCC v3.2.x or later Using The System GCC, any Unix Linker and Unix Archiver.
|
---|
5 | #
|
---|
6 | # Copyright (c) 2004-2008 knut st. osmundsen <bird-kBuild-spam@anduin.net>
|
---|
7 | #
|
---|
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 |
|
---|
27 | TOOL_GCC3PLAIN := Generic GCC v3.2.x or later Using The System GCC, any Unix Linker and Unix Archiver.
|
---|
28 |
|
---|
29 | # Tool Specific Properties
|
---|
30 | TOOL_GCC3PLAIN_CC ?= gcc$(HOSTSUFF_EXE)
|
---|
31 | TOOL_GCC3PLAIN_CXX ?= g++$(HOSTSUFF_EXE)
|
---|
32 | TOOL_GCC3PLAIN_AS ?= gcc$(HOSTSUFF_EXE)
|
---|
33 | TOOL_GCC3PLAIN_AR ?= ar$(HOSTSUFF_EXE)
|
---|
34 | TOOL_GCC3PLAIN_RANLIB ?= ranlib$(HOSTSUFF_EXE)
|
---|
35 | TOOL_GCC3PLAIN_LD ?= gcc$(HOSTSUFF_EXE)
|
---|
36 | TOOL_GCC3PLAIN_LD_SYSMOD ?= ld$(HOSTSUFF_EXE)
|
---|
37 | TOOL_GCC3PLAIN_LD_SYSMOD.os2 ?= g++$(HOSTSUFF_EXE)
|
---|
38 | TOOL_GCC3PLAIN_LDFLAGS.dll.os2 ?= -Zdll
|
---|
39 | TOOL_GCC3PLAIN_LDFLAGS.dll.darwin ?= -dynamiclib
|
---|
40 | ifndef TOOL_GCC3PLAIN_LDFLAGS.$(KBUILD_TARGET)
|
---|
41 | TOOL_GCC3PLAIN_LDFLAGS.dll ?= -shared
|
---|
42 | else
|
---|
43 | TOOL_GCC3PLAIN_LDFLAGS.dll ?= $(TOOL_GCC3PLAIN_LDFLAGS.$(KBUILD_TARGET))
|
---|
44 | endif
|
---|
45 | TOOL_GCC3PLAIN_LD_SONAME.darwin ?= $(NO_SUCH_VARIABLE)
|
---|
46 | TOOL_GCC3PLAIN_LD_SONAME.os2 ?= $(NO_SUCH_VARIABLE)
|
---|
47 | TOOL_GCC3PLAIN_LD_SONAME.solaris ?= -Wl,-h,$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
|
---|
48 | TOOL_GCC3PLAIN_LD_SONAME.win ?= $(NO_SUCH_VARIABLE)
|
---|
49 | ifndef TOOL_GCC3PLAIN_LD_SONAME.$(KBUILD_TARGET)
|
---|
50 | TOOL_GCC3PLAIN_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
|
---|
51 | else
|
---|
52 | TOOL_GCC3PLAIN_LD_SONAME ?= $(TOOL_GCC3PLAIN_LD_SONAME.$(KBUILD_TARGET))
|
---|
53 | endif
|
---|
54 | ifdef SLKRUNS
|
---|
55 | TOOL_GCC3PLAIN_CC += -fmessage-length=0
|
---|
56 | TOOL_GCC3PLAIN_CXX += -fmessage-length=0
|
---|
57 | endif
|
---|
58 |
|
---|
59 | # General Properties used by kBuild
|
---|
60 | TOOL_GCC3PLAIN_COBJSUFF ?= .o
|
---|
61 | TOOL_GCC3PLAIN_CFLAGS ?=
|
---|
62 | TOOL_GCC3PLAIN_CFLAGS.debug ?= -g
|
---|
63 | TOOL_GCC3PLAIN_CFLAGS.profile ?= -O2 #-g -pg
|
---|
64 | TOOL_GCC3PLAIN_CFLAGS.release ?= -O2
|
---|
65 | TOOL_GCC3PLAIN_CINCS ?=
|
---|
66 | TOOL_GCC3PLAIN_CDEFS ?=
|
---|
67 |
|
---|
68 | TOOL_GCC3PLAIN_CXXOBJSUFF ?= .o
|
---|
69 | TOOL_GCC3PLAIN_CXXOBJSUFF ?= .o
|
---|
70 | TOOL_GCC3PLAIN_CXXFLAGS ?=
|
---|
71 | TOOL_GCC3PLAIN_CXXFLAGS.debug ?= -g
|
---|
72 | TOOL_GCC3PLAIN_CXXFLAGS.profile ?= -O2 #-g -pg
|
---|
73 | TOOL_GCC3PLAIN_CXXFLAGS.release ?= -O2
|
---|
74 | TOOL_GCC3PLAIN_CXXINCS ?=
|
---|
75 | TOOL_GCC3PLAIN_CXXDEFS ?=
|
---|
76 |
|
---|
77 | TOOL_GCC3PLAIN_ASFLAGS ?= -x assembler-with-cpp
|
---|
78 | TOOL_GCC3PLAIN_ASFLAGS.debug ?= -g
|
---|
79 | TOOL_GCC3PLAIN_ASFLAGS.profile ?= -g
|
---|
80 | TOOL_GCC3PLAIN_ASOBJSUFF ?= .o
|
---|
81 |
|
---|
82 | TOOL_GCC3PLAIN_ARFLAGS ?= cr
|
---|
83 | TOOL_GCC3PLAIN_ARLIBSUFF ?= .a
|
---|
84 |
|
---|
85 | TOOL_GCC3PLAIN_LDFLAGS ?=
|
---|
86 |
|
---|
87 |
|
---|
88 | ## Compile C source.
|
---|
89 | # @param $(target) Normalized main target name.
|
---|
90 | # @param $(source) Source filename (relative).
|
---|
91 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
92 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
93 | # @param $(flags) Flags.
|
---|
94 | # @param $(defs) Definitions. No -D or something.
|
---|
95 | # @param $(incs) Includes. No -I or something.
|
---|
96 | # @param $(dirdep) Directory creation dependency.
|
---|
97 | # @param $(deps) Other dependencies.
|
---|
98 | #
|
---|
99 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
100 | # @param $(objsuff) Object suffix.
|
---|
101 | TOOL_GCC3PLAIN_COMPILE_C_DEPEND =
|
---|
102 | TOOL_GCC3PLAIN_COMPILE_C_DEPORD =
|
---|
103 | ifdef KBUILD_USE_KOBJCACHE
|
---|
104 | TOOL_GCC3PLAIN_COMPILE_C_USES_KOBJCACHE = 1
|
---|
105 | TOOL_GCC3PLAIN_COMPILE_C_OUTPUT = $(outbase).i
|
---|
106 | define TOOL_GCC3PLAIN_COMPILE_C_CMDS
|
---|
107 | $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
|
---|
108 | --kObjCache-cpp $(outbase).i\
|
---|
109 | $(TOOL_GCC3PLAIN_CC) -E -o -\
|
---|
110 | $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
|
---|
111 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
112 | $(abspath $(source))\
|
---|
113 | --kObjCache-cc $(obj)\
|
---|
114 | $(TOOL_GCC3PLAIN_CC) -c\
|
---|
115 | $(flags) -fpreprocessed -x c\
|
---|
116 | -o $(obj)\
|
---|
117 | -
|
---|
118 | endef
|
---|
119 | else # !KBUILD_USE_KOBJCACHE
|
---|
120 | TOOL_GCC3PLAIN_COMPILE_C_OUTPUT =
|
---|
121 | define TOOL_GCC3PLAIN_COMPILE_C_CMDS
|
---|
122 | $(QUIET)$(TOOL_GCC3PLAIN_CC) -c\
|
---|
123 | $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
|
---|
124 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
125 | -o $(obj)\
|
---|
126 | $(abspath $(source))
|
---|
127 | endef
|
---|
128 | endif # !KBUILD_USE_KOBJCACHE
|
---|
129 |
|
---|
130 |
|
---|
131 | ## Compile C++ source.
|
---|
132 | # @param $(target) Normalized main target name.
|
---|
133 | # @param $(source) Source filename (relative).
|
---|
134 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
135 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
136 | # @param $(flags) Flags.
|
---|
137 | # @param $(defs) Definitions. No -D or something.
|
---|
138 | # @param $(incs) Includes. No -I or something.
|
---|
139 | # @param $(dirdep) Directory creation dependency.
|
---|
140 | # @param $(deps) Other dependencies.
|
---|
141 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
142 | # @param $(objsuff) Object suffix.
|
---|
143 | TOOL_GCC3PLAIN_COMPILE_CXX_DEPEND =
|
---|
144 | TOOL_GCC3PLAIN_COMPILE_CXX_DEPORD =
|
---|
145 | ifdef KBUILD_USE_KOBJCACHE
|
---|
146 | TOOL_GCC3PLAIN_COMPILE_CXX_USES_KOBJCACHE = 1
|
---|
147 | TOOL_GCC3PLAIN_COMPILE_CXX_OUTPUT = $(outbase).ii
|
---|
148 | define TOOL_GCC3PLAIN_COMPILE_CXX_CMDS
|
---|
149 | $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
|
---|
150 | --kObjCache-cpp $(outbase).ii\
|
---|
151 | $(TOOL_GCC3PLAIN_CXX) -E -o -\
|
---|
152 | $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
|
---|
153 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
154 | $(abspath $(source))\
|
---|
155 | --kObjCache-cc $(obj)\
|
---|
156 | $(TOOL_GCC3PLAIN_CXX) -c\
|
---|
157 | $(flags) -fpreprocessed -x c++\
|
---|
158 | -o $(obj)\
|
---|
159 | -
|
---|
160 | endef
|
---|
161 | else # !KBUILD_USE_KOBJCACHE
|
---|
162 | TOOL_GCC3PLAIN_COMPILE_CXX_OUTPUT =
|
---|
163 | define TOOL_GCC3PLAIN_COMPILE_CXX_CMDS
|
---|
164 | $(QUIET)$(TOOL_GCC3PLAIN_CXX) -c\
|
---|
165 | $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
|
---|
166 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
167 | -o $(obj)\
|
---|
168 | $(abspath $(source))
|
---|
169 | endef
|
---|
170 | endif # !KBUILD_USE_KOBJCACHE
|
---|
171 |
|
---|
172 |
|
---|
173 | ## Compile Assembly source.
|
---|
174 | # @param $(target) Normalized main target name.
|
---|
175 | # @param $(source) Source filename (relative).
|
---|
176 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
177 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
178 | # @param $(flags) Flags.
|
---|
179 | # @param $(defs) Definitions. No -D or something.
|
---|
180 | # @param $(incs) Includes. No -I or something.
|
---|
181 | # @param $(dirdep) Directory creation dependency.
|
---|
182 | # @param $(deps) Other dependencies.
|
---|
183 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
184 | # @param $(objsuff) Object suffix.
|
---|
185 | #
|
---|
186 | TOOL_GCC3PLAIN_COMPILE_AS_OUTPUT =
|
---|
187 | TOOL_GCC3PLAIN_COMPILE_AS_DEPEND =
|
---|
188 | TOOL_GCC3PLAIN_COMPILE_AS_DEPORD =
|
---|
189 | define TOOL_GCC3PLAIN_COMPILE_AS_CMDS
|
---|
190 | $(QUIET)$(TOOL_GCC3PLAIN_AS) -c\
|
---|
191 | $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
|
---|
192 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
193 | -o $(obj)\
|
---|
194 | $(abspath $(source))
|
---|
195 | endef
|
---|
196 |
|
---|
197 |
|
---|
198 | ## Link library
|
---|
199 | # @param $(target) Normalized main target name.
|
---|
200 | # @param $(out) Library name.
|
---|
201 | # @param $(objs) Object files to put in the library.
|
---|
202 | # @param $(flags) Flags.
|
---|
203 | # @param $(dirdep) Directory creation dependency.
|
---|
204 | # @param $(deps) Other dependencies.
|
---|
205 | # @param $(othersrc) Unhandled sources.
|
---|
206 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
207 | TOOL_GCC3PLAIN_LINK_LIBRARY_OUTPUT =
|
---|
208 | TOOL_GCC3PLAIN_LINK_LIBRARY_DEPEND = $(othersrc)
|
---|
209 | TOOL_GCC3PLAIN_LINK_LIBRARY_DEPORD =
|
---|
210 | define TOOL_GCC3PLAIN_LINK_LIBRARY_CMDS
|
---|
211 | $(call xargs,$(QUIET)$(TOOL_GCC3PLAIN_AR) $(flags) $(out),$(objs))
|
---|
212 | $(foreach lib,$(othersrc)\
|
---|
213 | ,$(NL)$(TAB)$(call MSG_AR_MERGE,$(target),$(out),$(lib)) \
|
---|
214 | $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))ar.tmp.dir/* \
|
---|
215 | $(NL)$(TAB)$(QUIET)$(MKDIR) -p $(dir $(outbase))/ar.tmp.dir/ \
|
---|
216 | $(NL)$(TAB)$(QUIET)(cd $(dir $(outbase))ar.tmp.dir/ \
|
---|
217 | && $(TOOL_GCC3PLAIN_AR) x $(abspath $(lib)) \
|
---|
218 | && $(TOOL_GCC3PLAIN_AR) $(flags) $(out) *) \
|
---|
219 | $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))/ar.tmp.dir/* \
|
---|
220 | $(NL)$(TAB)$(QUIET)$(RMDIR) $(dir $(outbase))ar.tmp.dir/)
|
---|
221 | $(QUIET)$(TOOL_GCC3PLAIN_RANLIB) $(out)
|
---|
222 | endef
|
---|
223 |
|
---|
224 |
|
---|
225 | ## Link program
|
---|
226 | # @param $(target) Normalized main target name.
|
---|
227 | # @param $(out) Program name.
|
---|
228 | # @param $(objs) Object files to link together.
|
---|
229 | # @param $(libs) Libraries to search.
|
---|
230 | # @param $(libpath) Library search paths.
|
---|
231 | # @param $(flags) Flags.
|
---|
232 | # @param $(dirdep) Directory creation dependency.
|
---|
233 | # @param $(deps) Other dependencies.
|
---|
234 | # @param $(othersrc) Unhandled sources.
|
---|
235 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
236 | # @param $(custom_post) Custom step invoked after linking.
|
---|
237 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
238 | TOOL_GCC3PLAIN_LINK_PROGRAM_OUTPUT =
|
---|
239 | TOOL_GCC3PLAIN_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).map
|
---|
240 | TOOL_GCC3PLAIN_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
|
---|
241 | $(filter %.def, $(othersrc))
|
---|
242 | TOOL_GCC3PLAIN_LINK_PROGRAM_DEPORD =
|
---|
243 | define TOOL_GCC3PLAIN_LINK_PROGRAM_CMDS
|
---|
244 | $(QUIET)$(TOOL_GCC3PLAIN_LD) $(flags) -o $(out) $(objs)\
|
---|
245 | $(filter %.def, $(othersrc))\
|
---|
246 | $(foreach p,$(libpath), -L$(p))\
|
---|
247 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
|
---|
248 | endef
|
---|
249 |
|
---|
250 |
|
---|
251 | ## Link DLL
|
---|
252 | # @param $(target) Normalized main target name.
|
---|
253 | # @param $(out) Program name.
|
---|
254 | # @param $(objs) Object files to link together.
|
---|
255 | # @param $(libs) Libraries to search.
|
---|
256 | # @param $(libpath) Library search paths.
|
---|
257 | # @param $(flags) Flags.
|
---|
258 | # @param $(dirdep) Directory creation dependency.
|
---|
259 | # @param $(deps) Other dependencies.
|
---|
260 | # @param $(othersrc) Unhandled sources.
|
---|
261 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
262 | # @param $(custom_post) Custom step invoked after linking.
|
---|
263 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
264 | TOOL_GCC3PLAIN_LINK_DLL_OUTPUT =
|
---|
265 | TOOL_GCC3PLAIN_LINK_DLL_OUTPUT_MAYBE = $(outbase).map
|
---|
266 | TOOL_GCC3PLAIN_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
|
---|
267 | $(filter %.def, $(othersrc))
|
---|
268 | TOOL_GCC3PLAIN_LINK_DLL_DEPORD =
|
---|
269 | define TOOL_GCC3PLAIN_LINK_DLL_CMDS
|
---|
270 | $(QUIET)$(TOOL_GCC3PLAIN_LD) $(TOOL_GCC3PLAIN_LDFLAGS.dll) $(flags) -o $(out)\
|
---|
271 | $(if $(filter-out win32 os2, $(KBUILD_TARGET)),$(call TOOL_GCC3PLAIN_LD_SONAME,$(target),$(out)))\
|
---|
272 | $(objs)\
|
---|
273 | $(filter %.def, $(othersrc))\
|
---|
274 | $(foreach p,$(libpath), -L$(p))\
|
---|
275 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
|
---|
276 | endef
|
---|
277 |
|
---|
278 |
|
---|
279 | ## Link system module (windows aka driver, linux aka kernel module)
|
---|
280 | # This tool target might not work everywhere, but is provided for the
|
---|
281 | # platforms where it works (Solaris, etc).
|
---|
282 | #
|
---|
283 | # @param $(target) Normalized main target name.
|
---|
284 | # @param $(out) System module name.
|
---|
285 | # @param $(objs) Object files to link together.
|
---|
286 | # @param $(libs) Libraries to search.
|
---|
287 | # @param $(libpath) Library search paths.
|
---|
288 | # @param $(flags) Flags.
|
---|
289 | # @param $(dirdep) Directory creation dependency.
|
---|
290 | # @param $(deps) Other dependencies.
|
---|
291 | # @param $(othersrc) Unhandled sources.
|
---|
292 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
293 | # @param $(custom_post) Custom step invoked after linking.
|
---|
294 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
295 | TOOL_GCC3PLAIN_LINK_SYSMOD_OUTPUT =
|
---|
296 | TOOL_GCC3PLAIN_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).map
|
---|
297 | TOOL_GCC3PLAIN_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
|
---|
298 | $(filter %.def, $(othersrc))
|
---|
299 | TOOL_GCC3PLAIN_LINK_SYSMOD_DEPORD =
|
---|
300 | define TOOL_GCC3PLAIN_LINK_SYSMOD_CMDS
|
---|
301 | $(QUIET)$(if $(TOOL_GCC3PLAIN_LD_SYSMOD.$(bld_trg)),$(TOOL_GCC3PLAIN_LD_SYSMOD.$(bld_trg)),$(TOOL_GCC3PLAIN_LD_SYSMOD))\
|
---|
302 | $(TOOL_GCC3PLAIN_LDFLAGS_SYSMOD.$(bld_trg)) $(flags) -o $(out)\
|
---|
303 | $(objs)\
|
---|
304 | $(filter %.def, $(othersrc))\
|
---|
305 | $(foreach p,$(libpath), -L$(p))\
|
---|
306 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
|
---|
307 | $(call TOOL_GCC3PLAIN_LD_SYSMOD_MAP.$(bld_trg),$(outbase).map)
|
---|
308 | endef
|
---|
309 |
|
---|