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

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

KMK_NEW_CP

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 13.7 KB
Line 
1# $Id: VCC70.kmk 1288 2007-11-30 03:58:03Z 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.
117TOOL_VCC70_COMPILE_C_DONT_PURGE_OUTPUT =
118TOOL_VCC70_COMPILE_C_DEPEND =
119TOOL_VCC70_COMPILE_C_DEPORD =
120#ifdef USE_KOBJCACHE
121#TOOL_VCC70_COMPILE_C_OUTPUT = $(call TOOL_VCC70_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC70_PDB, $(outbase)-obj,idb) $(outbase).i
122#TOOL_VCC70_COMPILE_C_USESES_KOBJCACHE = 1
123#define TOOL_VCC70_COMPILE_C_CMDS
124# $(QUIET)$(KOBJCACHE) -f $(outbase).koc -r --kObjCache-cpp $(outbase).i \
125# $(TOOL_VCC70_CC) -E \
126# $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
127# $(subst /,\\,$(abspath $(source))) \
128# --kObjCache-cc $(obj) \
129# $(TOOL_VCC70_CC) -c -TC\
130# $(flags) \
131# -Fd$(outbase)-obj.pdb \
132# -FD\
133# -Fo$(obj)\
134# $(subst /,\\,$(outbase).i)
135# $(QUIET)$(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC70_PDB,$(outbase)-obj,idb)
136#endef
137#else # !USE_KOBJCACHE
138TOOL_VCC70_COMPILE_C_OUTPUT = $(call TOOL_VCC70_PDB, $(outbase)-obj,idb)
139TOOL_VCC70_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC70_PDB, $(outbase)-obj,pdb)
140define TOOL_VCC70_COMPILE_C_CMDS
141 $(QUIET)$(TOOL_VCC70_CC) -c\
142 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
143 -Fd$(outbase)-obj.pdb \
144 -FD\
145 -Fo$(obj)\
146 $(subst /,\\,$(abspath $(source)))
147 $(QUIET)$(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC70_PDB,$(outbase)-obj,idb)
148endef
149#endif # !USE_KOBJCACHE
150
151
152## Compile C++ source.
153# @param $(target) Normalized main target name.
154# @param $(source) Source filename (relative).
155# @param $(obj) Object file name. This shall be (re)created by the compilation.
156# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
157# @param $(flags) Flags.
158# @param $(defs) Definitions. No -D or something.
159# @param $(incs) Includes. No -I or something.
160# @param $(dirdep) Directory creation dependency.
161# @param $(deps) Other dependencies.
162#
163# @param $(outbase) Output basename (full). Use this for list files and such.
164# @param $(objsuff) Object suffix.
165TOOL_VCC70_COMPILE_CXX_DONT_PURGE_OUTPUT =
166TOOL_VCC70_COMPILE_CXX_DEPEND =
167TOOL_VCC70_COMPILE_CXX_DEPORD =
168#ifdef USE_KOBJCACHE
169#TOOL_VCC70_COMPILE_CXX_OUTPUT = $(call TOOL_VCC70_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC70_PDB, $(outbase)-obj,idb) $(outbase).ii
170#TOOL_VCC70_COMPILE_CXX_USES_KOBJCACHE = 1
171#define TOOL_VCC70_COMPILE_CXX_CMDS
172# $(QUIET)$(KOBJCACHE) -f $(outbase).koc -r --kObjCache-cpp $(outbase).ii \
173# $(TOOL_VCC70_CC) -E \
174# $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
175# $(subst /,\\,$(abspath $(source))) \
176# --kObjCache-cc $(obj) \
177# $(TOOL_VCC70_CC) -c -TP\
178# $(flags) \
179# -Fd$(outbase)-obj.pdb \
180# -FD\
181# -Fo$(obj)\
182# $(subst /,\\,$(outbase).ii)
183# $(QUIET)$(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC70_PDB,$(outbase)-obj,idb)
184#endef
185#else # !USE_KOBJCACHE
186TOOL_VCC70_COMPILE_CXX_OUTPUT = $(call TOOL_VCC70_PDB, $(outbase)-obj,idb)
187TOOL_VCC70_COMPILE_CXX_OUTPUT_MAYBE = $(call TOOL_VCC70_PDB, $(outbase)-obj,pdb)
188define TOOL_VCC70_COMPILE_CXX_CMDS
189 $(QUIET)$(TOOL_VCC70_CXX) -c\
190 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
191 -Fd$(outbase)-obj.pdb \
192 -FD\
193 -Fo$(obj)\
194 $(subst /,\\,$(abspath $(source)))
195 $(QUIET)$(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC70_PDB,$(outbase)-obj,idb)
196endef
197#endif # !USE_KOBJCACHE
198
199
200## Compile resource source.
201# @param $(target) Normalized main target name.
202# @param $(source) Source filename (relative).
203# @param $(obj) Object file name. This shall be (re)created by the compilation.
204# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
205# @param $(flags) Flags.
206# @param $(defs) Definitions. No -D or something.
207# @param $(incs) Includes. No -I or something.
208# @param $(dirdep) Directory creation dependency.
209# @param $(deps) Other dependencies.
210#
211# @param $(outbase) Output basename (full). Use this for list files and such.
212# @param $(objsuff) Object suffix.
213TOOL_VCC70_COMPILE_RC_OUTPUT =
214TOOL_VCC70_COMPILE_RC_DEPEND =
215TOOL_VCC70_COMPILE_RC_DEPORD =
216define TOOL_VCC70_COMPILE_RC_CMDS
217 $(QUIET)$(TOOL_VCC70_RC) \
218 $(flags) $(addprefix /i, $(subst /,\\,$(incs))) $(addprefix /d, $(defs))\
219 /fo$(obj)\
220 $(subst /,\\,$(abspath $(source)))
221endef
222
223
224## Link library
225# @param $(target) Normalized main target name.
226# @param $(out) Library name.
227# @param $(objs) Object files to put in the library.
228# @param $(flags) Flags.
229# @param $(dirdep) Directory creation dependency.
230# @param $(deps) Other dependencies.
231# @param $(othersrc) Unhandled sources.
232# @param $(outbase) Output basename (full). Use this for list files and such.
233#
234TOOL_VCC70_LINK_LIBRARY_DEPEND = $(othersrc)
235TOOL_VCC70_LINK_LIBRARY_DEPORD =
236TOOL_VCC70_LINK_LIBRARY_OUTPUT = $(outbase).rsp
237TOOL_VCC70_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
238define TOOL_VCC70_LINK_LIBRARY_CMDS
239 $(QUIET)$(APPEND) -n $(outbase).rsp \
240 $(foreach arg,\
241 $(subst /,\\,$(objs) \
242 $(filter-out %.def,$(othersrc))) \
243 $(addprefix /DEF:,$(filter %.def,$(othersrc))) \
244 ,\"$(arg)\")
245 $(QUIET)$(TOOL_VCC70_AR) $(flags) /OUT:$(out) @$(outbase).rsp
246endef
247
248
249## Link program
250# @param $(target) Normalized main target name.
251# @param $(out) Program name.
252# @param $(objs) Object files to link together.
253# @param $(libs) Libraries to search.
254# @param $(libpath) Library search paths.
255# @param $(flags) Flags.
256# @param $(dirdep) Directory creation dependency.
257# @param $(deps) Other dependencies.
258# @param $(othersrc) Unhandled sources.
259# @param $(custom_pre) Custom step invoked before linking.
260# @param $(custom_post) Custom step invoked after linking.
261# @param $(outbase) Output basename (full). Use this for list files and such.
262#
263TOOL_VCC70_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk
264TOOL_VCC70_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
265TOOL_VCC70_LINK_PROGRAM_DEPORD =
266define TOOL_VCC70_LINK_PROGRAM_CMDS
267 $(QUIET)$(TOOL_VCC70_LD) $(flags) \
268 /OUT:$(out) \
269 /MAPINFO:EXPORTS /INCREMENTAL:NO /MAPINFO:LINES \
270 /MAP:$(outbase).map \
271 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
272 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
273 $(foreach p,$(libpath), /LIBPATH:$(p)) \
274 $(subst /,\\,$(objs)) \
275 $(subst /,\\,$(libs))
276endef
277
278
279## Link DLL.
280# @param $(target) Normalized main target name.
281# @param $(out) DLL name.
282# @param $(objs) Object files to link together.
283# @param $(libs) Libraries to search.
284# @param $(libpath) Library search paths.
285# @param $(flags) Flags.
286# @param $(dirdep) Directory creation dependency.
287# @param $(deps) Other dependencies.
288# @param $(othersrc) Unhandled sources.
289# @param $(custom_pre) Custom step invoked before linking.
290# @param $(custom_post) Custom step invoked after linking.
291#
292# @param $(outbase) Output basename (full). Use this for list files and such.
293TOOL_VCC70_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp
294TOOL_VCC70_LINK_DLL_OUTPUT_MAYBE = $(outbase).pdb $(outbase).ilk
295TOOL_VCC70_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
296TOOL_VCC70_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_LIB))
297define TOOL_VCC70_LINK_DLL_CMDS
298 $(QUIET)$(TOOL_VCC70_LD) $(flags) \
299 /OUT:$(out) \
300 /IMPLIB:$(outbase).lib \
301 /MAPINFO:EXPORTS /INCREMENTAL:NO /MAPINFO:LINES \
302 /MAP:$(outbase).map \
303 /DLL \
304 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
305 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
306 $(foreach p,$(libpath), /LIBPATH:$(p)) \
307 $(subst /,\\,$(objs)) \
308 $(subst /,\\,$(libs))
309ifeq ($(filter %.exp .def,$(othersrc)),)
310ifdef KMK_NEW_CP
311 $(QUIET)$(CP) --changed --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_LIB)/
312else
313 $(QUIET)if test -f $(outbase).exp; then $(CP_EXT) $(outbase).exp $(PATH_LIB)/; fi
314 $(QUIET)if test -f $(outbase).lib; then $(CP_EXT) $(outbase).lib $(PATH_LIB)/; fi
315endif
316endif
317$(eval _DIRS += $(PATH_LIB))
318endef
319
320
321## Link system module (windows aka driver, linux aka kernel module)
322# @param $(target) Normalized main target name.
323# @param $(out) System module name.
324# @param $(objs) Object files to link together.
325# @param $(libs) Libraries to search.
326# @param $(libpath) Library search paths.
327# @param $(flags) Flags.
328# @param $(dirdep) Directory creation dependency.
329# @param $(deps) Other dependencies.
330# @param $(othersrc) Unhandled sources.
331# @param $(custom_pre) Custom step invoked before linking.
332# @param $(custom_post) Custom step invoked after linking.
333#
334# @param $(outbase) Output basename (full). Use this for list files and such.
335TOOL_VCC70_LINK_SYSMOD_OUTPUT = $(outbase).map
336TOOL_VCC70_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk
337TOOL_VCC70_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
338TOOL_VCC70_LINK_SYSMOD_DEPORD =
339define TOOL_VCC70_LINK_SYSMOD_CMDS
340 $(QUIET)$(TOOL_VCC70_LD) $(flags) \
341 /OUT:$(out) \
342 /MAPINFO:EXPORTS /INCREMENTAL:NO /MAPINFO:LINES \
343 /MAP:$(outbase).map \
344 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
345 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
346 $(foreach p,$(libpath), /LIBPATH:$(p)) \
347 $(subst /,\\,$(objs)) \
348 $(subst /,\\,$(libs))
349endef
350
Note: See TracBrowser for help on using the repository browser.