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

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

fixed some missing cleanup.

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