source: trunk/kBuild/tools/VCC80.kmk@ 672

Last change on this file since 672 was 668, checked in by bird, 19 years ago

VCC80 for $(BUILD_TARGET).

  • Property svn:keywords set to Id
File size: 14.1 KB
Line 
1# $Id: VCC80.kmk 668 2006-12-06 04:08:30Z bird $
2## @file
3#
4# kBuild Tool Config - Visual C++ 8.0 (aka Visual .NET 2005, or MSC v14), targeting $(BUILD_TARGET).
5#
6# Copyright (c) 2004-2006 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
27TOOL_VCC80 := Visual C++ 8.0 (aka Visual .NET 2005, or MSC v14), targeting $(BUILD_TARGET).
28
29# Tool Specific Properties
30ifndef PATH_TOOL_VCC80
31 PATH_TOOL_VCC80 := $(wildcard $(PATH_DEVTOOLS_TRG)/vcc/v8)
32 ifeq ($(PATH_TOOL_VCC80),)
33 PATH_TOOL_VCC80 := $(wildcard $(PATH_DEVTOOLS)/x86.win/vcc/v8)
34 endif
35 ifeq ($(PATH_TOOL_VCC80),)
36 PATH_TOOL_VCC80 := $(wildcard $(PATH_DEVTOOLS)/x86.win32/vcc/v8)
37 endif
38 ifeq ($(PATH_TOOL_VCC80),)
39 PATH_TOOL_VCC80 := $(wildcard $(PATH_DEVTOOLS)/amd64.win/vcc/v8)
40 endif
41 ifneq ($(PATH_TOOL_VCC80),)
42 # done for now
43 else
44 $(warning kBuild: PATH_TOOL_VCC80 cannot be determined!)
45 PATH_TOOL_VCC80 := $(PATH_DEVTOOLS_TRG)/vcc/v8
46 endif
47else
48 # Resolve any fancy stuff once and for all.
49 PATH_TOOL_VCC80 := $(PATH_TOOL_VCC80)
50endif
51ifeq ($(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH),win.amd64)
52PATH_TOOL_VCC80_BIN.amd64 ?= $(PATH_TOOL_VCC80)/bin/amd64
53else
54PATH_TOOL_VCC80_BIN.amd64 ?= $(PATH_TOOL_VCC80)/bin/x86_amd64
55endif
56PATH_TOOL_VCC80_BIN.x86 ?= $(PATH_TOOL_VCC80)/bin
57PATH_TOOL_VCC80_BIN ?= $(PATH_TOOL_VCC80_BIN.$(BUILD_TARGET))
58PATH_TOOL_VCC80_LIB.amd64 ?= $(PATH_TOOL_VCC80)/lib/amd64
59PATH_TOOL_VCC80_LIB.x86 ?= $(PATH_TOOL_VCC80)/lib
60PATH_TOOL_VCC80_LIB ?= $(PATH_TOOL_VCC80_LIB.$(BUILD_TARGET))
61PATH_TOOL_VCC80_INC ?= $(PATH_TOOL_VCC80)/include
62PATH_TOOL_VCC80_ATLMFC ?= $(PATH_TOOL_VCC80X86)/atlmfc
63PATH_TOOL_VCC80_ATLMFC_INC ?= $(PATH_TOOL_VCC80_ATLMFC)/include
64PATH_TOOL_VCC80_ATLMFC_LIB.amd64 ?= $(PATH_TOOL_VCC80_ATLMFC)/lib
65PATH_TOOL_VCC80_ATLMFC_LIB.x86 ?= $(PATH_TOOL_VCC80_ATLMFC)/lib/amd64
66PATH_TOOL_VCC80_ATLMFC_LIB ?= $(PATH_TOOL_VCC80_ATLMFC_LIB.$(BUILD_TARGET))
67TOOL_VCC80_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80_BIN)/cl.exe
68TOOL_VCC80_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80_BIN)/cl.exe
69TOOL_VCC80_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80_BIN)/ml64.exe
70TOOL_VCC80_RC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80_BIN)/../rc.exe
71TOOL_VCC80_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80_BIN)/lib.exe
72TOOL_VCC80_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80_BIN)/link.exe
73TOOL_VCC80_MT ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80_BIN)/../mt.exe
74VCC80_NEW_DEPS = 1 ##< Enables fast DEP_IDB based dependencies.
75
76## Constructs the correct .pdb name (the name is lowercased).
77# @param $(1) Base name, no extention.
78# @param $(2) The extension.
79ifeq ($(filter tolower,$(KMK_FEATURES)),tolower)
80TOOL_VCC80_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
81else # this fallback is incorrect and won't work on a case sensitive FS.
82TOOL_VCC80_PDB = $(1).$(2)
83endif
84
85TOOL_VCC80_COBJSUFF ?= .obj
86TOOL_VCC80_CFLAGS ?= -TC -c -nologo
87TOOL_VCC80_CFLAGS.debug ?= -Od -Zi
88TOOL_VCC80_CFLAGS.release ?= -O2
89TOOL_VCC80_CFLAGS.profile ?= -O2
90TOOL_VCC80_CINCS ?= $(PATH_TOOL_VCC80_INC)
91TOOL_VCC80_CDEFS ?=
92
93TOOL_VCC80_CXXOBJSUFF ?= .obj
94TOOL_VCC80_CXXFLAGS ?= -TP -c -nologo
95TOOL_VCC80_CXXFLAGS.debug ?= -Od -Zi
96TOOL_VCC80_CXXFLAGS.release ?= -O2
97TOOL_VCC80_CXXFLAGS.profile ?= -O2
98TOOL_VCC80_CXXINCS ?= $(PATH_TOOL_VCC80_INC) $(PATH_TOOL_VCC80_ATLMFC_INC)
99TOOL_VCC80_CXXDEFS ?=
100
101TOOL_VCC80_ASOBJSUFF ?= .obj
102
103TOOL_VCC80_RCOBJSUFF ?= .res
104TOOL_VCC80_RCINCS ?= $(PATH_TOOL_VCC80_INC) $(PATH_TOOL_VCC80_ATLMFC_INC)
105
106TOOL_VCC80_ARFLAGS.amd64 ?= -machine:amd64
107TOOL_VCC80_ARFLAGS.x86 ?= -machine:x86
108TOOL_VCC80_ARFLAGS ?= -nologo
109TOOL_VCC80_ARLIBSUFF ?= .lib
110
111TOOL_VCC80_LDFLAGS.amd64 ?= -machine:amd64
112TOOL_VCC80_LDFLAGS.x86 ?= -machine:x86
113TOOL_VCC80_LDFLAGS ?= -nologo
114TOOL_VCC80_LDFLAGS.debug ?= -debug
115TOOL_VCC80_LDFLAGS.release ?=
116
117
118
119## Compile C 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#
130# @param $(outbase) Output basename (full). Use this for list files and such.
131# @param $(objsuff) Object suffix.
132TOOL_VCC80_COMPILE_C_OUTPUT = $(call TOOL_VCC80_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC80_PDB, $(outbase)-obj,idb)
133TOOL_VCC80_COMPILE_C_DEPEND =
134TOOL_VCC80_COMPILE_C_DEPORD =
135ifdef VCC80_NEW_DEPS
136define TOOL_VCC80_COMPILE_C_CMDS
137 $(TOOL_VCC80_CC) -c\
138 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
139 -Fd$(outbase)-obj.pdb \
140 -FD\
141 -Fo$(obj)\
142 $(subst /,\\,$(call ABSPATH,$(source)))
143 $(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC80_PDB,$(outbase)-obj,idb)
144endef
145else
146define TOOL_VCC80_COMPILE_C_CMDS
147 $(TOOL_VCC80_CC) -c\
148 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
149 -Fd$(outbase)-obj.pdb \
150 -Fo$(obj)\
151 $(subst /,\\,$(call ABSPATH,$(source)))
152 $(TOOL_VCC80_CC) -E\
153 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
154 $(subst /,\\,$(call ABSPATH,$(source)))\
155 | $(DEP_PRE) -f -s -o $(dep) -t $(obj) -
156endef
157endif
158
159
160## Compile C++ source.
161# @param $(target) Normalized main target name.
162# @param $(source) Source filename (relative).
163# @param $(obj) Object file name. This shall be (re)created by the compilation.
164# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
165# @param $(flags) Flags.
166# @param $(defs) Definitions. No -D or something.
167# @param $(incs) Includes. No -I or something.
168# @param $(dirdep) Directory creation dependency.
169# @param $(deps) Other dependencies.
170#
171# @param $(outbase) Output basename (full). Use this for list files and such.
172# @param $(objsuff) Object suffix.
173TOOL_VCC80_COMPILE_CXX_OUTPUT = $(call TOOL_VCC80_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC80_PDB, $(outbase)-obj,idb)
174TOOL_VCC80_COMPILE_CXX_DEPEND =
175TOOL_VCC80_COMPILE_CXX_DEPORD =
176ifdef VCC80_NEW_DEPS
177define TOOL_VCC80_COMPILE_CXX_CMDS
178 $(TOOL_VCC80_CXX) -c\
179 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
180 -Fd$(outbase)-obj.pdb \
181 -FD\
182 -Fo$(obj)\
183 $(subst /,\\,$(call ABSPATH,$(source)))
184 $(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC80_PDB,$(outbase)-obj,idb)
185endef
186else
187define TOOL_VCC80_COMPILE_CXX_CMDS
188 $(TOOL_VCC80_CXX) -c\
189 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
190 -Fd$(outbase)-obj.pdb \
191 -Fo$(obj)\
192 $(subst /,\\,$(call ABSPATH,$(source)))
193 $(TOOL_VCC80_CXX) -E\
194 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
195 $(subst /,\\,$(call ABSPATH,$(source)))\
196 | $(DEP_PRE) -f -s -o $(dep) -t $(obj) -
197endef
198endif
199
200
201## Compile resource source.
202# @param $(target) Normalized main target name.
203# @param $(source) Source filename (relative).
204# @param $(obj) Object file name. This shall be (re)created by the compilation.
205# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
206# @param $(flags) Flags.
207# @param $(defs) Definitions. No -D or something.
208# @param $(incs) Includes. No -I or something.
209# @param $(dirdep) Directory creation dependency.
210# @param $(deps) Other dependencies.
211#
212# @param $(outbase) Output basename (full). Use this for list files and such.
213# @param $(objsuff) Object suffix.
214TOOL_VCC80_COMPILE_RC_OUTPUT =
215TOOL_VCC80_COMPILE_RC_DEPEND =
216TOOL_VCC80_COMPILE_RC_DEPORD =
217define TOOL_VCC80_COMPILE_RC_CMDS
218 $(TOOL_VCC80_RC) \
219 $(flags) $(addprefix /i, $(subst /,\\,$(incs))) $(addprefix /d, $(defs))\
220 /fo$(obj)\
221 $(subst /,\\,$(call ABSPATH,$(source)))
222endef
223
224
225## Link library
226# @param $(target) Normalized main target name.
227# @param $(out) Library name.
228# @param $(objs) Object files to put in the library.
229# @param $(flags) Flags.
230# @param $(dirdep) Directory creation dependency.
231# @param $(deps) Other dependencies.
232# @param $(othersrc) Unhandled sources.
233# @param $(outbase) Output basename (full). Use this for list files and such.
234#
235TOOL_VCC80_LINK_LIBRARY_OUTPUT = $(outbase).lst $(outbase).exp $(outbase).pdb
236TOOL_VCC80_LINK_LIBRARY_DEPEND = $(othersrc)
237TOOL_VCC80_LINK_LIBRARY_DEPORD =
238define TOOL_VCC80_LINK_LIBRARY_CMDS
239 $(TOOL_VCC80_AR) $(flags) /OUT:$(out) $(subst /,\\,$(objs) $(filter %.a %.lib,$(othersrc))) \
240 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def))
241endef
242
243
244## Link program
245# @param $(target) Normalized main target name.
246# @param $(out) Program name.
247# @param $(objs) Object files to link together.
248# @param $(libs) Libraries to search.
249# @param $(libpath) Library search paths.
250# @param $(flags) Flags.
251# @param $(dirdep) Directory creation dependency.
252# @param $(deps) Other dependencies.
253# @param $(othersrc) Unhandled sources.
254# @param $(custom_pre) Custom step invoked before linking.
255# @param $(custom_post) Custom step invoked after linking.
256# @param $(outbase) Output basename (full). Use this for list files and such.
257#
258TOOL_VCC80_LINK_PROGRAM_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk $(out).manifest
259TOOL_VCC80_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
260TOOL_VCC80_LINK_PROGRAM_DEPORD =
261define TOOL_VCC80_LINK_PROGRAM_CMDS
262 $(TOOL_VCC80_LD) $(flags) \
263 /OUT:$(out) \
264 /MAPINFO:EXPORTS /INCREMENTAL:NO \
265 /MAP:$(outbase).map \
266 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
267 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
268 $(foreach p,$(libpath), /LIBPATH:$(p)) \
269 $(subst /,\\,$(objs)) \
270 $(subst /,\\,$(libs))
271 if test -f $(out).manifest; then \
272 $(TOOL_VCC80_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out)); \
273 fi
274endef
275
276
277## Link DLL.
278# @param $(target) Normalized main target name.
279# @param $(out) DLL name.
280# @param $(objs) Object files to link together.
281# @param $(libs) Libraries to search.
282# @param $(libpath) Library search paths.
283# @param $(flags) Flags.
284# @param $(dirdep) Directory creation dependency.
285# @param $(deps) Other dependencies.
286# @param $(othersrc) Unhandled sources.
287# @param $(custom_pre) Custom step invoked before linking.
288# @param $(custom_post) Custom step invoked after linking.
289#
290# @param $(outbase) Output basename (full). Use this for list files and such.
291TOOL_VCC80_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk $(out).manifest
292TOOL_VCC80_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
293TOOL_VCC80_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_LIB))
294define TOOL_VCC80_LINK_DLL_CMDS
295 $(TOOL_VCC80_LD) $(flags) \
296 /OUT:$(out) \
297 /IMPLIB:$(outbase).lib \
298 /MAPINFO:EXPORTS /INCREMENTAL:NO \
299 /MAP:$(outbase).map \
300 /DLL \
301 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
302 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
303 $(foreach p,$(libpath), /LIBPATH:$(p)) \
304 $(subst /,\\,$(objs)) \
305 $(subst /,\\,$(libs))
306 if test -f $(out).manifest; then \
307 $(TOOL_VCC80_MT) -manifest $(subst /,\\,$(out)).manifest "-outputresource:$(subst /,\\,$(out));#2"; \
308 fi
309ifeq ($(filter %.exp .def,$(othersrc)),)
310 if test -f $(outbase).exp; then $(CP_EXT) $(outbase).exp $(PATH_LIB)/; fi
311 if test -f $(outbase).lib; then $(CP_EXT) $(outbase).lib $(PATH_LIB)/; fi
312endif
313$(eval _DIRS += $(PATH_LIB))
314endef
315
316
317## Link system module (windows aka driver, linux aka kernel module)
318# @param $(target) Normalized main target name.
319# @param $(out) System module name.
320# @param $(objs) Object files to link together.
321# @param $(libs) Libraries to search.
322# @param $(libpath) Library search paths.
323# @param $(flags) Flags.
324# @param $(dirdep) Directory creation dependency.
325# @param $(deps) Other dependencies.
326# @param $(othersrc) Unhandled sources.
327# @param $(custom_pre) Custom step invoked before linking.
328# @param $(custom_post) Custom step invoked after linking.
329#
330# @param $(outbase) Output basename (full). Use this for list files and such.
331TOOL_VCC80_LINK_SYSMOD_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk $(out).manifest
332TOOL_VCC80_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
333TOOL_VCC80_LINK_SYSMOD_DEPORD =
334define TOOL_VCC80_LINK_SYSMOD_CMDS
335 $(TOOL_VCC80_LD) $(flags) \
336 /OUT:$(out) \
337 /MAPINFO:EXPORTS /INCREMENTAL:NO \
338 /MAP:$(outbase).map \
339 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
340 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
341 $(foreach p,$(libpath), /LIBPATH:$(p)) \
342 $(subst /,\\,$(objs)) \
343 $(subst /,\\,$(libs))
344 if test -f $(out).manifest; then \
345 $(TOOL_VCC80_MT) -manifest $(subst /,\\,$(out)).manifest "-outputresource:$(subst /,\\,$(out));#2"; \
346 fi
347endef
348
Note: See TracBrowser for help on using the repository browser.