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

Last change on this file since 393 was 391, checked in by bird, 20 years ago

Preparing for VCC70_NEW_DEPS.

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