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

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

Big command dependency job. More installation stuff.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.8 KB
Line 
1# $Id: VCC70.kmk 380 2005-12-18 13:52:47Z bird $
2## @file
3#
4# kBuild Tool Config - Visual C++ 7.0 (aka Visual .NET)
5#
6# Copyright (c) 2004-2005 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## Constructs the correct .pdb name (the name is lowercased).
63# @param $(1) Base name, no extention.
64ifeq ($(filter tolower,$(KMK_FEATURES)),tolower)
65TOOL_VCC70_PDB = $(dir $(1))$(tolower $(notdir $(1))).pdb
66else # this fallback is incorrect and won't work on a case sensitive FS.
67TOOL_VCC70_PDB = $(1).pdb
68endif
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.
84TOOL_VCC70_COMPILE_C_OUTPUT = $(call TOOL_VCC70_PDB, $(outbase)-obj)
85TOOL_VCC70_COMPILE_C_DEPEND =
86TOOL_VCC70_COMPILE_C_DEPORD =
87define TOOL_VCC70_COMPILE_C_CMDS
88 $(TOOL_VCC70_CC) -c\
89 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
90 -Fd$(outbase)-obj.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) -
97endef
98
99
100## Compile C++ source.
101# @param $(target) Normalized main target name.
102# @param $(source) Source filename (relative).
103# @param $(obj) Object file name. This shall be (re)created by the compilation.
104# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
105# @param $(flags) Flags.
106# @param $(defs) Definitions. No -D or something.
107# @param $(incs) Includes. No -I or something.
108# @param $(dirdep) Directory creation dependency.
109# @param $(deps) Other dependencies.
110#
111# @param $(outbase) Output basename (full). Use this for list files and such.
112# @param $(objsuff) Object suffix.
113TOOL_VCC70_COMPILE_CXX_OUTPUT = $(call TOOL_VCC70_PDB, $(outbase)-obj)
114TOOL_VCC70_COMPILE_CXX_DEPEND =
115TOOL_VCC70_COMPILE_CXX_DEPORD =
116define TOOL_VCC70_COMPILE_CXX_CMDS
117 $(TOOL_VCC70_CXX) -c\
118 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
119 -Fd$(outbase)-obj.pdb \
120 -Fo$(obj)\
121 $(subst /,\\,$(call ABSPATH,$(source)))
122 $(TOOL_VCC70_CXX) -E\
123 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
124 $(subst /,\\,$(call ABSPATH,$(source)))\
125 | $(DEP_PRE) -f -s -o $(dep) -t $(obj) -
126endef
127
128
129## Link library
130# @param $(target) Normalized main target name.
131# @param $(out) Library name.
132# @param $(objs) Object files to put in the library.
133# @param $(flags) Flags.
134# @param $(dirdep) Directory creation dependency.
135# @param $(deps) Other dependencies.
136# @param $(othersrc) Unhandled sources.
137# @param $(outbase) Output basename (full). Use this for list files and such.
138#
139TOOL_VCC70_LINK_LIBRARY_OUTPUT = $(outbase).lst $(outbase).exp $(call TOOL_VCC70_PDB, $(outbase))
140TOOL_VCC70_LINK_LIBRARY_DEPEND = $(othersrc)
141TOOL_VCC70_LINK_LIBRARY_DEPORD =
142define TOOL_VCC70_LINK_LIBRARY_CMDS
143 $(TOOL_VCC70_AR) $(flags) /OUT:$(out) $(subst /,\\,$(objs) $(filter %.a %.lib,$(othersrc))) \
144 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def))
145endef
146
147
148## Link program
149# @param $(target) Normalized main target name.
150# @param $(out) Program name.
151# @param $(objs) Object files to link together.
152# @param $(libs) Libraries to search.
153# @param $(libpath) Library search paths.
154# @param $(flags) Flags.
155# @param $(dirdep) Directory creation dependency.
156# @param $(deps) Other dependencies.
157# @param $(othersrc) Unhandled sources.
158# @param $(custom_pre) Custom step invoked before linking.
159# @param $(custom_post) Custom step invoked after linking.
160# @param $(outbase) Output basename (full). Use this for list files and such.
161#
162TOOL_VCC70_LINK_PROGRAM_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(call TOOL_VCC70_PDB, $(outbase)) $(outbase).ilk
163TOOL_VCC70_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
164TOOL_VCC70_LINK_PROGRAM_DEPORD =
165define TOOL_VCC70_LINK_PROGRAM_CMDS
166 $(TOOL_VCC70_LD) $(flags) \
167 /OUT:$(out) \
168 /MAPINFO:EXPORTS /MAPINFO:LINES \
169 /MAP:$(outbase).map \
170 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
171 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
172 $(foreach p,$(libpath), /LIBPATH:$(p)) \
173 $(subst /,\\,$(objs)) \
174 $(subst /,\\,$(libs))
175endef
176
177
178## Link DLL.
179# @param $(target) Normalized main target name.
180# @param $(out) DLL name.
181# @param $(objs) Object files to link together.
182# @param $(libs) Libraries to search.
183# @param $(libpath) Library search paths.
184# @param $(flags) Flags.
185# @param $(dirdep) Directory creation dependency.
186# @param $(deps) Other dependencies.
187# @param $(othersrc) Unhandled sources.
188# @param $(custom_pre) Custom step invoked before linking.
189# @param $(custom_post) Custom step invoked after linking.
190#
191# @param $(outbase) Output basename (full). Use this for list files and such.
192TOOL_VCC70_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(call TOOL_VCC70_PDB, $(outbase)) $(outbase).ilk
193TOOL_VCC70_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
194TOOL_VCC70_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_LIB))
195define TOOL_VCC70_LINK_DLL_CMDS
196 $(TOOL_VCC70_LD) $(flags) \
197 /OUT:$(out) \
198 /IMPLIB:$(outbase).lib \
199 /MAPINFO:EXPORTS /MAPINFO:LINES \
200 /MAP:$(outbase).map \
201 /DLL \
202 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
203 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
204 $(foreach p,$(libpath), /LIBPATH:$(p)) \
205 $(subst /,\\,$(objs)) \
206 $(subst /,\\,$(libs))
207ifeq ($(filter %.exp .def,$(othersrc)),)
208 if test -f $(outbase).exp; then $(CP_EXT) $(outbase).exp $(PATH_LIB)/; fi
209 if test -f $(outbase).lib; then $(CP_EXT) $(outbase).lib $(PATH_LIB)/; fi
210endif
211$(eval _DIRS += $(PATH_LIB))
212endef
213
214
215## Link system module (windows aka driver, linux aka kernel module)
216# @param $(target) Normalized main target name.
217# @param $(out) System module name.
218# @param $(objs) Object files to link together.
219# @param $(libs) Libraries to search.
220# @param $(libpath) Library search paths.
221# @param $(flags) Flags.
222# @param $(dirdep) Directory creation dependency.
223# @param $(deps) Other dependencies.
224# @param $(othersrc) Unhandled sources.
225# @param $(custom_pre) Custom step invoked before linking.
226# @param $(custom_post) Custom step invoked after linking.
227#
228# @param $(outbase) Output basename (full). Use this for list files and such.
229TOOL_VCC70_LINK_SYSMOD_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(call TOOL_VCC70_PDB, $(outbase)) $(outbase).ilk
230TOOL_VCC70_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
231TOOL_VCC70_LINK_SYSMOD_DEPORD =
232define TOOL_VCC70_LINK_SYSMOD_CMDS
233 $(TOOL_VCC70_LD) $(flags) \
234 /OUT:$(out) \
235 /MAPINFO:EXPORTS /MAPINFO:LINES \
236 /MAP:$(outbase).map \
237 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
238 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
239 $(foreach p,$(libpath), /LIBPATH:$(p)) \
240 $(subst /,\\,$(objs)) \
241 $(subst /,\\,$(libs))
242endef
243
Note: See TracBrowser for help on using the repository browser.