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

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

Don't check for tolower, it's there.

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