source: trunk/kBuild/tools/VCC80AMD64.kmk@ 461

Last change on this file since 461 was 457, checked in by bird, 19 years ago

x86_amd64/lib.exe is too stupid to assume x86 as default machine and will screw up .def files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 11.8 KB
Line 
1# $Id: VCC80AMD64.kmk 457 2006-06-25 15:10:06Z bird $
2## @file
3#
4# kBuild Tool Config - Visual C++ 8.0 (aka Visual .NET 2005)
5#
6# Copyright (c) 2004-2006 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_VCC80AMD64 := Visual C++ 8.0 AMD64
29PATH_TOOL_VCC80AMD64 ?= $(PATH_DEV)/x86.win32/vcc/v8
30PATH_TOOL_VCC80AMD64_LIB ?= $(PATH_TOOL_VCC80AMD64)/lib
31ifeq ($(BUILD_PLATFORM),win64)
32PATH_TOOL_VCC80AMD64_BIN ?= $(PATH_TOOL_VCC80AMD64)/bin/amd64
33else
34PATH_TOOL_VCC80AMD64_BIN ?= $(PATH_TOOL_VCC80AMD64)/bin/x86_amd64
35endif
36
37TOOL_VCC80AMD64_CC := $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80AMD64_BIN)/cl.exe
38TOOL_VCC80AMD64_COBJSUFF := .obj
39TOOL_VCC80AMD64_CFLAGS := -TC -c -nologo
40TOOL_VCC80AMD64_CFLAGS.debug := -Od -Zi
41TOOL_VCC80AMD64_CFLAGS.release := -O2
42TOOL_VCC80AMD64_CFLAGS.profile := -O2
43TOOL_VCC80AMD64_CINCS := $(PATH_TOOL_VCC80AMD64)/include
44TOOL_VCC80AMD64_CDEFS :=
45
46TOOL_VCC80AMD64_CXX := $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80AMD64_BIN)/cl.exe
47TOOL_VCC80AMD64_CXXOBJSUFF := .obj
48TOOL_VCC80AMD64_CXXFLAGS := -TP -c -nologo
49TOOL_VCC80AMD64_CXXFLAGS.debug := -Od -Zi
50TOOL_VCC80AMD64_CXXFLAGS.release := -O2
51TOOL_VCC80AMD64_CXXFLAGS.profile := -O2
52TOOL_VCC80AMD64_CXXINCS := $(PATH_TOOL_VCC80AMD64)/include
53TOOL_VCC80AMD64_CXXDEFS :=
54
55TOOL_VCC80AMD64_AS := $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80AMD64_BIN)/ml64.exe
56TOOL_VCC80AMD64_ASOBJSUFF := .obj
57
58TOOL_VCC80AMD64_AR := $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80AMD64_BIN)/lib.exe /MACHINE:X64
59TOOL_VCC80AMD64_ARFLAGS := -nologo
60TOOL_VCC80AMD64_ARLIBSUFF := .lib
61
62TOOL_VCC80AMD64_LD := $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80AMD64_BIN)/link.exe
63TOOL_VCC80AMD64_LDFLAGS := -nologo -machine:amd64
64TOOL_VCC80AMD64_LDFLAGS.debug := -debug
65TOOL_VCC80AMD64_LDFLAGS.release :=
66
67TOOL_VCC80AMD64_MT := $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80AMD64_BIN)/../mt.exe
68
69
70## Constructs the correct .pdb name (the name is lowercased).
71# @param $(1) Base name, no extention.
72# @param $(2) The extension.
73ifeq ($(filter tolower,$(KMK_FEATURES)),tolower)
74TOOL_VCC80AMD64_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
75else # this fallback is incorrect and won't work on a case sensitive FS.
76TOOL_VCC80AMD64_PDB = $(1).$(2)
77endif
78
79#ifeq ($(BUILD_PLATFORM),win32)
80VCC80AMD64_NEW_DEPS = 1
81#endif
82
83
84
85## Compile C source.
86# @param $(target) Normalized main target name.
87# @param $(source) Source filename (relative).
88# @param $(obj) Object file name. This shall be (re)created by the compilation.
89# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
90# @param $(flags) Flags.
91# @param $(defs) Definitions. No -D or something.
92# @param $(incs) Includes. No -I or something.
93# @param $(dirdep) Directory creation dependency.
94# @param $(deps) Other dependencies.
95#
96# @param $(outbase) Output basename (full). Use this for list files and such.
97# @param $(objsuff) Object suffix.
98TOOL_VCC80AMD64_COMPILE_C_OUTPUT = $(call TOOL_VCC80AMD64_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC80AMD64_PDB, $(outbase)-obj,idb)
99TOOL_VCC80AMD64_COMPILE_C_DEPEND =
100TOOL_VCC80AMD64_COMPILE_C_DEPORD =
101ifdef VCC80AMD64_NEW_DEPS
102define TOOL_VCC80AMD64_COMPILE_C_CMDS
103 $(TOOL_VCC80AMD64_CC) -c\
104 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
105 -Fd$(outbase)-obj.pdb \
106 -FD\
107 -Fo$(obj)\
108 $(subst /,\\,$(call ABSPATH,$(source)))
109 $(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC80AMD64_PDB,$(outbase)-obj,idb)
110endef
111else
112define TOOL_VCC80AMD64_COMPILE_C_CMDS
113 $(TOOL_VCC80AMD64_CC) -c\
114 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
115 -Fd$(outbase)-obj.pdb \
116 -Fo$(obj)\
117 $(subst /,\\,$(call ABSPATH,$(source)))
118 $(TOOL_VCC80AMD64_CC) -E\
119 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
120 $(subst /,\\,$(call ABSPATH,$(source)))\
121 | $(DEP_PRE) -f -s -o $(dep) -t $(obj) -
122endef
123endif
124
125
126## Compile C++ source.
127# @param $(target) Normalized main target name.
128# @param $(source) Source filename (relative).
129# @param $(obj) Object file name. This shall be (re)created by the compilation.
130# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
131# @param $(flags) Flags.
132# @param $(defs) Definitions. No -D or something.
133# @param $(incs) Includes. No -I or something.
134# @param $(dirdep) Directory creation dependency.
135# @param $(deps) Other dependencies.
136#
137# @param $(outbase) Output basename (full). Use this for list files and such.
138# @param $(objsuff) Object suffix.
139TOOL_VCC80AMD64_COMPILE_CXX_OUTPUT = $(call TOOL_VCC80AMD64_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC80AMD64_PDB, $(outbase)-obj,idb)
140TOOL_VCC80AMD64_COMPILE_CXX_DEPEND =
141TOOL_VCC80AMD64_COMPILE_CXX_DEPORD =
142ifdef VCC80AMD64_NEW_DEPS
143define TOOL_VCC80AMD64_COMPILE_CXX_CMDS
144 $(TOOL_VCC80AMD64_CXX) -c\
145 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
146 -Fd$(outbase)-obj.pdb \
147 -FD\
148 -Fo$(obj)\
149 $(subst /,\\,$(call ABSPATH,$(source)))
150 $(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC80AMD64_PDB,$(outbase)-obj,idb)
151endef
152else
153define TOOL_VCC80AMD64_COMPILE_CXX_CMDS
154 $(TOOL_VCC80AMD64_CXX) -c\
155 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
156 -Fd$(outbase)-obj.pdb \
157 -Fo$(obj)\
158 $(subst /,\\,$(call ABSPATH,$(source)))
159 $(TOOL_VCC80AMD64_CXX) -E\
160 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
161 $(subst /,\\,$(call ABSPATH,$(source)))\
162 | $(DEP_PRE) -f -s -o $(dep) -t $(obj) -
163endef
164endif
165
166
167## Link library
168# @param $(target) Normalized main target name.
169# @param $(out) Library name.
170# @param $(objs) Object files to put in the library.
171# @param $(flags) Flags.
172# @param $(dirdep) Directory creation dependency.
173# @param $(deps) Other dependencies.
174# @param $(othersrc) Unhandled sources.
175# @param $(outbase) Output basename (full). Use this for list files and such.
176#
177TOOL_VCC80AMD64_LINK_LIBRARY_OUTPUT = $(outbase).lst $(outbase).exp $(call TOOL_VCC80AMD64_PDB, $(outbase),pdb)
178TOOL_VCC80AMD64_LINK_LIBRARY_DEPEND = $(othersrc)
179TOOL_VCC80AMD64_LINK_LIBRARY_DEPORD =
180define TOOL_VCC80AMD64_LINK_LIBRARY_CMDS
181 $(TOOL_VCC80AMD64_AR) $(flags) /OUT:$(out) $(subst /,\\,$(objs) $(filter %.a %.lib,$(othersrc))) \
182 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def))
183endef
184
185
186## Link program
187# @param $(target) Normalized main target name.
188# @param $(out) Program name.
189# @param $(objs) Object files to link together.
190# @param $(libs) Libraries to search.
191# @param $(libpath) Library search paths.
192# @param $(flags) Flags.
193# @param $(dirdep) Directory creation dependency.
194# @param $(deps) Other dependencies.
195# @param $(othersrc) Unhandled sources.
196# @param $(custom_pre) Custom step invoked before linking.
197# @param $(custom_post) Custom step invoked after linking.
198# @param $(outbase) Output basename (full). Use this for list files and such.
199#
200TOOL_VCC80AMD64_LINK_PROGRAM_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(call TOOL_VCC80AMD64_PDB, $(outbase),pdb) $(outbase).ilk $(out).manifest
201TOOL_VCC80AMD64_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
202TOOL_VCC80AMD64_LINK_PROGRAM_DEPORD =
203define TOOL_VCC80AMD64_LINK_PROGRAM_CMDS
204 $(TOOL_VCC80AMD64_LD) $(flags) \
205 /OUT:$(out) \
206 /MAPINFO:EXPORTS /INCREMENTAL:NO \
207 /MAP:$(outbase).map \
208 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
209 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
210 $(foreach p,$(libpath), /LIBPATH:$(p)) \
211 $(subst /,\\,$(objs)) \
212 $(subst /,\\,$(libs))
213 if test -f $(out).manifest; then \
214 $(TOOL_VCC80AMD64_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out)); \
215 fi
216endef
217
218
219## Link DLL.
220# @param $(target) Normalized main target name.
221# @param $(out) DLL name.
222# @param $(objs) Object files to link together.
223# @param $(libs) Libraries to search.
224# @param $(libpath) Library search paths.
225# @param $(flags) Flags.
226# @param $(dirdep) Directory creation dependency.
227# @param $(deps) Other dependencies.
228# @param $(othersrc) Unhandled sources.
229# @param $(custom_pre) Custom step invoked before linking.
230# @param $(custom_post) Custom step invoked after linking.
231#
232# @param $(outbase) Output basename (full). Use this for list files and such.
233TOOL_VCC80AMD64_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(call TOOL_VCC80AMD64_PDB, $(outbase),pdb) $(outbase).ilk $(out).manifest
234TOOL_VCC80AMD64_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
235TOOL_VCC80AMD64_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_LIB))
236define TOOL_VCC80AMD64_LINK_DLL_CMDS
237 $(TOOL_VCC80AMD64_LD) $(flags) \
238 /OUT:$(out) \
239 /IMPLIB:$(outbase).lib \
240 /MAPINFO:EXPORTS /INCREMENTAL:NO \
241 /MAP:$(outbase).map \
242 /DLL \
243 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
244 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
245 $(foreach p,$(libpath), /LIBPATH:$(p)) \
246 $(subst /,\\,$(objs)) \
247 $(subst /,\\,$(libs))
248 if test -f $(out).manifest; then \
249 $(TOOL_VCC80AMD64_MT) -manifest $(subst /,\\,$(out)).manifest "-outputresource:$(subst /,\\,$(out));#2"; \
250 fi
251ifeq ($(filter %.exp .def,$(othersrc)),)
252 if test -f $(outbase).exp; then $(CP_EXT) $(outbase).exp $(PATH_LIB)/; fi
253 if test -f $(outbase).lib; then $(CP_EXT) $(outbase).lib $(PATH_LIB)/; fi
254endif
255$(eval _DIRS += $(PATH_LIB))
256endef
257
258
259## Link system module (windows aka driver, linux aka kernel module)
260# @param $(target) Normalized main target name.
261# @param $(out) System module name.
262# @param $(objs) Object files to link together.
263# @param $(libs) Libraries to search.
264# @param $(libpath) Library search paths.
265# @param $(flags) Flags.
266# @param $(dirdep) Directory creation dependency.
267# @param $(deps) Other dependencies.
268# @param $(othersrc) Unhandled sources.
269# @param $(custom_pre) Custom step invoked before linking.
270# @param $(custom_post) Custom step invoked after linking.
271#
272# @param $(outbase) Output basename (full). Use this for list files and such.
273TOOL_VCC80AMD64_LINK_SYSMOD_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(call TOOL_VCC80AMD64_PDB, $(outbase),pdb) $(outbase).ilk $(out).manifest
274TOOL_VCC80AMD64_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
275TOOL_VCC80AMD64_LINK_SYSMOD_DEPORD =
276define TOOL_VCC80AMD64_LINK_SYSMOD_CMDS
277 $(TOOL_VCC80AMD64_LD) $(flags) \
278 /OUT:$(out) \
279 /MAPINFO:EXPORTS /INCREMENTAL:NO \
280 /MAP:$(outbase).map \
281 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
282 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
283 $(foreach p,$(libpath), /LIBPATH:$(p)) \
284 $(subst /,\\,$(objs)) \
285 $(subst /,\\,$(libs))
286 if test -f $(out).manifest; then \
287 $(TOOL_VCC80AMD64_MT) -manifest $(subst /,\\,$(out)).manifest "-outputresource:$(subst /,\\,$(out));#2"; \
288 fi
289endef
290
Note: See TracBrowser for help on using the repository browser.