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

Last change on this file since 811 was 782, checked in by bird, 18 years ago

copyright 2007

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 7.4 KB
Line 
1# $Id: GCC.kmk 782 2007-01-24 20:19:57Z bird $
2## @file
3#
4# kBuild Tool Config - Generic GCC Using The System GCC.
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_GCC := Generic GCC Using The System GCC.
28
29# Tool Specific Properties
30TOOL_GCC_CC ?= gcc$(HOSTSUFF_EXE)
31TOOL_GCC_CXX ?= g++$(HOSTSUFF_EXE)
32TOOL_GCC_AS ?= gcc$(HOSTSUFF_EXE)
33TOOL_GCC_AR ?= ar$(HOSTSUFF_EXE)
34TOOL_GCC_LD ?= g++$(HOSTSUFF_EXE)
35TOOL_GCC_LDFLAGS.dll.os2 ?= -Zdll
36ifndef TOOL_GCC_LDFLAGS.$(BUILD_TARGET)
37TOOL_GCC_LDFLAGS.dll ?= -shared
38else
39TOOL_GCC_LDFLAGS.dll ?= $(TOOL_GCC_LDFLAGS.$(BUILD_TARGET))
40endif
41
42# General Properties used by kBuild
43TOOL_GCC_COBJSUFF ?= .o
44TOOL_GCC_CFLAGS ?=
45TOOL_GCC_CFLAGS.debug ?= -g
46TOOL_GCC_CFLAGS.profile ?= -g -O2 #-pg
47TOOL_GCC_CFLAGS.release ?= -O2
48TOOL_GCC_CINCS ?=
49TOOL_GCC_CDEFS ?=
50
51TOOL_GCC_CXXOBJSUFF ?= .o
52TOOL_GCC_CXXOBJSUFF ?= .o
53TOOL_GCC_CXXFLAGS ?=
54TOOL_GCC_CXXFLAGS.debug ?= -g -O0
55TOOL_GCC_CXXFLAGS.profile ?= -g -O2 #-pg
56TOOL_GCC_CXXFLAGS.release ?= -O2
57TOOL_GCC_CXXINCS ?=
58TOOL_GCC_CXXDEFS ?=
59
60TOOL_GCC_ASFLAGS ?= -x assembler-with-cpp
61TOOL_GCC_ASFLAGS.debug ?= -g
62TOOL_GCC_ASFLAGS.profile ?= -g
63TOOL_GCC_ASOBJSUFF ?= .o
64
65TOOL_GCC_ARFLAGS ?= cr
66TOOL_GCC_ARLIBSUFF ?= .a
67
68TOOL_GCC_LDFLAGS ?=
69TOOL_GCC_LDFLAGS.debug ?= -g
70TOOL_GCC_LDFLAGS.profile ?= -g
71
72
73## Compile C source.
74# @param $(target) Normalized main target name.
75# @param $(source) Source filename (relative).
76# @param $(obj) Object file name. This shall be (re)created by the compilation.
77# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
78# @param $(flags) Flags.
79# @param $(defs) Definitions. No -D or something.
80# @param $(incs) Includes. No -I or something.
81# @param $(dirdep) Directory creation dependency.
82# @param $(deps) Other dependencies.
83# @param $(outbase) Output basename (full). Use this for list files and such.
84# @param $(objsuff) Object suffix.
85#
86TOOL_GCC_COMPILE_C_OUTPUT =
87TOOL_GCC_COMPILE_C_DEPEND =
88TOOL_GCC_COMPILE_C_DEPORD =
89define TOOL_GCC_COMPILE_C_CMDS
90 $(QUIET)$(TOOL_GCC_CC) -c\
91 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
92 -Wp,-MD,$(dep) -Wp,-MT,$(out) \
93 -o $(out)\
94 $(abspath $(source))
95endef
96
97
98## Compile C++ source.
99# @param $(target) Normalized main target name.
100# @param $(source) Source filename (relative).
101# @param $(obj) Object file name. This shall be (re)created by the compilation.
102# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
103# @param $(flags) Flags.
104# @param $(defs) Definitions. No -D or something.
105# @param $(incs) Includes. No -I or something.
106# @param $(dirdep) Directory creation dependency.
107# @param $(deps) Other dependencies.
108#
109# @param $(outbase) Output basename (full). Use this for list files and such.
110# @param $(objsuff) Object suffix.
111TOOL_GCC_COMPILE_CXX_OUTPUT =
112TOOL_GCC_COMPILE_CXX_DEPEND =
113TOOL_GCC_COMPILE_CXX_DEPORD =
114define TOOL_GCC_COMPILE_CXX_CMDS
115 $(QUIET)$(TOOL_GCC_CXX) -c\
116 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
117 -Wp,-MD,$(dep) -Wp,-MT,$(out) \
118 -o $(out)\
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_GCC_COMPILE_AS_OUTPUT =
137TOOL_GCC_COMPILE_AS_DEPEND =
138TOOL_GCC_COMPILE_AS_DEPORD =
139define TOOL_GCC_COMPILE_AS_CMDS
140 $(QUIET)$(TOOL_GCC_AS) -c\
141 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
142 -Wp,-MD,$(dep) -Wp,-MT,$(out) \
143 -o $(out)\
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#
156# @param $(outbase) Output basename (full). Use this for list files and such.
157TOOL_GCC_LINK_LIBRARY_OUTPUT =
158TOOL_GCC_LINK_LIBRARY_DEPEND =
159TOOL_GCC_LINK_LIBRARY_DEPORD =
160define TOOL_GCC_LINK_LIBRARY_CMDS
161 $(QUIET)$(TOOL_GCC_AR) $(flags) $(out) $(objs)
162endef
163
164
165## Link program
166# @param $(target) Normalized main target name.
167# @param $(out) Program name.
168# @param $(objs) Object files to link together.
169# @param $(libs) Libraries to search.
170# @param $(libpath) Library search paths.
171# @param $(flags) Flags.
172# @param $(dirdep) Directory creation dependency.
173# @param $(deps) Other dependencies.
174# @param $(othersrc) Unhandled sources.
175# @param $(custom_pre) Custom step invoked before linking.
176# @param $(custom_post) Custom step invoked after linking.
177#
178# @param $(outbase) Output basename (full). Use this for list files and such.
179TOOL_GCC_LINK_PROGRAM_OUTPUT =
180TOOL_GCC_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
181TOOL_GCC_LINK_PROGRAM_DEPORD =
182define TOOL_GCC_LINK_PROGRAM_CMDS
183 $(QUIET)$(TOOL_GCC_LD) $(flags) -o $(out) $(objs) \
184 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
185endef
186
187
188## Link DLL
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_GCC_LINK_DLL_OUTPUT =
202TOOL_GCC_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
203TOOL_GCC_LINK_DLL_DEPORD =
204define TOOL_GCC_LINK_DLL_CMDS
205 $(QUIET)$(TOOL_GCC_LD) $(TOOL_GCC_LDFLAGS.dll) $(flags) -o $(out) $(objs) \
206 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
207endef
208
Note: See TracBrowser for help on using the repository browser.