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

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

Use fixed lot's of those $$$$(PATH_<target>) thingies. Better target install, install pass and install target type. Generic passes. And more.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 11.5 KB
Line 
1# $Id: VCC70.kmk 353 2005-12-12 03:36:07Z 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.
64ifeq ($(filter tolower,$(KMK_FEATURES)),tolower)
65TOOL_VCC70_PDB = $(dir $(1))$(tolower $(notdir $(1))).pdb
66else # this fallback is incorrect and won't work on a case sensitive FS.
67TOOL_VCC70_PDB = $(1).pdb
68endif
69
70
71## Compile C source.
72# @param $(target) Normalized main target name.
73# @param $(source) Source filename (relative).
74# @param $(obj) Object file name. This shall be (re)created by the compilation.
75# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
76# @param $(flags) Flags.
77# @param $(defs) Definitions. No -D or something.
78# @param $(incs) Includes. No -I or something.
79# @param $(dirdep) Directory creation dependency.
80# @param $(deps) Other dependencies.
81#
82# @param $(outbase) Output basename (full). Use this for list files and such.
83# @param $(objsuff) Object suffix.
84define TOOL_VCC70_COMPILE_C
85#$ (warning dbg: TOOL_VCC70_COMPILE_C: target=$(target) source=$(source) obj=$(obj) dep=$(dep) flags=$(flags) defs=$(defs) incs=$(incs) dirdep=$(dirdep) outbase=$(outbase) objsuff=$(objsuff))
86$(obj) $(call TOOL_VCC70_PDB, $(outbase)-obj): $(deps) $(source) | $(dirdep)
87 $(call MSG_L2,Compiling $$@ using VCC70)
88 $(TOOL_VCC70_CC) -c\
89 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
90 -Fd$(outbase)-obj.pdb \
91 -Fo$(obj)\
92 $(subst /,\\,$(call ABSPATH,$(source)))
93 $(TOOL_VCC70_CC) -E\
94 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
95 $(subst /,\\,$(call ABSPATH,$(source)))\
96 | $(DEP_PRE) -f -s -o $(dep) -t $(obj) -
97_OUT_FILES += $(call TOOL_VCC70_PDB, $(outbase)-obj)
98
99endef
100
101
102## Compile C++ source.
103# @param $(target) Normalized main target name.
104# @param $(source) Source filename (relative).
105# @param $(obj) Object file name. This shall be (re)created by the compilation.
106# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
107# @param $(flags) Flags.
108# @param $(defs) Definitions. No -D or something.
109# @param $(incs) Includes. No -I or something.
110# @param $(dirdep) Directory creation dependency.
111# @param $(deps) Other dependencies.
112#
113# @param $(outbase) Output basename (full). Use this for list files and such.
114# @param $(objsuff) Object suffix.
115define TOOL_VCC70_COMPILE_CXX
116#$ (warning dbg: TOOL_VCC70_COMPILE_CXX: target=$(target) source=$(source) obj=$(obj) dep=$(dep) flags=$(flags) defs=$(defs) incs=$(incs) dirdep=$(dirdep) outbase=$(outbase) objsuff=$(objsuff))
117$(obj) $(call TOOL_VCC70_PDB, $(outbase)-obj): $(deps) $(source) | $(dirdep)
118 $(call MSG_L2,Compiling $$@ using VCC70)
119 $(TOOL_VCC70_CXX) -c\
120 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
121 -Fd$(outbase)-obj.pdb \
122 -Fo$(obj)\
123 $(subst /,\\,$(call ABSPATH,$(source)))
124 $(TOOL_VCC70_CXX) -E\
125 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
126 $(subst /,\\,$(call ABSPATH,$(source)))\
127 | $(DEP_PRE) -f -s -o $(dep) -t $(obj) -
128_OUT_FILES += $(call TOOL_VCC70_PDB, $(outbase)-obj)
129
130endef
131
132
133## Link library
134# @param $(target) Normalized main target name.
135# @param $(lib) Library name.
136# @param $(objs) Object files to put in the library.
137# @param $(flags) Flags.
138# @param $(dirdep) Directory creation dependency.
139# @param $(deps) Other dependencies.
140# @param $(othersrc) Unhandled sources.
141#
142# @param $(outbase) Output basename (full). Use this for list files and such.
143define TOOL_VCC70_LINK_LIBRARY
144#$ (warning dbg: TOOL_VCC70_LINK_LIBRARY: target=$(target) lib=$(lib) objs=$(objs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) outbase=$(outbase))
145$(lib) $(outbase).lst $(outbase).exp $(call TOOL_VCC70_PDB, $(outbase)): $(deps) $(objs) $(othersrc) | $(dirdep)
146 $(call MSG_L1,Creating Library $$@)
147 $(RM) -f $$@
148 $(TOOL_VCC70_AR) $(flags) /OUT:$(lib) $(subst /,\\,$(objs) $(filter %.a %.lib,$(othersrc))) \
149 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def))
150_OUT_FILES += $(outbase).lst $(outbase).exp $(call TOOL_VCC70_PDB, $(outbase))
151
152endef
153
154
155## Link program
156# @param $(target) Normalized main target name.
157# @param $(out) Program name.
158# @param $(objs) Object files to link together.
159# @param $(libs) Libraries to search.
160# @param $(libpath) Library search paths.
161# @param $(flags) Flags.
162# @param $(dirdep) Directory creation dependency.
163# @param $(deps) Other dependencies.
164# @param $(othersrc) Unhandled sources.
165# @param $(custom_pre) Custom step invoked before linking.
166# @param $(custom_post) Custom step invoked after linking.
167#
168# @param $(outbase) Output basename (full). Use this for list files and such.
169define TOOL_VCC70_LINK_PROGRAM
170#$ (warning dbg: TOOL_VCC70_LINK_PROGRAM: target=$(target) out=$(out) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) othersrc=$(othersrc) outbase=$(outbase))
171$(out) $(outbase).map $(outbase).lib $(outbase).exp $(call TOOL_VCC70_PDB, $(outbase)) $(outbase).ilk: \
172 $(deps) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) | $(dirdep)
173 $(call MSG_L1,Creating Program $$@)
174ifneq ($(custom_pre),)
175 $(eval $(custom_pre))
176endif
177 $(TOOL_VCC70_LD) $(flags) \
178 /OUT:$(out) \
179 /MAPINFO:EXPORTS /MAPINFO:LINES \
180 /MAP:$(outbase).map \
181 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
182 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
183 $(foreach p,$(libpath), /LIBPATH:$(p)) \
184 $(subst /,\\,$(objs)) \
185 $(subst /,\\,$(libs))
186ifneq ($(custom_post),)
187 $(eval $(custom_post))
188endif
189_OUT_FILES += $(outbase).map $(outbase).lib $(outbase).exp $(call TOOL_VCC70_PDB, $(outbase)) $(outbase).ilk
190
191endef
192
193
194## Link system module (windows aka driver, linux aka kernel module)
195# @param $(target) Normalized main target name.
196# @param $(out) System module name.
197# @param $(objs) Object files to link together.
198# @param $(libs) Libraries to search.
199# @param $(libpath) Library search paths.
200# @param $(flags) Flags.
201# @param $(dirdep) Directory creation dependency.
202# @param $(deps) Other dependencies.
203# @param $(othersrc) Unhandled sources.
204# @param $(custom_pre) Custom step invoked before linking.
205# @param $(custom_post) Custom step invoked after linking.
206#
207# @param $(outbase) Output basename (full). Use this for list files and such.
208define TOOL_VCC70_LINK_SYSMOD
209#$ (warning dbg: TOOL_VCC70_LINK_SYSMOD: target=$(target) out=$(out) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) othersrc=$(othersrc) outbase=$(outbase))
210$(out) $(outbase).map $(outbase).lib $(outbase).exp $(call TOOL_VCC70_PDB, $(outbase)) $(outbase).ilk: \
211 $(deps) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) | $(dirdep)
212 $(call MSG_L1,Creating Program $$@)
213ifneq ($(custom_pre),)
214 $(eval $(custom_pre))
215endif
216 $(TOOL_VCC70_LD) $(flags) \
217 /OUT:$(out) \
218 /MAPINFO:EXPORTS /MAPINFO:LINES \
219 /MAP:$(outbase).map \
220 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
221 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
222 $(foreach p,$(libpath), /LIBPATH:$(p)) \
223 $(subst /,\\,$(objs)) \
224 $(subst /,\\,$(libs))
225ifneq ($(custom_post),)
226 $(eval $(custom_post))
227endif
228_OUT_FILES += $(outbase).map $(outbase).lib $(outbase).exp $(call TOOL_VCC70_PDB, $(outbase)) $(outbase).ilk
229
230endef
231
232
233## Link DLL.
234# @param $(target) Normalized main target name.
235# @param $(out) DLL name.
236# @param $(objs) Object files to link together.
237# @param $(libs) Libraries to search.
238# @param $(libpath) Library search paths.
239# @param $(flags) Flags.
240# @param $(dirdep) Directory creation dependency.
241# @param $(deps) Other dependencies.
242# @param $(othersrc) Unhandled sources.
243# @param $(custom_pre) Custom step invoked before linking.
244# @param $(custom_post) Custom step invoked after linking.
245#
246# @param $(outbase) Output basename (full). Use this for list files and such.
247define TOOL_VCC70_LINK_DLL
248#$ (warning dbg: TOOL_VCC70_LINK_DLL: target=$(target) out=$(out) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) othersrc=$(othersrc) outbase=$(outbase))
249$(out) $(outbase).map $(outbase).lib $(outbase).exp $(call TOOL_VCC70_PDB, $(outbase)) $(outbase).ilk: \
250 $(deps) $(call DIRDEP,$(PATH_LIB)) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) | $(dirdep)
251 $(call MSG_L1,Creating Program $$@)
252ifneq ($(custom_pre),)
253 $(eval $(custom_pre))
254endif
255 $(TOOL_VCC70_LD) $(flags) \
256 /OUT:$(out) \
257 /IMPLIB:$(outbase).lib \
258 /MAPINFO:EXPORTS /MAPINFO:LINES \
259 /MAP:$(outbase).map \
260 /DLL \
261 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
262 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
263 $(foreach p,$(libpath), /LIBPATH:$(p)) \
264 $(subst /,\\,$(objs)) \
265 $(subst /,\\,$(libs))
266ifeq ($(filter %.exp .def,$(othersrc)),)
267 if test -f $(outbase).exp; then $(CP_EXT) $(outbase).exp $(PATH_LIB)/; fi
268 if test -f $(outbase).lib; then $(CP_EXT) $(outbase).lib $(PATH_LIB)/; fi
269endif
270ifneq ($(custom_post),)
271 $(eval $(custom_post))
272endif
273_OUT_FILES += $(outbase).map $(outbase).lib $(outbase).exp $(call TOOL_VCC70_PDB, $(outbase)) $(outbase).ilk
274_DIRS += $(PATH_LIB)
275
276endef
277
Note: See TracBrowser for help on using the repository browser.