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

Last change on this file since 557 was 471, checked in by bird, 19 years ago

assembler-with-cpp by default.

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