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

Last change on this file since 468 was 465, checked in by bird, 19 years ago

AS commands.

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