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

Last change on this file since 706 was 697, checked in by bird, 19 years ago

ABSPATH -> abspath.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 12.6 KB
Line 
1# $Id: VCC70.kmk 697 2006-12-10 07:20:49Z bird $
2## @file
3#
4# kBuild Tool Config - Visual C++ 7.0 (aka Visual Studio .NET), targeting x86.
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_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
62VCC70_NEW_DEPS = 1 ##< Enables fast DEP_IDB based dependencies.
63
64## Constructs the correct .pdb name (the name is lowercased).
65# @param $(1) Base name, no extention.
66# @param $(2) The extension.
67ifeq ($(filter tolower,$(KMK_FEATURES)),tolower)
68TOOL_VCC70_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
69else # this fallback is incorrect and won't work on a case sensitive FS.
70TOOL_VCC70_PDB = $(1).$(2)
71endif
72
73# General Properties used by kBuild
74TOOL_VCC70_COBJSUFF ?= .obj
75TOOL_VCC70_CFLAGS ?= -TC -c -nologo
76TOOL_VCC70_CFLAGS.debug ?= -Od -Zi
77TOOL_VCC70_CFLAGS.release ?= -O2
78TOOL_VCC70_CFLAGS.profile ?= -O2
79TOOL_VCC70_CINCS ?= $(PATH_TOOL_VCC70_INC)
80TOOL_VCC70_CDEFS ?=
81
82TOOL_VCC70_CXXOBJSUFF ?= .obj
83TOOL_VCC70_CXXFLAGS ?= -TP -c -nologo
84TOOL_VCC70_CXXFLAGS.debug ?= -Od -Zi
85TOOL_VCC70_CXXFLAGS.release ?= -O2
86TOOL_VCC70_CXXFLAGS.profile ?= -O2
87TOOL_VCC70_CXXINCS ?= $(PATH_TOOL_VCC70_INC) $(PATH_TOOL_VCC70_ATLMFC_INC)
88TOOL_VCC70_CXXDEFS ?=
89
90TOOL_VCC70_ASOBJSUFF ?= .obj
91
92TOOL_VCC70_RCOBJSUFF ?= .res
93TOOL_VCC70_RCINCS ?= $(PATH_TOOL_VCC70_INC) $(PATH_TOOL_VCC70_ATLMFC_INC)
94
95TOOL_VCC70_ARFLAGS ?= -nologo
96TOOL_VCC70_ARLIBSUFF ?= .lib
97
98TOOL_VCC70_LDFLAGS ?= -nologo
99TOOL_VCC70_LDFLAGS.debug ?= -debug
100TOOL_VCC70_LDFLAGS.release ?=
101
102
103## Compile C source.
104# @param $(target) Normalized main target name.
105# @param $(source) Source filename (relative).
106# @param $(obj) Object file name. This shall be (re)created by the compilation.
107# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
108# @param $(flags) Flags.
109# @param $(defs) Definitions. No -D or something.
110# @param $(incs) Includes. No -I or something.
111# @param $(dirdep) Directory creation dependency.
112# @param $(deps) Other dependencies.
113#
114# @param $(outbase) Output basename (full). Use this for list files and such.
115# @param $(objsuff) Object suffix.
116TOOL_VCC70_COMPILE_C_OUTPUT = $(call TOOL_VCC70_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC70_PDB, $(outbase)-obj,idb)
117TOOL_VCC70_COMPILE_C_DEPEND =
118TOOL_VCC70_COMPILE_C_DEPORD =
119ifdef VCC70_NEW_DEPS
120define TOOL_VCC70_COMPILE_C_CMDS
121 $(QUIET)$(TOOL_VCC70_CC) -c\
122 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
123 -Fd$(outbase)-obj.pdb \
124 -FD\
125 -Fo$(obj)\
126 $(subst /,\\,$(abspath $(source)))
127 $(QUIET)$(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC70_PDB,$(outbase)-obj,idb)
128endef
129else
130define TOOL_VCC70_COMPILE_C_CMDS
131 $(QUIET)$(TOOL_VCC70_CC) -c\
132 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
133 -Fd$(outbase)-obj.pdb \
134 -Fo$(obj)\
135 $(subst /,\\,$(abspath $(source)))
136 $(QUIET)$(TOOL_VCC70_CC) -E\
137 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
138 $(subst /,\\,$(abspath $(source)))\
139 | $(DEP_PRE) -f -s -o $(dep) -t $(obj) -
140endef
141endif
142
143
144## Compile C++ source.
145# @param $(target) Normalized main target name.
146# @param $(source) Source filename (relative).
147# @param $(obj) Object file name. This shall be (re)created by the compilation.
148# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
149# @param $(flags) Flags.
150# @param $(defs) Definitions. No -D or something.
151# @param $(incs) Includes. No -I or something.
152# @param $(dirdep) Directory creation dependency.
153# @param $(deps) Other dependencies.
154#
155# @param $(outbase) Output basename (full). Use this for list files and such.
156# @param $(objsuff) Object suffix.
157TOOL_VCC70_COMPILE_CXX_OUTPUT = $(call TOOL_VCC70_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC70_PDB, $(outbase)-obj,idb)
158TOOL_VCC70_COMPILE_CXX_DEPEND =
159TOOL_VCC70_COMPILE_CXX_DEPORD =
160ifdef VCC70_NEW_DEPS
161define TOOL_VCC70_COMPILE_CXX_CMDS
162 $(QUIET)$(TOOL_VCC70_CXX) -c\
163 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
164 -Fd$(outbase)-obj.pdb \
165 -FD\
166 -Fo$(obj)\
167 $(subst /,\\,$(abspath $(source)))
168 $(QUIET)$(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC70_PDB,$(outbase)-obj,idb)
169endef
170else
171define TOOL_VCC70_COMPILE_CXX_CMDS
172 $(QUIET)$(TOOL_VCC70_CXX) -c\
173 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
174 -Fd$(outbase)-obj.pdb \
175 -Fo$(obj)\
176 $(subst /,\\,$(abspath $(source)))
177 $(QUIET)$(TOOL_VCC70_CXX) -E\
178 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
179 $(subst /,\\,$(abspath $(source)))\
180 | $(DEP_PRE) -f -s -o $(dep) -t $(obj) -
181endef
182endif
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_VCC70_COMPILE_RC_OUTPUT =
199TOOL_VCC70_COMPILE_RC_DEPEND =
200TOOL_VCC70_COMPILE_RC_DEPORD =
201define TOOL_VCC70_COMPILE_RC_CMDS
202 $(QUIET)$(TOOL_VCC70_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_VCC70_LINK_LIBRARY_OUTPUT = $(outbase).lst $(outbase).exp $(outbase).pdb
220TOOL_VCC70_LINK_LIBRARY_DEPEND = $(othersrc)
221TOOL_VCC70_LINK_LIBRARY_DEPORD =
222define TOOL_VCC70_LINK_LIBRARY_CMDS
223 $(QUIET)$(TOOL_VCC70_AR) $(flags) /OUT:$(out) $(subst /,\\,$(objs) $(filter %.a %.lib,$(othersrc))) \
224 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def))
225endef
226
227
228## Link program
229# @param $(target) Normalized main target name.
230# @param $(out) Program name.
231# @param $(objs) Object files to link together.
232# @param $(libs) Libraries to search.
233# @param $(libpath) Library search paths.
234# @param $(flags) Flags.
235# @param $(dirdep) Directory creation dependency.
236# @param $(deps) Other dependencies.
237# @param $(othersrc) Unhandled sources.
238# @param $(custom_pre) Custom step invoked before linking.
239# @param $(custom_post) Custom step invoked after linking.
240# @param $(outbase) Output basename (full). Use this for list files and such.
241#
242TOOL_VCC70_LINK_PROGRAM_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk
243TOOL_VCC70_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
244TOOL_VCC70_LINK_PROGRAM_DEPORD =
245define TOOL_VCC70_LINK_PROGRAM_CMDS
246 $(QUIET)$(TOOL_VCC70_LD) $(flags) \
247 /OUT:$(out) \
248 /MAPINFO:EXPORTS /INCREMENTAL:NO /MAPINFO:LINES \
249 /MAP:$(outbase).map \
250 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
251 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
252 $(foreach p,$(libpath), /LIBPATH:$(p)) \
253 $(subst /,\\,$(objs)) \
254 $(subst /,\\,$(libs))
255endef
256
257
258## Link DLL.
259# @param $(target) Normalized main target name.
260# @param $(out) DLL name.
261# @param $(objs) Object files to link together.
262# @param $(libs) Libraries to search.
263# @param $(libpath) Library search paths.
264# @param $(flags) Flags.
265# @param $(dirdep) Directory creation dependency.
266# @param $(deps) Other dependencies.
267# @param $(othersrc) Unhandled sources.
268# @param $(custom_pre) Custom step invoked before linking.
269# @param $(custom_post) Custom step invoked after linking.
270#
271# @param $(outbase) Output basename (full). Use this for list files and such.
272TOOL_VCC70_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk
273TOOL_VCC70_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
274TOOL_VCC70_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_LIB))
275define TOOL_VCC70_LINK_DLL_CMDS
276 $(QUIET)$(TOOL_VCC70_LD) $(flags) \
277 /OUT:$(out) \
278 /IMPLIB:$(outbase).lib \
279 /MAPINFO:EXPORTS /INCREMENTAL:NO /MAPINFO:LINES \
280 /MAP:$(outbase).map \
281 /DLL \
282 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
283 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
284 $(foreach p,$(libpath), /LIBPATH:$(p)) \
285 $(subst /,\\,$(objs)) \
286 $(subst /,\\,$(libs))
287ifeq ($(filter %.exp .def,$(othersrc)),)
288 $(QUIET)if test -f $(outbase).exp; then $(CP_EXT) $(outbase).exp $(PATH_LIB)/; fi
289 $(QUIET)if test -f $(outbase).lib; then $(CP_EXT) $(outbase).lib $(PATH_LIB)/; fi
290endif
291$(eval _DIRS += $(PATH_LIB))
292endef
293
294
295## Link system module (windows aka driver, linux aka kernel module)
296# @param $(target) Normalized main target name.
297# @param $(out) System module name.
298# @param $(objs) Object files to link together.
299# @param $(libs) Libraries to search.
300# @param $(libpath) Library search paths.
301# @param $(flags) Flags.
302# @param $(dirdep) Directory creation dependency.
303# @param $(deps) Other dependencies.
304# @param $(othersrc) Unhandled sources.
305# @param $(custom_pre) Custom step invoked before linking.
306# @param $(custom_post) Custom step invoked after linking.
307#
308# @param $(outbase) Output basename (full). Use this for list files and such.
309TOOL_VCC70_LINK_SYSMOD_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk
310TOOL_VCC70_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
311TOOL_VCC70_LINK_SYSMOD_DEPORD =
312define TOOL_VCC70_LINK_SYSMOD_CMDS
313 $(QUIET)$(TOOL_VCC70_LD) $(flags) \
314 /OUT:$(out) \
315 /MAPINFO:EXPORTS /INCREMENTAL:NO /MAPINFO:LINES \
316 /MAP:$(outbase).map \
317 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
318 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
319 $(foreach p,$(libpath), /LIBPATH:$(p)) \
320 $(subst /,\\,$(objs)) \
321 $(subst /,\\,$(libs))
322endef
323
Note: See TracBrowser for help on using the repository browser.