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

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

Switched to the new dependency generator.

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