source: trunk/kBuild/tools/GCC.kmk@ 657

Last change on this file since 657 was 655, checked in by bird, 19 years ago

use ?= everywhere.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.4 KB
Line 
1# $Id: GCC.kmk 655 2006-12-04 15:34:29Z bird $
2## @file
3#
4# kBuild Tool Config - Generic GCC.
5#
6# Copyright (c) 2004-2005 knut st. osmundsen <bird-srcspam@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
28TOOL_GCC := Generic GCC
29
30TOOL_GCC_CC ?= gcc$(HOSTSUFF_EXE)
31TOOL_GCC_COBJSUFF ?= .o
32TOOL_GCC_CFLAGS ?=
33TOOL_GCC_CFLAGS.debug ?= -g
34TOOL_GCC_CFLAGS.profile ?= -g -O2 #-pg
35TOOL_GCC_CFLAGS.release ?= -O2
36TOOL_GCC_CINCS ?=
37TOOL_GCC_CDEFS ?=
38
39TOOL_GCC_CXX ?= g++$(HOSTSUFF_EXE)
40TOOL_GCC_CXXOBJSUFF ?= .o
41TOOL_GCC_CXXOBJSUFF ?= .o
42TOOL_GCC_CXXFLAGS ?=
43TOOL_GCC_CXXFLAGS.debug ?= -g -O0
44TOOL_GCC_CXXFLAGS.profile ?= -g -O2 #-pg
45TOOL_GCC_CXXFLAGS.release ?= -O2
46TOOL_GCC_CXXINCS ?=
47TOOL_GCC_CXXDEFS ?=
48
49TOOL_GCC_AS ?= gcc$(HOSTSUFF_EXE)
50TOOL_GCC_ASFLAGS ?= -x assembler-with-cpp
51TOOL_GCC_ASFLAGS.debug ?= -g
52TOOL_GCC_ASFLAGS.profile ?= -g
53TOOL_GCC_ASOBJSUFF ?= .o
54
55TOOL_GCC_AR ?= ar$(HOSTSUFF_EXE)
56TOOL_GCC_ARFLAGS ?= cr
57TOOL_GCC_ARLIBSUFF ?= .a
58
59TOOL_GCC_LD ?= g++$(HOSTSUFF_EXE)
60TOOL_GCC_LDFLAGS ?=
61TOOL_GCC_LDFLAGS.debug ?= -g
62TOOL_GCC_LDFLAGS.profile ?= -g
63TOOL_GCC_LDFLAGS.dll.os2 ?= -Zdll
64ifndef TOOL_GCC_LDFLAGS.$(BUILD_TARGET)
65TOOL_GCC_LDFLAGS.dll ?= -shared
66else
67TOOL_GCC_LDFLAGS.dll ?= $(TOOL_GCC_LDFLAGS.$(BUILD_TARGET))
68endif
69
70
71## Compile C source.
72# @param $(target) Normalized main target name.
73# @param $(source) Source filename (relative).
74# @param $(obj) Object file name. This shall be (re)created by the compilation.
75# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
76# @param $(flags) Flags.
77# @param $(defs) Definitions. No -D or something.
78# @param $(incs) Includes. No -I or something.
79# @param $(dirdep) Directory creation dependency.
80# @param $(deps) Other dependencies.
81# @param $(outbase) Output basename (full). Use this for list files and such.
82# @param $(objsuff) Object suffix.
83#
84TOOL_GCC_COMPILE_C_OUTPUT =
85TOOL_GCC_COMPILE_C_DEPEND =
86TOOL_GCC_COMPILE_C_DEPORD =
87define TOOL_GCC_COMPILE_C_CMDS
88 $(TOOL_GCC_CC) -c\
89 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
90 -Wp,-MD,$(dep) -Wp,-MT,$(out) \
91 -o $(out)\
92 $(call ABSPATH,$(source))
93endef
94
95
96## Compile C++ source.
97# @param $(target) Normalized main target name.
98# @param $(source) Source filename (relative).
99# @param $(obj) Object file name. This shall be (re)created by the compilation.
100# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
101# @param $(flags) Flags.
102# @param $(defs) Definitions. No -D or something.
103# @param $(incs) Includes. No -I or something.
104# @param $(dirdep) Directory creation dependency.
105# @param $(deps) Other dependencies.
106#
107# @param $(outbase) Output basename (full). Use this for list files and such.
108# @param $(objsuff) Object suffix.
109TOOL_GCC_COMPILE_CXX_OUTPUT =
110TOOL_GCC_COMPILE_CXX_DEPEND =
111TOOL_GCC_COMPILE_CXX_DEPORD =
112define TOOL_GCC_COMPILE_CXX_CMDS
113 $(TOOL_GCC_CXX) -c\
114 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
115 -Wp,-MD,$(dep) -Wp,-MT,$(out) \
116 -o $(out)\
117 $(call ABSPATH,$(source))
118endef
119
120
121## Compile Assembly source.
122# @param $(target) Normalized main target name.
123# @param $(source) Source filename (relative).
124# @param $(obj) Object file name. This shall be (re)created by the compilation.
125# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
126# @param $(flags) Flags.
127# @param $(defs) Definitions. No -D or something.
128# @param $(incs) Includes. No -I or something.
129# @param $(dirdep) Directory creation dependency.
130# @param $(deps) Other dependencies.
131# @param $(outbase) Output basename (full). Use this for list files and such.
132# @param $(objsuff) Object suffix.
133#
134TOOL_GCC_COMPILE_AS_OUTPUT =
135TOOL_GCC_COMPILE_AS_DEPEND =
136TOOL_GCC_COMPILE_AS_DEPORD =
137define TOOL_GCC_COMPILE_AS_CMDS
138 $(TOOL_GCC_AS) -c\
139 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
140 -Wp,-MD,$(dep) -Wp,-MT,$(out) \
141 -o $(out)\
142 $(call ABSPATH,$(source))
143endef
144
145
146## Link library
147# @param $(target) Normalized main target name.
148# @param $(out) Library name.
149# @param $(objs) Object files to put in the library.
150# @param $(flags) Flags.
151# @param $(dirdep) Directory creation dependency.
152# @param $(deps) Other dependencies.
153#
154# @param $(outbase) Output basename (full). Use this for list files and such.
155TOOL_GCC_LINK_LIBRARY_OUTPUT =
156TOOL_GCC_LINK_LIBRARY_DEPEND =
157TOOL_GCC_LINK_LIBRARY_DEPORD =
158define TOOL_GCC_LINK_LIBRARY_CMDS
159 $(TOOL_GCC_AR) $(flags) $(out) $(objs)
160endef
161
162
163## Link program
164# @param $(target) Normalized main target name.
165# @param $(out) Program name.
166# @param $(objs) Object files to link together.
167# @param $(libs) Libraries to search.
168# @param $(libpath) Library search paths.
169# @param $(flags) Flags.
170# @param $(dirdep) Directory creation dependency.
171# @param $(deps) Other dependencies.
172# @param $(othersrc) Unhandled sources.
173# @param $(custom_pre) Custom step invoked before linking.
174# @param $(custom_post) Custom step invoked after linking.
175#
176# @param $(outbase) Output basename (full). Use this for list files and such.
177TOOL_GCC_LINK_PROGRAM_OUTPUT =
178TOOL_GCC_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
179TOOL_GCC_LINK_PROGRAM_DEPORD =
180define TOOL_GCC_LINK_PROGRAM_CMDS
181 $(TOOL_GCC_LD) $(flags) -o $(out) $(objs) \
182 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
183endef
184
185
186## Link DLL
187# @param $(target) Normalized main target name.
188# @param $(out) Program name.
189# @param $(objs) Object files to link together.
190# @param $(libs) Libraries to search.
191# @param $(libpath) Library search paths.
192# @param $(flags) Flags.
193# @param $(dirdep) Directory creation dependency.
194# @param $(deps) Other dependencies.
195# @param $(othersrc) Unhandled sources.
196# @param $(custom_pre) Custom step invoked before linking.
197# @param $(custom_post) Custom step invoked after linking.
198# @param $(outbase) Output basename (full). Use this for list files and such.
199TOOL_GCC_LINK_DLL_OUTPUT =
200TOOL_GCC_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
201TOOL_GCC_LINK_DLL_DEPORD =
202define TOOL_GCC_LINK_DLL_CMDS
203 $(TOOL_GCC_LD) $(TOOL_GCC_LDFLAGS.dll) $(flags) -o $(out) $(objs) \
204 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
205endef
206
Note: See TracBrowser for help on using the repository browser.