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

Last change on this file since 672 was 667, checked in by bird, 19 years ago

cleanup. PATH_DEV* -> PATH_DEVTOOLS*.

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