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

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

Use tolower to fix .pdb screwup.

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