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

Last change on this file since 846 was 826, checked in by bird, 18 years ago

New tool that doesn't depend on GNU ld and ar: GCC3PLAIN. Use this when we're not sure the platform is using GNU ld and ar.

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