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

Last change on this file since 1099 was 1031, checked in by bird, 18 years ago

MAYBE output. removed some obsolete stuff.

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