1 | # $Id: VCC70.kmk 339 2005-11-07 19:21:04Z 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 |
|
---|
28 | TOOL_VCC70 := Visual C++ 7.0
|
---|
29 | PATH_TOOL_VCC70 ?= $(PATH_DEV)/x86.win32/vcc70
|
---|
30 | PATH_TOOL_VCC70_LIB ?= $(PATH_DEV)/x86.win32/vcc70/lib
|
---|
31 |
|
---|
32 | TOOL_VCC70_CC := $(EXEC_X86_WIN32) $(PATH_TOOL_VCC70)/bin/cl.exe
|
---|
33 | TOOL_VCC70_COBJSUFF := .obj
|
---|
34 | TOOL_VCC70_CFLAGS := -TC -c -nologo
|
---|
35 | TOOL_VCC70_CFLAGS.debug := -Od -Zi
|
---|
36 | TOOL_VCC70_CFLAGS.release := -O2
|
---|
37 | TOOL_VCC70_CFLAGS.profile := -O2
|
---|
38 | TOOL_VCC70_CINCS := $(PATH_TOOL_VCC70)/include
|
---|
39 | TOOL_VCC70_CDEFS :=
|
---|
40 |
|
---|
41 | TOOL_VCC70_CXX := $(EXEC_X86_WIN32) $(PATH_TOOL_VCC70)/bin/cl.exe
|
---|
42 | TOOL_VCC70_CXXOBJSUFF := .obj
|
---|
43 | TOOL_VCC70_CXXFLAGS := -TP -c -nologo
|
---|
44 | TOOL_VCC70_CXXFLAGS.debug := -Od -Zi
|
---|
45 | TOOL_VCC70_CXXFLAGS.release := -O2
|
---|
46 | TOOL_VCC70_CXXFLAGS.profile := -O2
|
---|
47 | TOOL_VCC70_CXXINCS := $(PATH_TOOL_VCC70)/include
|
---|
48 | TOOL_VCC70_CXXDEFS :=
|
---|
49 |
|
---|
50 | TOOL_VCC70_AS := $(EXEC_X86_WIN32) $(PATH_TOOL_VCC70)/bin/ml.exe
|
---|
51 | TOOL_VCC70_ASOBJSUFF := .obj
|
---|
52 |
|
---|
53 | TOOL_VCC70_AR := $(EXEC_X86_WIN32) $(PATH_TOOL_VCC70)/bin/lib.exe
|
---|
54 | TOOL_VCC70_ARFLAGS := -nologo
|
---|
55 | TOOL_VCC70_ARLIBSUFF := .lib
|
---|
56 |
|
---|
57 | TOOL_VCC70_LD := $(EXEC_X86_WIN32) $(PATH_TOOL_VCC70)/bin/link.exe
|
---|
58 | TOOL_VCC70_LDFLAGS := -nologo
|
---|
59 | TOOL_VCC70_LDFLAGS.debug := -debug
|
---|
60 | TOOL_VCC70_LDFLAGS.release :=
|
---|
61 |
|
---|
62 | ## Constructs the correct .pdb name (the name is lowercased).
|
---|
63 | # @param $(1) Base name, no extention.
|
---|
64 | ifeq ($(filter tolower,$(KMK_FEATURES)),tolower)
|
---|
65 | TOOL_VCC70_PDB = $(dir $(1))$(tolower $(notdir $(1))).pdb
|
---|
66 | else # this fallback is incorrect and won't work on a case sensitive FS.
|
---|
67 | TOOL_VCC70_PDB = $(1).pdb
|
---|
68 | endif
|
---|
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.
|
---|
84 | define 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): $(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).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))
|
---|
98 |
|
---|
99 | endef
|
---|
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.
|
---|
115 | define 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): $(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).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))
|
---|
129 |
|
---|
130 | endef
|
---|
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.
|
---|
143 | define 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): $(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 |
|
---|
152 | endef
|
---|
153 |
|
---|
154 |
|
---|
155 | ## Link program
|
---|
156 | # @param $(target) Normalized main target name.
|
---|
157 | # @param $(exe) 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.
|
---|
169 | define TOOL_VCC70_LINK_PROGRAM
|
---|
170 | #$ (warning dbg: TOOL_VCC70_LINK_PROGRAM: target=$(target) exe=$(exe) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) othersrc=$(othersrc) outbase=$(outbase))
|
---|
171 | $(exe): $(deps) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) | $(dirdep)
|
---|
172 | $(call MSG_L1,Creating Program $$@)
|
---|
173 | ifneq ($(custom_pre),)
|
---|
174 | $(eval $(custom_pre))
|
---|
175 | endif
|
---|
176 | $(TOOL_VCC70_LD) $(flags) \
|
---|
177 | /OUT:$(exe) \
|
---|
178 | /MAPINFO:EXPORTS /MAPINFO:LINES \
|
---|
179 | /MAP:$(outbase).map \
|
---|
180 | $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
|
---|
181 | $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
|
---|
182 | $(foreach p,$(libpath), /LIBPATH:$(p)) \
|
---|
183 | $(subst /,\\,$(objs)) \
|
---|
184 | $(subst /,\\,$(libs))
|
---|
185 | ifneq ($(custom_post),)
|
---|
186 | $(eval $(custom_post))
|
---|
187 | endif
|
---|
188 | _OUT_FILES += $(outbase).map $(outbase).lib $(outbase).exp $(call TOOL_VCC70_PDB, $(outbase)) $(outbase).ilk
|
---|
189 |
|
---|
190 | endef
|
---|
191 |
|
---|
192 |
|
---|
193 | ## Link system module (windows aka driver, linux aka kernel module)
|
---|
194 | # @param $(target) Normalized main target name.
|
---|
195 | # @param $(sys) System module name.
|
---|
196 | # @param $(objs) Object files to link together.
|
---|
197 | # @param $(libs) Libraries to search.
|
---|
198 | # @param $(libpath) Library search paths.
|
---|
199 | # @param $(flags) Flags.
|
---|
200 | # @param $(dirdep) Directory creation dependency.
|
---|
201 | # @param $(deps) Other dependencies.
|
---|
202 | # @param $(othersrc) Unhandled sources.
|
---|
203 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
204 | # @param $(custom_post) Custom step invoked after linking.
|
---|
205 | #
|
---|
206 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
207 | define TOOL_VCC70_LINK_SYSMOD
|
---|
208 | #$ (warning dbg: TOOL_VCC70_LINK_SYSMOD: target=$(target) sys=$(sys) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) othersrc=$(othersrc) outbase=$(outbase))
|
---|
209 | $(sys): $(deps) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) | $(dirdep)
|
---|
210 | $(call MSG_L1,Creating Program $$@)
|
---|
211 | ifneq ($(custom_pre),)
|
---|
212 | $(eval $(custom_pre))
|
---|
213 | endif
|
---|
214 | $(TOOL_VCC70_LD) $(flags) \
|
---|
215 | /OUT:$(sys) \
|
---|
216 | /MAPINFO:EXPORTS /MAPINFO:LINES \
|
---|
217 | /MAP:$(outbase).map \
|
---|
218 | $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
|
---|
219 | $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
|
---|
220 | $(foreach p,$(libpath), /LIBPATH:$(p)) \
|
---|
221 | $(subst /,\\,$(objs)) \
|
---|
222 | $(subst /,\\,$(libs))
|
---|
223 | ifneq ($(custom_post),)
|
---|
224 | $(eval $(custom_post))
|
---|
225 | endif
|
---|
226 | _OUT_FILES += $(outbase).map $(outbase).lib $(outbase).exp $(call TOOL_VCC70_PDB, $(outbase)) $(outbase).ilk
|
---|
227 |
|
---|
228 | endef
|
---|
229 |
|
---|
230 |
|
---|
231 | ## Link system module (windows aka driver, linux aka kernel module)
|
---|
232 | # @param $(target) Normalized main target name.
|
---|
233 | # @param $(dll) System module name.
|
---|
234 | # @param $(objs) Object files to link together.
|
---|
235 | # @param $(libs) Libraries to search.
|
---|
236 | # @param $(libpath) Library search paths.
|
---|
237 | # @param $(flags) Flags.
|
---|
238 | # @param $(dirdep) Directory creation dependency.
|
---|
239 | # @param $(deps) Other dependencies.
|
---|
240 | # @param $(othersrc) Unhandled sources.
|
---|
241 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
242 | # @param $(custom_post) Custom step invoked after linking.
|
---|
243 | #
|
---|
244 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
245 | define TOOL_VCC70_LINK_DLL
|
---|
246 | #$ (warning dbg: TOOL_VCC70_LINK_DLL: target=$(target) dll=$(dll) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) othersrc=$(othersrc) outbase=$(outbase))
|
---|
247 | $(dll): $(deps) $(call DIRDEP,$(PATH_LIB)) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) | $(dirdep)
|
---|
248 | $(call MSG_L1,Creating Program $$@)
|
---|
249 | ifneq ($(custom_pre),)
|
---|
250 | $(eval $(custom_pre))
|
---|
251 | endif
|
---|
252 | $(TOOL_VCC70_LD) $(flags) \
|
---|
253 | /OUT:$(dll) \
|
---|
254 | /IMPLIB:$(outbase).lib \
|
---|
255 | /MAPINFO:EXPORTS /MAPINFO:LINES \
|
---|
256 | /MAP:$(outbase).map \
|
---|
257 | /DLL \
|
---|
258 | $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
|
---|
259 | $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
|
---|
260 | $(foreach p,$(libpath), /LIBPATH:$(p)) \
|
---|
261 | $(subst /,\\,$(objs)) \
|
---|
262 | $(subst /,\\,$(libs))
|
---|
263 | ifeq ($(filter %.exp .def,$(othersrc)),)
|
---|
264 | if test -f $(outbase).exp; then $(CP_EXT) $(outbase).exp $(PATH_LIB)/; fi
|
---|
265 | if test -f $(outbase).lib; then $(CP_EXT) $(outbase).lib $(PATH_LIB)/; fi
|
---|
266 | endif
|
---|
267 | ifneq ($(custom_post),)
|
---|
268 | $(eval $(custom_post))
|
---|
269 | endif
|
---|
270 | _OUT_FILES += $(outbase).map $(outbase).lib $(outbase).exp $(call TOOL_VCC70_PDB, $(outbase)) $(outbase).ilk
|
---|
271 | _DIRS += $(PATH_LIB)
|
---|
272 |
|
---|
273 | endef
|
---|
274 |
|
---|