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

Last change on this file since 144 was 144, checked in by bird, 21 years ago

fixed trouble with dll which doesn't export something.

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