source: trunk/kBuild/tools/VCC70.kmk@ 1010

Last change on this file since 1010 was 1006, checked in by bird, 18 years ago

USE_KOBJCACHE hacking.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 13.8 KB
Line 
1# $Id: VCC70.kmk 1006 2007-06-02 16:21:42Z bird $
2## @file
3#
4# kBuild Tool Config - Visual C++ 7.0 (aka Visual Studio .NET), targeting x86.
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_VCC70 := Visual C++ 7.0 (aka Visual Studio .NET), targeting x86.
28
29# Tool Specific Properties
30ifndef PATH_TOOL_VCC70
31 PATH_TOOL_VCC70 := $(firstword $(wildcard \
32 $(PATH_DEVTOOLS)/win.x86/vcc/v7 \
33 $(PATH_DEVTOOLS)/x86.win32/vcc/v7 \
34 $(PATH_DEVTOOLS)/x86.win32/vcc70) )
35 # if not found, we'll enter 'pathless' mode.
36else
37 # Resolve any fancy stuff once and for all.
38 PATH_TOOL_VCC70 := $(PATH_TOOL_VCC70)
39endif
40ifneq ($(PATH_TOOL_VCC70),)
41 PATH_TOOL_VCC70_BIN ?= $(PATH_TOOL_VCC70)/bin
42 PATH_TOOL_VCC70_LIB ?= $(PATH_TOOL_VCC70)/lib
43 PATH_TOOL_VCC70_INC ?= $(PATH_TOOL_VCC70)/include
44 PATH_TOOL_VCC70_ATLMFC ?= $(PATH_TOOL_VCC70)/atlmfc
45 PATH_TOOL_VCC70_ATLMFC_INC ?= $(PATH_TOOL_VCC70_ATLMFC)/include
46 PATH_TOOL_VCC70_ATLMFC_LIB ?= $(PATH_TOOL_VCC70_ATLMFC)/lib
47 TOOL_VCC70_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC70_BIN)/cl.exe
48 TOOL_VCC70_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC70_BIN)/cl.exe
49 TOOL_VCC70_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC70_BIN)/ml.exe
50 TOOL_VCC70_RC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC70_BIN)/rc.exe
51 TOOL_VCC70_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC70_BIN)/lib.exe
52 TOOL_VCC70_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC70_BIN)/link.exe
53else
54 # Pathless, relies on the environment.
55 TOOL_VCC70_CC ?= $(EXEC_X86_WIN32) cl.exe
56 TOOL_VCC70_CXX ?= $(EXEC_X86_WIN32) cl.exe
57 TOOL_VCC70_AS ?= $(EXEC_X86_WIN32) ml.exe
58 TOOL_VCC70_RC ?= $(EXEC_X86_WIN32) rc.exe
59 TOOL_VCC70_AR ?= $(EXEC_X86_WIN32) lib.exe
60 TOOL_VCC70_LD ?= $(EXEC_X86_WIN32) link.exe
61endif
62## Disabled fast DEP_IDB based dependencies.
63#VCC70_OLD_DEPS = 1
64
65## Constructs the correct .pdb name (the name is lowercased).
66# @param $(1) Base name, no extention.
67# @param $(2) The extension.
68ifeq ($(filter tolower,$(KMK_FEATURES)),tolower)
69TOOL_VCC70_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
70else # this fallback is incorrect and won't work on a case sensitive FS.
71TOOL_VCC70_PDB = $(1).$(2)
72endif
73
74# General Properties used by kBuild
75TOOL_VCC70_COBJSUFF ?= .obj
76TOOL_VCC70_CFLAGS ?= -TC -c -nologo
77TOOL_VCC70_CFLAGS.debug ?= -Od -Zi
78TOOL_VCC70_CFLAGS.release ?= -O2
79TOOL_VCC70_CFLAGS.profile ?= -O2
80TOOL_VCC70_CINCS ?= $(PATH_TOOL_VCC70_INC)
81TOOL_VCC70_CDEFS ?=
82
83TOOL_VCC70_CXXOBJSUFF ?= .obj
84TOOL_VCC70_CXXFLAGS ?= -TP -c -nologo
85TOOL_VCC70_CXXFLAGS.debug ?= -Od -Zi
86TOOL_VCC70_CXXFLAGS.release ?= -O2
87TOOL_VCC70_CXXFLAGS.profile ?= -O2
88TOOL_VCC70_CXXINCS ?= $(PATH_TOOL_VCC70_INC) $(PATH_TOOL_VCC70_ATLMFC_INC)
89TOOL_VCC70_CXXDEFS ?=
90
91TOOL_VCC70_ASOBJSUFF ?= .obj
92
93TOOL_VCC70_RCOBJSUFF ?= .res
94TOOL_VCC70_RCINCS ?= $(PATH_TOOL_VCC70_INC) $(PATH_TOOL_VCC70_ATLMFC_INC)
95
96TOOL_VCC70_ARFLAGS ?= -nologo
97TOOL_VCC70_ARLIBSUFF ?= .lib
98
99TOOL_VCC70_LDFLAGS ?= -nologo
100TOOL_VCC70_LDFLAGS.debug ?= -debug
101TOOL_VCC70_LDFLAGS.release ?=
102
103
104## Compile C source.
105# @param $(target) Normalized main target name.
106# @param $(source) Source filename (relative).
107# @param $(obj) Object file name. This shall be (re)created by the compilation.
108# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
109# @param $(flags) Flags.
110# @param $(defs) Definitions. No -D or something.
111# @param $(incs) Includes. No -I or something.
112# @param $(dirdep) Directory creation dependency.
113# @param $(deps) Other dependencies.
114#
115# @param $(outbase) Output basename (full). Use this for list files and such.
116# @param $(objsuff) Object suffix.
117ifdef USE_KOBJCACHE
118TOOL_VCC70_COMPILE_C_OUTPUT = $(call TOOL_VCC70_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC70_PDB, $(outbase)-obj,idb) $(outbase).i
119TOOL_VCC70_COMPILE_C_DEPEND =
120TOOL_VCC70_COMPILE_C_DEPORD =
121TOOL_VCC70_COMPILE_C_USESES_KOBJCACHE = 1
122define TOOL_VCC70_COMPILE_C_CMDS
123 $(QUIET)$(KOBJCACHE) -f $(outbase).koc -r --kObjCache-cpp $(outbase).i \
124 $(TOOL_VCC70_CC) -E \
125 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
126 -Fd$(outbase)-obj.pdb \
127 -FD\
128 -Fo$(obj)\
129 $(subst /,\\,$(abspath $(source))) \
130 --kObjCache-cc $(obj) \
131 $(TOOL_VCC70_CC) -c -TC\
132 $(flags) \
133 -Fd$(outbase)-obj.pdb \
134 -FD\
135 -Fo$(obj)\
136 $(subst /,\\,$(outbase).i)
137endef
138# $(QUIET)$(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC70_PDB,$(outbase)-obj,idb)
139else # !USE_KOBJCACHE
140TOOL_VCC70_COMPILE_C_OUTPUT = $(call TOOL_VCC70_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC70_PDB, $(outbase)-obj,idb)
141TOOL_VCC70_COMPILE_C_DEPEND =
142TOOL_VCC70_COMPILE_C_DEPORD =
143define TOOL_VCC70_COMPILE_C_CMDS
144 $(QUIET)$(TOOL_VCC70_CC) -c\
145 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
146 -Fd$(outbase)-obj.pdb \
147 -FD\
148 -Fo$(obj)\
149 $(subst /,\\,$(abspath $(source)))
150 $(QUIET)$(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC70_PDB,$(outbase)-obj,idb)
151endef
152endif # !USE_KOBJCACHE
153
154
155## Compile C++ source.
156# @param $(target) Normalized main target name.
157# @param $(source) Source filename (relative).
158# @param $(obj) Object file name. This shall be (re)created by the compilation.
159# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
160# @param $(flags) Flags.
161# @param $(defs) Definitions. No -D or something.
162# @param $(incs) Includes. No -I or something.
163# @param $(dirdep) Directory creation dependency.
164# @param $(deps) Other dependencies.
165#
166# @param $(outbase) Output basename (full). Use this for list files and such.
167# @param $(objsuff) Object suffix.
168ifdef USE_KOBJCACHE
169TOOL_VCC70_COMPILE_CXX_OUTPUT = $(call TOOL_VCC70_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC70_PDB, $(outbase)-obj,idb) $(outbase).ii
170TOOL_VCC70_COMPILE_CXX_DEPEND =
171TOOL_VCC70_COMPILE_CXX_DEPORD =
172TOOL_VCC70_COMPILE_CXX_USESES_KOBJCACHE = 1
173define TOOL_VCC70_COMPILE_CXX_CMDS
174 $(QUIET)$(KOBJCACHE) -f $(outbase).koc -r --kObjCache-cpp $(outbase).ii \
175 $(TOOL_VCC70_CC) -E \
176 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
177 -Fd$(outbase)-obj.pdb \
178 -FD\
179 -Fo$(obj)\
180 $(subst /,\\,$(abspath $(source))) \
181 --kObjCache-cc $(obj) \
182 $(TOOL_VCC70_CC) -c -TP\
183 $(flags) \
184 -Fd$(outbase)-obj.pdb \
185 -FD\
186 -Fo$(obj)\
187 $(subst /,\\,$(outbase).ii)
188endef
189# $(QUIET)$(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC70_PDB,$(outbase)-obj,idb)
190else # !USE_KOBJCACHE
191TOOL_VCC70_COMPILE_CXX_OUTPUT = $(call TOOL_VCC70_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC70_PDB, $(outbase)-obj,idb)
192TOOL_VCC70_COMPILE_CXX_DEPEND =
193TOOL_VCC70_COMPILE_CXX_DEPORD =
194define TOOL_VCC70_COMPILE_CXX_CMDS
195 $(QUIET)$(TOOL_VCC70_CXX) -c\
196 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
197 -Fd$(outbase)-obj.pdb \
198 -FD\
199 -Fo$(obj)\
200 $(subst /,\\,$(abspath $(source)))
201 $(QUIET)$(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC70_PDB,$(outbase)-obj,idb)
202endef
203endif # !USE_KOBJCACHE
204
205
206## Compile resource source.
207# @param $(target) Normalized main target name.
208# @param $(source) Source filename (relative).
209# @param $(obj) Object file name. This shall be (re)created by the compilation.
210# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
211# @param $(flags) Flags.
212# @param $(defs) Definitions. No -D or something.
213# @param $(incs) Includes. No -I or something.
214# @param $(dirdep) Directory creation dependency.
215# @param $(deps) Other dependencies.
216#
217# @param $(outbase) Output basename (full). Use this for list files and such.
218# @param $(objsuff) Object suffix.
219TOOL_VCC70_COMPILE_RC_OUTPUT =
220TOOL_VCC70_COMPILE_RC_DEPEND =
221TOOL_VCC70_COMPILE_RC_DEPORD =
222define TOOL_VCC70_COMPILE_RC_CMDS
223 $(QUIET)$(TOOL_VCC70_RC) \
224 $(flags) $(addprefix /i, $(subst /,\\,$(incs))) $(addprefix /d, $(defs))\
225 /fo$(obj)\
226 $(subst /,\\,$(abspath $(source)))
227endef
228
229
230## Link library
231# @param $(target) Normalized main target name.
232# @param $(out) Library name.
233# @param $(objs) Object files to put in the library.
234# @param $(flags) Flags.
235# @param $(dirdep) Directory creation dependency.
236# @param $(deps) Other dependencies.
237# @param $(othersrc) Unhandled sources.
238# @param $(outbase) Output basename (full). Use this for list files and such.
239#
240TOOL_VCC70_LINK_LIBRARY_DEPEND = $(othersrc)
241TOOL_VCC70_LINK_LIBRARY_DEPORD =
242ifeq ($(filter append-dash-n,$(KMK_FEATURES)),append-dash-n)
243TOOL_VCC70_LINK_LIBRARY_OUTPUT = $(outbase).lst $(outbase).exp $(outbase).pdb $(outbase).rsp
244define TOOL_VCC70_LINK_LIBRARY_CMDS
245 $(QUIET)$(APPEND) -n $(outbase).rsp \
246 $(foreach arg,\
247 $(subst /,\\,$(objs) \
248 $(filter-out %.def,$(othersrc))) \
249 $(addprefix /DEF:,$(filter %.def,$(othersrc))) \
250 ,\"$(arg)\")
251 $(QUIET)$(TOOL_VCC70_AR) $(flags) /OUT:$(out) @$(outbase).rsp
252endef
253else
254TOOL_VCC70_LINK_LIBRARY_OUTPUT = $(outbase).lst $(outbase).exp $(outbase).pdb
255define TOOL_VCC70_LINK_LIBRARY_CMDS
256 $(QUIET)$(TOOL_VCC70_AR) $(flags) /OUT:$(out) $(subst /,\\,$(objs) $(filter %.a %.lib,$(othersrc))) \
257 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def))
258endef
259endif
260
261
262## Link program
263# @param $(target) Normalized main target name.
264# @param $(out) Program name.
265# @param $(objs) Object files to link together.
266# @param $(libs) Libraries to search.
267# @param $(libpath) Library search paths.
268# @param $(flags) Flags.
269# @param $(dirdep) Directory creation dependency.
270# @param $(deps) Other dependencies.
271# @param $(othersrc) Unhandled sources.
272# @param $(custom_pre) Custom step invoked before linking.
273# @param $(custom_post) Custom step invoked after linking.
274# @param $(outbase) Output basename (full). Use this for list files and such.
275#
276TOOL_VCC70_LINK_PROGRAM_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk
277TOOL_VCC70_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
278TOOL_VCC70_LINK_PROGRAM_DEPORD =
279define TOOL_VCC70_LINK_PROGRAM_CMDS
280 $(QUIET)$(TOOL_VCC70_LD) $(flags) \
281 /OUT:$(out) \
282 /MAPINFO:EXPORTS /INCREMENTAL:NO /MAPINFO:LINES \
283 /MAP:$(outbase).map \
284 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
285 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
286 $(foreach p,$(libpath), /LIBPATH:$(p)) \
287 $(subst /,\\,$(objs)) \
288 $(subst /,\\,$(libs))
289endef
290
291
292## Link DLL.
293# @param $(target) Normalized main target name.
294# @param $(out) DLL name.
295# @param $(objs) Object files to link together.
296# @param $(libs) Libraries to search.
297# @param $(libpath) Library search paths.
298# @param $(flags) Flags.
299# @param $(dirdep) Directory creation dependency.
300# @param $(deps) Other dependencies.
301# @param $(othersrc) Unhandled sources.
302# @param $(custom_pre) Custom step invoked before linking.
303# @param $(custom_post) Custom step invoked after linking.
304#
305# @param $(outbase) Output basename (full). Use this for list files and such.
306TOOL_VCC70_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk
307TOOL_VCC70_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
308TOOL_VCC70_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_LIB))
309define TOOL_VCC70_LINK_DLL_CMDS
310 $(QUIET)$(TOOL_VCC70_LD) $(flags) \
311 /OUT:$(out) \
312 /IMPLIB:$(outbase).lib \
313 /MAPINFO:EXPORTS /INCREMENTAL:NO /MAPINFO:LINES \
314 /MAP:$(outbase).map \
315 /DLL \
316 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
317 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
318 $(foreach p,$(libpath), /LIBPATH:$(p)) \
319 $(subst /,\\,$(objs)) \
320 $(subst /,\\,$(libs))
321ifeq ($(filter %.exp .def,$(othersrc)),)
322 $(QUIET)if test -f $(outbase).exp; then $(CP_EXT) $(outbase).exp $(PATH_LIB)/; fi
323 $(QUIET)if test -f $(outbase).lib; then $(CP_EXT) $(outbase).lib $(PATH_LIB)/; fi
324endif
325$(eval _DIRS += $(PATH_LIB))
326endef
327
328
329## Link system module (windows aka driver, linux aka kernel module)
330# @param $(target) Normalized main target name.
331# @param $(out) System module name.
332# @param $(objs) Object files to link together.
333# @param $(libs) Libraries to search.
334# @param $(libpath) Library search paths.
335# @param $(flags) Flags.
336# @param $(dirdep) Directory creation dependency.
337# @param $(deps) Other dependencies.
338# @param $(othersrc) Unhandled sources.
339# @param $(custom_pre) Custom step invoked before linking.
340# @param $(custom_post) Custom step invoked after linking.
341#
342# @param $(outbase) Output basename (full). Use this for list files and such.
343TOOL_VCC70_LINK_SYSMOD_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk
344TOOL_VCC70_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
345TOOL_VCC70_LINK_SYSMOD_DEPORD =
346define TOOL_VCC70_LINK_SYSMOD_CMDS
347 $(QUIET)$(TOOL_VCC70_LD) $(flags) \
348 /OUT:$(out) \
349 /MAPINFO:EXPORTS /INCREMENTAL:NO /MAPINFO:LINES \
350 /MAP:$(outbase).map \
351 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
352 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
353 $(foreach p,$(libpath), /LIBPATH:$(p)) \
354 $(subst /,\\,$(objs)) \
355 $(subst /,\\,$(libs))
356endef
357
Note: See TracBrowser for help on using the repository browser.