source: trunk/kBuild/tools/GCC3PLAIN.kmk@ 1013

Last change on this file since 1013 was 973, checked in by bird, 18 years ago

WARNING! The GCC* tools are no using gcc and NOT g++ for linking.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.5 KB
Line 
1# $Id: GCC3PLAIN.kmk 973 2007-05-27 17:09:49Z 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-2007 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
27TOOL_GCC3PLAIN := Generic GCC v3.2.x or later Using The System GCC, any Unix Linker and Unix Archiver.
28
29# Tool Specific Properties
30TOOL_GCC3PLAIN_CC ?= gcc$(HOSTSUFF_EXE)
31TOOL_GCC3PLAIN_CXX ?= g++$(HOSTSUFF_EXE)
32TOOL_GCC3PLAIN_AS ?= gcc$(HOSTSUFF_EXE)
33TOOL_GCC3PLAIN_AR ?= ar$(HOSTSUFF_EXE)
34TOOL_GCC3PLAIN_RANLIB ?= ranlib$(HOSTSUFF_EXE)
35TOOL_GCC3PLAIN_LD ?= gcc$(HOSTSUFF_EXE)
36TOOL_GCC3PLAIN_LDFLAGS.dll.os2 ?= -Zdll
37TOOL_GCC3PLAIN_LDFLAGS.dll.darwin ?= -dynamiclib
38ifndef TOOL_GCC3PLAIN_LDFLAGS.$(BUILD_TARGET)
39 TOOL_GCC3PLAIN_LDFLAGS.dll ?= -shared
40else
41 TOOL_GCC3PLAIN_LDFLAGS.dll ?= $(TOOL_GCC3PLAIN_LDFLAGS.$(BUILD_TARGET))
42endif
43TOOL_GCC3PLAIN_LD_SONAME.darwin ?= $(NO_SUCH_VARIABLE)
44TOOL_GCC3PLAIN_LD_SONAME.os2 ?= $(NO_SUCH_VARIABLE)
45TOOL_GCC3PLAIN_LD_SONAME.win ?= $(NO_SUCH_VARIABLE)
46ifndef TOOL_GCC3PLAIN_LD_SONAME.$(BUILD_TARGET)
47 TOOL_GCC3PLAIN_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(BUILD_TARGET).$(BUILD_TYPE)) $($(1)_SONAME.$(BUILD_TARGET)) $($(1)_SONAME.$(BUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
48else
49 TOOL_GCC3PLAIN_LD_SONAME ?= $(TOOL_GCC3PLAIN_LD_SONAME.$(BUILD_TARGET))
50endif
51ifdef SLKRUNS
52 TOOL_GCC3PLAIN_CC += -fmessage-length=0
53 TOOL_GCC3PLAIN_CXX += -fmessage-length=0
54endif
55
56# General Properties used by kBuild
57TOOL_GCC3PLAIN_COBJSUFF ?= .o
58TOOL_GCC3PLAIN_CFLAGS ?=
59TOOL_GCC3PLAIN_CFLAGS.debug ?= -g
60TOOL_GCC3PLAIN_CFLAGS.profile ?= -g -O2 #-pg
61TOOL_GCC3PLAIN_CFLAGS.release ?= -O2
62TOOL_GCC3PLAIN_CINCS ?=
63TOOL_GCC3PLAIN_CDEFS ?=
64
65TOOL_GCC3PLAIN_CXXOBJSUFF ?= .o
66TOOL_GCC3PLAIN_CXXOBJSUFF ?= .o
67TOOL_GCC3PLAIN_CXXFLAGS ?=
68TOOL_GCC3PLAIN_CXXFLAGS.debug ?= -g
69TOOL_GCC3PLAIN_CXXFLAGS.profile ?= -g -O2 #-pg
70TOOL_GCC3PLAIN_CXXFLAGS.release ?= -O2
71TOOL_GCC3PLAIN_CXXINCS ?=
72TOOL_GCC3PLAIN_CXXDEFS ?=
73
74TOOL_GCC3PLAIN_ASFLAGS ?= -x assembler-with-cpp
75TOOL_GCC3PLAIN_ASFLAGS.debug ?= -g
76TOOL_GCC3PLAIN_ASFLAGS.profile ?= -g
77TOOL_GCC3PLAIN_ASOBJSUFF ?= .o
78
79TOOL_GCC3PLAIN_ARFLAGS ?= cr
80TOOL_GCC3PLAIN_ARLIBSUFF ?= .a
81
82TOOL_GCC3PLAIN_LDFLAGS ?=
83TOOL_GCC3PLAIN_LDFLAGS.debug ?= -g
84TOOL_GCC3PLAIN_LDFLAGS.profile ?= -g
85
86
87## Compile C source.
88# @param $(target) Normalized main target name.
89# @param $(source) Source filename (relative).
90# @param $(obj) Object file name. This shall be (re)created by the compilation.
91# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
92# @param $(flags) Flags.
93# @param $(defs) Definitions. No -D or something.
94# @param $(incs) Includes. No -I or something.
95# @param $(dirdep) Directory creation dependency.
96# @param $(deps) Other dependencies.
97#
98# @param $(outbase) Output basename (full). Use this for list files and such.
99# @param $(objsuff) Object suffix.
100TOOL_GCC3PLAIN_COMPILE_C_OUTPUT =
101TOOL_GCC3PLAIN_COMPILE_C_DEPEND =
102TOOL_GCC3PLAIN_COMPILE_C_DEPORD =
103define TOOL_GCC3PLAIN_COMPILE_C_CMDS
104 $(QUIET)$(TOOL_GCC3PLAIN_CC) -c\
105 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
106 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
107 -o $(obj)\
108 $(abspath $(source))
109endef
110
111
112## Compile C++ source.
113# @param $(target) Normalized main target name.
114# @param $(source) Source filename (relative).
115# @param $(obj) Object file name. This shall be (re)created by the compilation.
116# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
117# @param $(flags) Flags.
118# @param $(defs) Definitions. No -D or something.
119# @param $(incs) Includes. No -I or something.
120# @param $(dirdep) Directory creation dependency.
121# @param $(deps) Other dependencies.
122# @param $(outbase) Output basename (full). Use this for list files and such.
123# @param $(objsuff) Object suffix.
124TOOL_GCC3PLAIN_COMPILE_CXX_OUTPUT =
125TOOL_GCC3PLAIN_COMPILE_CXX_DEPEND =
126TOOL_GCC3PLAIN_COMPILE_CXX_DEPORD =
127define TOOL_GCC3PLAIN_COMPILE_CXX_CMDS
128 $(QUIET)$(TOOL_GCC3PLAIN_CXX) -c\
129 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
130 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
131 -o $(obj)\
132 $(abspath $(source))
133endef
134
135
136## Compile Assembly source.
137# @param $(target) Normalized main target name.
138# @param $(source) Source filename (relative).
139# @param $(obj) Object file name. This shall be (re)created by the compilation.
140# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
141# @param $(flags) Flags.
142# @param $(defs) Definitions. No -D or something.
143# @param $(incs) Includes. No -I or something.
144# @param $(dirdep) Directory creation dependency.
145# @param $(deps) Other dependencies.
146# @param $(outbase) Output basename (full). Use this for list files and such.
147# @param $(objsuff) Object suffix.
148#
149TOOL_GCC3PLAIN_COMPILE_AS_OUTPUT =
150TOOL_GCC3PLAIN_COMPILE_AS_DEPEND =
151TOOL_GCC3PLAIN_COMPILE_AS_DEPORD =
152define TOOL_GCC3PLAIN_COMPILE_AS_CMDS
153 $(QUIET)$(TOOL_GCC3PLAIN_AS) -c\
154 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
155 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
156 -o $(obj)\
157 $(abspath $(source))
158endef
159
160
161## Link library
162# @param $(target) Normalized main target name.
163# @param $(out) Library name.
164# @param $(objs) Object files to put in the library.
165# @param $(flags) Flags.
166# @param $(dirdep) Directory creation dependency.
167# @param $(deps) Other dependencies.
168# @param $(othersrc) Unhandled sources.
169# @param $(outbase) Output basename (full). Use this for list files and such.
170TOOL_GCC3PLAIN_LINK_LIBRARY_OUTPUT = $(out).ar-script
171TOOL_GCC3PLAIN_LINK_LIBRARY_DEPEND = $(othersrc)
172TOOL_GCC3PLAIN_LINK_LIBRARY_DEPORD =
173define TOOL_GCC3PLAIN_LINK_LIBRARY_CMDS
174 $(call xargs,$(QUIET)$(TOOL_GCC3PLAIN_AR) $(flags) $(out),$(objs))
175 $(foreach lib,$(othersrc)\
176 ,$(NL)$(TAB)$(call MSG_AR_MERGE,$(target),$(out),$(lib)) \
177 $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))ar.tmp.dir/* \
178 $(NL)$(TAB)$(QUIET)$(MKDIR) -p $(dir $(outbase))/ar.tmp.dir/ \
179 $(NL)$(TAB)$(QUIET)(cd $(dir $(outbase))ar.tmp.dir/ \
180 && $(TOOL_GCC3PLAIN_AR) x $(abspath $(lib)) \
181 && $(TOOL_GCC3PLAIN_AR) $(flags) $(out) *) \
182 $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))/ar.tmp.dir/* \
183 $(NL)$(TAB)$(QUIET)$(RMDIR) $(dir $(outbase))ar.tmp.dir/)
184 $(QUIET)$(TOOL_GCC3PLAIN_RANLIB) $(out)
185endef
186
187
188## Link program
189# @param $(target) Normalized main target name.
190# @param $(out) Program name.
191# @param $(objs) Object files to link together.
192# @param $(libs) Libraries to search.
193# @param $(libpath) Library search paths.
194# @param $(flags) Flags.
195# @param $(dirdep) Directory creation dependency.
196# @param $(deps) Other dependencies.
197# @param $(othersrc) Unhandled sources.
198# @param $(custom_pre) Custom step invoked before linking.
199# @param $(custom_post) Custom step invoked after linking.
200# @param $(outbase) Output basename (full). Use this for list files and such.
201TOOL_GCC3PLAIN_LINK_PROGRAM_OUTPUT = $(outbase).map
202TOOL_GCC3PLAIN_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
203 $(filter %.def, $(othersrc))
204TOOL_GCC3PLAIN_LINK_PROGRAM_DEPORD =
205define TOOL_GCC3PLAIN_LINK_PROGRAM_CMDS
206 $(QUIET)$(TOOL_GCC3PLAIN_LD) $(flags) -o $(out) $(objs)\
207 $(filter %.def, $(othersrc))\
208 $(foreach p,$(libpath), -L$(p))\
209 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
210endef
211
212
213## Link DLL
214# @param $(target) Normalized main target name.
215# @param $(out) Program name.
216# @param $(objs) Object files to link together.
217# @param $(libs) Libraries to search.
218# @param $(libpath) Library search paths.
219# @param $(flags) Flags.
220# @param $(dirdep) Directory creation dependency.
221# @param $(deps) Other dependencies.
222# @param $(othersrc) Unhandled sources.
223# @param $(custom_pre) Custom step invoked before linking.
224# @param $(custom_post) Custom step invoked after linking.
225# @param $(outbase) Output basename (full). Use this for list files and such.
226TOOL_GCC3PLAIN_LINK_DLL_OUTPUT = $(outbase).map
227TOOL_GCC3PLAIN_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
228 $(filter %.def, $(othersrc))
229TOOL_GCC3PLAIN_LINK_DLL_DEPORD =
230define TOOL_GCC3PLAIN_LINK_DLL_CMDS
231 $(QUIET)$(TOOL_GCC3PLAIN_LD) $(TOOL_GCC3PLAIN_LDFLAGS.dll) $(flags) -o $(out)\
232 $(if $(filter-out win32 os2, $(BUILD_TARGET)),$(call TOOL_GCC3PLAIN_LD_SONAME,$(target),$(out)))\
233 $(objs)\
234 $(filter %.def, $(othersrc))\
235 $(foreach p,$(libpath), -L$(p))\
236 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
237endef
238
Note: See TracBrowser for help on using the repository browser.