| 227 |
dpurdie |
1 |
# -*- mode: mak; -*-
|
|
|
2 |
###############################################################################
|
|
|
3 |
# File: TOOLSET/vcwin32.rul[e]
|
|
|
4 |
# Contents: Visual C/C++ WIN32 rules
|
|
|
5 |
#
|
|
|
6 |
###############################################################################
|
|
|
7 |
#.. Remove "undef" warnings
|
|
|
8 |
#
|
|
|
9 |
cc_includes +=
|
|
|
10 |
cc_defines +=
|
|
|
11 |
cxx_includes +=
|
|
|
12 |
cxx_defines +=
|
|
|
13 |
purecov_ld_flags +=
|
|
|
14 |
|
|
|
15 |
###############################################################################
|
|
|
16 |
#.. Parse user options
|
|
|
17 |
# Global options already parsed
|
|
|
18 |
# These options extend the global options
|
|
|
19 |
#
|
|
|
20 |
|
|
|
21 |
ifdef OPTIONS
|
|
|
22 |
|
|
|
23 |
ifneq "$(findstring purify,$(OPTIONS))" "" # Enable purify
|
|
|
24 |
else
|
|
|
25 |
ifneq "$(findstring purecov,$(OPTIONS))" "" # Enable pure coverage
|
|
|
26 |
purecov_ld_flags += FIXED:NO
|
|
|
27 |
endif
|
|
|
28 |
endif
|
|
|
29 |
|
|
|
30 |
ifneq "$(findstring ccdepend,$(OPTIONS))" "" # Build depends using CC
|
|
|
31 |
endif
|
|
|
32 |
|
|
|
33 |
ifneq "$(findstring wall,$(OPTIONS))" "" # Enable all warnings
|
|
|
34 |
USE_WALL = 1
|
|
|
35 |
endif
|
|
|
36 |
|
|
|
37 |
ifneq "$(findstring gensbr,$(OPTIONS))" "" # Generate Source Browser Files
|
|
|
38 |
GEN_SBR_FILES = 1
|
|
|
39 |
endif
|
|
|
40 |
|
|
|
41 |
endif
|
|
|
42 |
|
| 255 |
dpurdie |
43 |
################################################################################
|
|
|
44 |
# Define a macro to assist in selecting compiler options based on the
|
|
|
45 |
# type of compiler being being used. New versions of compilers will deprecate
|
|
|
46 |
# options or replace some
|
|
|
47 |
#
|
|
|
48 |
# select_co - Select Compiler Option
|
|
|
49 |
# - Arguments are for the different compilers as defined by VSCOMPILER
|
|
|
50 |
# VSCOMPILER in the range 1.. as defined in the .PL file
|
|
|
51 |
#
|
|
|
52 |
# Current usage
|
|
|
53 |
# 1 - vc6
|
|
|
54 |
# 2 - vc7
|
| 4192 |
dpurdie |
55 |
# 3 - vc8,vc9,vc10,vc12
|
| 255 |
dpurdie |
56 |
#
|
|
|
57 |
$(if $(VSCOMPILER),,$(error VCWIN32 toolset requires VSCOMPILER to be defined))
|
|
|
58 |
select_co = $(subst --,,$(word $(VSCOMPILER),$1 $2 $3))
|
|
|
59 |
|
| 227 |
dpurdie |
60 |
###############################################################################
|
|
|
61 |
# Standard library paths
|
|
|
62 |
# Export LIB as this is used by the compiler (#import) as well as the
|
|
|
63 |
# librarian and the linker. It is also used by the library generation
|
|
|
64 |
# process.
|
|
|
65 |
#
|
| 4192 |
dpurdie |
66 |
# VC_LIB - Lib paths from Compiler toolkit
|
| 255 |
dpurdie |
67 |
# - ';' seperated path list
|
|
|
68 |
# - Uses \ or / as a dir sep
|
|
|
69 |
# - Uses real spaces in pathnames
|
|
|
70 |
# - Should be Absolute Paths
|
|
|
71 |
#
|
| 4192 |
dpurdie |
72 |
# LIBDIRS - Lib paths from JATS
|
| 255 |
dpurdie |
73 |
# - Space seperated path list
|
|
|
74 |
# - Uses / as dir sep
|
|
|
75 |
# - Must not contain spaces
|
|
|
76 |
# - Will be Relative
|
|
|
77 |
#
|
|
|
78 |
# ALL_LIBDIRS and LIB
|
|
|
79 |
# - Only contain valid paths
|
|
|
80 |
# VS2005 will complain about bad LIB entries
|
|
|
81 |
# Use $(wildcard ...) to limit to test for existence
|
|
|
82 |
# - Contain absolute paths
|
|
|
83 |
# msdev/devenv don't work with relative paths
|
|
|
84 |
# Use $(abspath ...) to convert
|
|
|
85 |
#
|
|
|
86 |
# ALL_LIBDIRS - Used internally
|
|
|
87 |
# - Space seperated path list
|
|
|
88 |
# - Uses / as dir sep
|
|
|
89 |
# - Uses %20 as a altspace in pathnames
|
|
|
90 |
#
|
| 4192 |
dpurdie |
91 |
# LIB - Exported to tools
|
| 255 |
dpurdie |
92 |
# - ';' seperated path list
|
|
|
93 |
# - Uses \ as a dir sep
|
|
|
94 |
# - Uses real spaces in pathnames
|
| 227 |
dpurdie |
95 |
#..
|
|
|
96 |
|
| 255 |
dpurdie |
97 |
vc_libs := $(subst ;,$(space),$(subst \,/,$(subst $(space),$(spacealt),$(VC_LIB))))
|
|
|
98 |
ALL_LIBDIRS := $(wildcard $(call myabspath,$(LIBDIRS))) $(vc_libs)
|
|
|
99 |
LIB := $(subst $(spacealt),$(space),$(subst $(space),$(empty),$(patsubst %,%;,$(subst /,\,$(ALL_LIBDIRS)))))
|
| 227 |
dpurdie |
100 |
export LIB
|
|
|
101 |
|
| 255 |
dpurdie |
102 |
#one_per_line = $(foreach aa,$2,$(info $1 :: $(subst $(spacealt),$(space),$(aa))))
|
|
|
103 |
#$(call one_per_line,Good LIBDIRS,$(ALL_LIBDIRS))
|
|
|
104 |
|
| 227 |
dpurdie |
105 |
###############################################################################
|
|
|
106 |
#.. Compiler definitions
|
|
|
107 |
#
|
|
|
108 |
|
|
|
109 |
#.. C Compiler definition
|
|
|
110 |
#
|
|
|
111 |
|
|
|
112 |
# Standard defines
|
|
|
113 |
#
|
|
|
114 |
#..
|
|
|
115 |
vc_defines += -DWIN32 -D_WIN32
|
|
|
116 |
|
|
|
117 |
ifdef USE_JATS_V1
|
|
|
118 |
#.. These are the swicthes used by Jats Version-1
|
|
|
119 |
#
|
|
|
120 |
vc_defines += -D_WIN32_IE=0x0300 -DWINVER=0x0400 -D_WIN32_WINNT=0x0400
|
|
|
121 |
endif
|
|
|
122 |
|
|
|
123 |
|
|
|
124 |
#.. vc_defines += -D_WIN32_WINNT=0x0400 # force use of winsock2.h
|
|
|
125 |
#.. vc_defines += -DWINVER=0x0400 # default
|
|
|
126 |
#.. vc_defines += -D_WIN32_IE=0x0300 # default is 0400
|
|
|
127 |
#.. vc_defines += -DCRTAPI1=_cdecl # default
|
|
|
128 |
#.. vc_defines += -DCRTAPI2=_cdecl # default
|
|
|
129 |
#..
|
|
|
130 |
#.. if (TARGET) == NT
|
|
|
131 |
#.. vc_defines += -D_WINNT -D_WIN32_WINNT=0x0400
|
|
|
132 |
#.. elif (TARGET) == 95
|
|
|
133 |
#.. vc_defines += -D_WIN95 -D_WIN32_WINDOWS=0x400
|
|
|
134 |
#.. else GENERIC (default)
|
|
|
135 |
#.. endif
|
|
|
136 |
#.. if (CONSOLE)
|
|
|
137 |
#.. vc_defines += -D_CONSOLE -D_MBCS
|
|
|
138 |
#.. endif
|
|
|
139 |
|
|
|
140 |
#vc_defines += -D_MT # implied via -MD
|
|
|
141 |
vc_defines += -D_X86_=1 # assume target
|
|
|
142 |
|
|
|
143 |
ifdef ALVL
|
|
|
144 |
vc_defines += -DALVL=$(ALVL)
|
|
|
145 |
endif
|
|
|
146 |
ifdef DLVL
|
|
|
147 |
vc_defines += -DDLVL=$(DLVL)
|
|
|
148 |
endif
|
| 267 |
dpurdie |
149 |
|
|
|
150 |
#
|
|
|
151 |
# __SOURCE__ interferes with Windows Precompiled headers
|
|
|
152 |
# It can be disabled, but its not for backward compatability
|
|
|
153 |
#
|
|
|
154 |
ifndef DISABLE__SOURCE__
|
| 227 |
dpurdie |
155 |
vc_defines += -D__SOURCE__=\"$(notdir $<)\"
|
| 267 |
dpurdie |
156 |
endif
|
| 227 |
dpurdie |
157 |
|
|
|
158 |
# Standard flags
|
|
|
159 |
#
|
|
|
160 |
# Both compilers now use the same front end - you must still define either
|
|
|
161 |
# _X86_ or _ALPHA_. These have replaced the i386 and ALPHA definitions
|
|
|
162 |
# which are not ANSI compliant.
|
|
|
163 |
#
|
|
|
164 |
# Common compiler flags:
|
| 255 |
dpurdie |
165 |
# -c - compile without linking
|
|
|
166 |
# -W3 - Set warning level to level 3
|
|
|
167 |
# -Zi - generate debugging information
|
|
|
168 |
# -Zd - generate only public symbols and line numbers for debugging
|
|
|
169 |
# -Od - disable all optimizations
|
|
|
170 |
# -Ox - use maximum optimizations
|
|
|
171 |
# -Ge - enable stack checks
|
|
|
172 |
# -Gm - enable min builds
|
|
|
173 |
# -GX - (Deprecated: Use -EHsc) Enables synchronous exception handling (C++)
|
| 4192 |
dpurdie |
174 |
# -EHsc - Enables synchronous exception handling (C++)
|
| 255 |
dpurdie |
175 |
# -YX - (Deprecated: Don't use) Automatically generate precompiled headers
|
|
|
176 |
# -Yd - Place debug info within objects.
|
|
|
177 |
# -GZ - (Deprecated: Use -RTC1)Enable runtime debug checks
|
|
|
178 |
# -GR - Enables run-time type information (RTTI)
|
|
|
179 |
# -MD - Creates a multithreaded DLL, using MSVCRT.LIB
|
|
|
180 |
# -MDd - Creates a debug multithreaded DLL, using MSVCRTD.LIB
|
| 227 |
dpurdie |
181 |
#
|
|
|
182 |
# Output options:
|
|
|
183 |
# -Fo<file> name object file
|
|
|
184 |
# -Fp<file> name precompiled header file
|
|
|
185 |
# -Fd[file] name .PDB file
|
|
|
186 |
# -Fm[file] name map file
|
|
|
187 |
# -FR[file] name source browser file (Complete)
|
|
|
188 |
# -Fr[file] name source browser file (No locals)
|
|
|
189 |
#
|
|
|
190 |
# i386 specific compiler flags:
|
|
|
191 |
# -Gz - stdcall
|
|
|
192 |
# -Gd - cdecl
|
|
|
193 |
#
|
|
|
194 |
# Plus:
|
|
|
195 |
# -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl
|
|
|
196 |
# _X86_ | _MIPS_ | _PPC_
|
|
|
197 |
# WINNT | WIN95
|
|
|
198 |
# WINVER=0x0500 (5.0) | WINVER=0x0400 (4.0) | WINVER=0x030A (3.51)
|
|
|
199 |
# _MT
|
|
|
200 |
#
|
|
|
201 |
# Linker
|
|
|
202 |
# -MT[d] using MT safe C library
|
|
|
203 |
#
|
|
|
204 |
# ! Warning !
|
|
|
205 |
# If you are going to call C run-time routines from a program
|
|
|
206 |
# built with LIBCMT.LIB, you must start your threads with the
|
|
|
207 |
# _beginthread function. Do not use the Win32 functions
|
|
|
208 |
# ExitThread and CreateThread. Using SuspendThread can lead to
|
|
|
209 |
# a deadlock when more than one thread is blocked waiting for
|
|
|
210 |
# the suspend thread to complete its access to a C run-time
|
|
|
211 |
# data structure.
|
|
|
212 |
#..
|
|
|
213 |
vc_flags += -c -nologo
|
|
|
214 |
vc_flags += -GR
|
|
|
215 |
vc_flags += -Gd
|
| 255 |
dpurdie |
216 |
vc_flags += $(call select_co,-GX,-GX,-EHsc)
|
| 227 |
dpurdie |
217 |
ifdef USE_WALL
|
|
|
218 |
vc_flags += -W4
|
|
|
219 |
else
|
|
|
220 |
vc_flags += -W3
|
|
|
221 |
endif
|
|
|
222 |
|
|
|
223 |
vc_compile_flags = -TC # Force C unless otherwise demanded
|
|
|
224 |
ifdef FORCE_C_COMPILE
|
|
|
225 |
vc_compile_flags = -TC
|
|
|
226 |
endif
|
|
|
227 |
|
|
|
228 |
ifdef FORCE_CC_COMPILE
|
|
|
229 |
vc_compile_flags = -TP
|
|
|
230 |
endif
|
|
|
231 |
|
|
|
232 |
ifdef USE_OPTIMISE # default for production
|
|
|
233 |
vc_flags += -Od # Don't optimise production code. Too many problems. Ship what we test
|
|
|
234 |
else
|
|
|
235 |
vc_flags += -Od
|
|
|
236 |
endif
|
|
|
237 |
|
|
|
238 |
ifdef USE_DEBUGINFO # default for debug
|
| 255 |
dpurdie |
239 |
vc_flags += $(call select_co,-GZ,-GZ,-RTC1)
|
| 227 |
dpurdie |
240 |
vc_defines += -DDEBUG
|
|
|
241 |
else
|
|
|
242 |
vc_flags +=
|
|
|
243 |
endif
|
|
|
244 |
|
|
|
245 |
ifdef LEAVETMP # Create an assembly listing
|
|
|
246 |
vc_flags += -FAs -Fa$(subst /,\\,$(basename $@).src)
|
|
|
247 |
endif
|
|
|
248 |
|
|
|
249 |
ifndef THREADMODE
|
|
|
250 |
THREADMODE = "D"
|
|
|
251 |
endif
|
|
|
252 |
|
|
|
253 |
ifeq "$(DEBUG)" "1" # debug/prod specific
|
|
|
254 |
vc_flags += -M$(THREADMODE)d
|
|
|
255 |
vc_defines += -D_DEBUG
|
|
|
256 |
else
|
|
|
257 |
vc_flags += -M$(THREADMODE)
|
|
|
258 |
vc_defines += -DNDEBUG
|
|
|
259 |
endif
|
|
|
260 |
|
|
|
261 |
ifdef USE_STRICT_ANSI # default OFF
|
|
|
262 |
vc_flags += -Za
|
|
|
263 |
else
|
|
|
264 |
vc_flags +=
|
|
|
265 |
endif
|
|
|
266 |
|
|
|
267 |
ifdef USE_RTTI
|
|
|
268 |
vc_flags += -GR
|
|
|
269 |
endif
|
|
|
270 |
|
|
|
271 |
ifndef PDB_NONE # Supress PDB generation
|
|
|
272 |
vc_flags += -Zi
|
|
|
273 |
endif
|
|
|
274 |
|
|
|
275 |
ifdef PRECOMPILEHDRS # Precompile headers
|
| 255 |
dpurdie |
276 |
vc_flags += $(call select_co,-YX,-YX,--)
|
| 227 |
dpurdie |
277 |
endif
|
|
|
278 |
|
|
|
279 |
vc_flags += -Fp$(subst /,\\,$(OBJDIR)/)
|
|
|
280 |
vc_flags += -Fd$(subst /,\\,$(PDB))
|
|
|
281 |
|
|
|
282 |
ifdef GEN_SBR_FILES
|
|
|
283 |
vc_flags += -FR$(subst /,\\,$(basename $@).sbr)
|
|
|
284 |
endif
|
|
|
285 |
|
| 4928 |
dpurdie |
286 |
ifdef WARNINGS_AS_ERRORS
|
|
|
287 |
vc_flags += -WX
|
|
|
288 |
endif
|
|
|
289 |
|
|
|
290 |
|
| 347 |
dpurdie |
291 |
SHCFLAGS += $(call select_co,-GD,--,--)
|
|
|
292 |
SHCXXFLAGS += $(call select_co,-GD,--,--)
|
| 227 |
dpurdie |
293 |
|
|
|
294 |
# Standard includes
|
| 255 |
dpurdie |
295 |
# INCLUDE - a ';' seperated list of paths
|
|
|
296 |
# vc_include - a 'space' seperated list of paths
|
|
|
297 |
# - Using / for path sep
|
|
|
298 |
# - Using 'spacealt'(%20) for 'space' placeholder
|
| 227 |
dpurdie |
299 |
#..
|
|
|
300 |
vc_includes =\
|
|
|
301 |
$(subst ;,$(space),$(subst \,/,$(subst $(space),$(spacealt),$(INCLUDE))))
|
|
|
302 |
|
|
|
303 |
# Command
|
|
|
304 |
#
|
|
|
305 |
#..
|
|
|
306 |
cc = $(CC_PRE) cl
|
|
|
307 |
cc_init =
|
|
|
308 |
cc_o_switch = $(subst /,\\,-Fo$@)
|
|
|
309 |
cc_source = $(subst /,\\,$<)
|
|
|
310 |
# CFLAGS must follow vc_flags to build with netbula headers
|
|
|
311 |
# these should be the ONLY c files that must be built with the C compiler
|
|
|
312 |
# until netbula support the C++ compiler
|
|
|
313 |
cc_flags = \
|
|
|
314 |
$(strip $(vc_compile_flags)) \
|
|
|
315 |
$(strip $(patsubst %,%,$(vc_flags))) \
|
|
|
316 |
$(strip $(patsubst %,%,$(vc_defines))) \
|
|
|
317 |
$(patsubst %,%,$(CFLAGS)) \
|
|
|
318 |
$(patsubst %,-D%,$(cc_defines)) \
|
| 255 |
dpurdie |
319 |
$(subst $(spacealt),$(space),$(patsubst %,"-I%",$(subst /,\,$(INCDIRS)))) \
|
|
|
320 |
$(subst $(spacealt),$(space),$(patsubst %,"-I%",$(subst /,\,$(cc_includes)))) \
|
|
|
321 |
$(subst $(spacealt),$(space),$(patsubst %,"-I%",$(subst /,\,$(vc_includes))))
|
| 227 |
dpurdie |
322 |
cc_term =
|
|
|
323 |
|
|
|
324 |
define cc_pre
|
| 6177 |
dpurdie |
325 |
@$(echo) '[$<] Compiling..'
|
| 227 |
dpurdie |
326 |
endef
|
|
|
327 |
|
|
|
328 |
# Note: The compiler gets the case of the PDB file
|
|
|
329 |
# wrong, force to be mixed case. Also generating of the
|
|
|
330 |
# PDB image is optional based on debugging options, must
|
|
|
331 |
# test if file exists.
|
|
|
332 |
#
|
|
|
333 |
# Leave the $(PDB).tmp file otherwise clearaudit gets upset
|
|
|
334 |
#
|
|
|
335 |
define cc_post
|
|
|
336 |
@if [ -f $(PDB) ]; then \
|
|
|
337 |
$(rm) -f $(PDB).tmp; \
|
|
|
338 |
$(mv) $(PDB) $(PDB).tmp; \
|
|
|
339 |
$(cp) $(PDB).tmp $(PDB); \
|
|
|
340 |
fi
|
|
|
341 |
endef
|
|
|
342 |
|
|
|
343 |
cc_filter := "$(notdir $(wildcard $(GBE_ROOT)/warnings.visualc))"
|
|
|
344 |
ifeq ($(strip $(cc_filter)), "warnings.visualc")
|
|
|
345 |
cc_filter = $(GBE_ROOT)/warnings.visualc
|
|
|
346 |
else
|
|
|
347 |
cc_filter =
|
|
|
348 |
endif
|
|
|
349 |
|
|
|
350 |
ifdef cc_filter
|
|
|
351 |
cc_redirect_stderr = 1
|
|
|
352 |
cc_error_filter = $(awk) -f $(cc_filter)
|
|
|
353 |
endif
|
|
|
354 |
|
|
|
355 |
|
|
|
356 |
###############################################################################
|
|
|
357 |
#.. C/C++ dependencies
|
|
|
358 |
# depend and depend.err
|
|
|
359 |
#
|
| 4814 |
dpurdie |
360 |
# Definitions provided by the compiler.
|
|
|
361 |
# Need to mimic them for dependency generation
|
|
|
362 |
#
|
| 227 |
dpurdie |
363 |
vc_depend = -D_MSC_VER=1200 -D_MSC_EXTENSIONS=1
|
|
|
364 |
vc_depend += -D_MT
|
|
|
365 |
vc_depend += -D_X86_=1 -D_M_IX86=300
|
|
|
366 |
vc_depend += -D_INTEGRAL_MAX_BITS=64
|
|
|
367 |
|
|
|
368 |
ccdep = $(XX_PRE) $(GBE_BIN)/mkdepend
|
|
|
369 |
ccdep_init =
|
|
|
370 |
ccdep_o_switch = -f -
|
|
|
371 |
ccdep_source = $(filter %.c %.cc %.cpp, $+) > $@ 2> $@.err
|
|
|
372 |
ccdep_flags = -MM -b -We -p '$$(OBJDIR)/' \
|
|
|
373 |
$(foreach shname,$(SHNAMES),-p '$$(OBJDIR)/$(shname)/') \
|
|
|
374 |
-o ".$(o)" \
|
|
|
375 |
$(patsubst %,%,$(vc_depend)) \
|
|
|
376 |
$(patsubst %,%,$(vc_defines)) \
|
|
|
377 |
$(patsubst %,%,$(CFLAGS)) \
|
|
|
378 |
$(patsubst %,%,$(CXXFLAGS)) \
|
|
|
379 |
$(patsubst %,-D%,$(cc_defines)) \
|
|
|
380 |
$(patsubst %,-D%,$(cxx_defines)) \
|
|
|
381 |
$(subst $(spacealt),$(space),$(patsubst %,-I"%",$(subst /,\,$(INCDIRS)))) \
|
|
|
382 |
$(subst $(spacealt),$(space),$(patsubst %,-I"%",$(subst /,\,$(cc_includes)))) \
|
|
|
383 |
$(subst $(spacealt),$(space),$(patsubst %,-Y"%",$(subst /,\,$(vc_includes)))) \
|
|
|
384 |
$(patsubst %,-Y %,$(NODEPDIRS))
|
|
|
385 |
|
|
|
386 |
ccdep_pre =
|
|
|
387 |
ccdep_post =
|
|
|
388 |
|
|
|
389 |
#.. C/C++ Lint definitions
|
|
|
390 |
# -D Definition is not allowed: PCLINT does not like the space
|
|
|
391 |
#
|
|
|
392 |
lint_flags += \
|
|
|
393 |
$(patsubst %,%,$(vc_depend)) \
|
|
|
394 |
$(subst -D$(space),-D,$(patsubst %,%,$(vc_defines))) \
|
|
|
395 |
$(patsubst %,%,$(CLINTFLAGS)) \
|
|
|
396 |
$(patsubst %,-D%,$(cc_defines)) \
|
|
|
397 |
$(subst $(spacealt),$(space),$(patsubst %,-I"%",$(INCDIRS))) \
|
|
|
398 |
$(subst $(spacealt),$(space),$(patsubst %,-I"%",$(cc_includes))) \
|
|
|
399 |
$(subst $(spacealt),$(space),$(patsubst %,-I"%",$(vc_includes)))
|
|
|
400 |
|
|
|
401 |
lint_libpath = $(LIB)
|
|
|
402 |
|
|
|
403 |
#.. C++ Compiler definitions
|
|
|
404 |
#
|
|
|
405 |
cxx = $(CC_PRE) cl
|
|
|
406 |
cxx_init =
|
|
|
407 |
cxx_o_switch = $(subst /,\\,-Fo$@)
|
|
|
408 |
cxx_source = $(subst /,\\,$<)
|
|
|
409 |
# CXXFLAGS must follow vc_flags to build with netbula headers
|
|
|
410 |
# these should be the ONLY c files that must be built with the C compiler
|
|
|
411 |
# until netbula support the C++ compiler
|
|
|
412 |
cxx_flags = -TP \
|
|
|
413 |
$(patsubst %,%,$(vc_flags)) \
|
|
|
414 |
$(patsubst %,%,$(vc_defines)) \
|
|
|
415 |
$(patsubst %,%,$(CXXFLAGS)) \
|
|
|
416 |
$(patsubst %,-D%,$(cxx_defines)) \
|
|
|
417 |
$(subst $(spacealt),$(space),$(patsubst %,-I"%",$(subst /,\,$(INCDIRS)))) \
|
|
|
418 |
$(subst $(spacealt),$(space),$(patsubst %,-I"%",$(subst /,\,$(cxx_includes)))) \
|
|
|
419 |
$(subst $(spacealt),$(space),$(patsubst %,-I"%",$(subst /,\,$(vc_includes))))
|
|
|
420 |
cxx_term =
|
|
|
421 |
|
|
|
422 |
define cxx_pre
|
| 6177 |
dpurdie |
423 |
@echo '[$<] compiling..'
|
| 227 |
dpurdie |
424 |
endef
|
|
|
425 |
|
|
|
426 |
define cxx_post
|
|
|
427 |
endef
|
|
|
428 |
|
|
|
429 |
|
|
|
430 |
###############################################################################
|
|
|
431 |
#.. Assembler definition
|
|
|
432 |
#
|
|
|
433 |
|
|
|
434 |
#.. Assembler (Microsoft 6.11)
|
|
|
435 |
#
|
|
|
436 |
as = $(XX_PRE) ml
|
|
|
437 |
as_init =
|
|
|
438 |
as_i_switch = /I
|
|
|
439 |
as_o_switch = /Fo$(subst /,\\,$@)
|
|
|
440 |
as_source = $(subst /,\\,$<)
|
|
|
441 |
as_cmdfile = $(subst /,\\,$(basename $@).cmd)
|
|
|
442 |
as_flags = @$(as_cmdfile)
|
|
|
443 |
as_term =
|
|
|
444 |
|
|
|
445 |
as_includes += $(masm)/include
|
|
|
446 |
as_defines +=
|
|
|
447 |
|
|
|
448 |
ml_flags = /c /Zm /Cp /X
|
|
|
449 |
ifeq "$(DEBUG)" "1"
|
|
|
450 |
ml_flags += /W2 /Zd /DDEBUG
|
|
|
451 |
endif
|
|
|
452 |
ifdef DLVL
|
|
|
453 |
ml_flags += /DDLVL=$(DLVL)
|
|
|
454 |
endif
|
|
|
455 |
ifdef ALVL
|
|
|
456 |
ml_flags += /DALVL=$(ALVL)
|
|
|
457 |
endif
|
|
|
458 |
as_defines := $(addprefix /D,$(as_defines))
|
|
|
459 |
as_defines += $(ml_flags)
|
|
|
460 |
|
|
|
461 |
define as_pre
|
| 6177 |
dpurdie |
462 |
$(AA_PRE)$(cmdfile) -wko$(as_cmdfile) "\
|
| 227 |
dpurdie |
463 |
$(patsubst %,%\\n,$(ASFLAGS)) \
|
|
|
464 |
$(patsubst %,%\\n,$(as_defines)) \
|
|
|
465 |
$(patsubst %,$(as_i_switch)%\\n,$(subst /,\\\\,$(INCLUDES))) \
|
| 303 |
dpurdie |
466 |
$(patsubst %,$(as_i_switch)%\\n,$(subst /,\\\\,$(as_includes)))";\
|
|
|
467 |
$(call show_cmdfile,$(as_cmdfile))
|
| 227 |
dpurdie |
468 |
endef
|
|
|
469 |
|
|
|
470 |
ifndef LEAVETMP
|
|
|
471 |
define as_post
|
|
|
472 |
@$(rm) -f $(as_cmdfile)
|
|
|
473 |
endef
|
|
|
474 |
else
|
|
|
475 |
define as_post
|
|
|
476 |
endef
|
|
|
477 |
endif
|
|
|
478 |
|
|
|
479 |
|
|
|
480 |
###############################################################################
|
|
|
481 |
#.. Archiver definition
|
|
|
482 |
#
|
|
|
483 |
|
|
|
484 |
#.. Archiver
|
|
|
485 |
#
|
|
|
486 |
ar = $(XX_PRE)lib
|
|
|
487 |
ar_init =
|
|
|
488 |
ar_flags = -nologo -machine:IX86
|
|
|
489 |
ifeq "$(DEBUG)" "1"
|
| 347 |
dpurdie |
490 |
ar_flags += $(call select_co,-debugtype:cv,--,--)
|
| 227 |
dpurdie |
491 |
endif
|
|
|
492 |
|
|
|
493 |
LIBDEF +=
|
|
|
494 |
ar_flags += $(patsubst %,-def:%,$(LIBDEF))
|
|
|
495 |
LIBNAME +=
|
|
|
496 |
ar_flags += $(patsubst %,-name:%,$(LIBNAME))
|
|
|
497 |
ar_o_switch = -out:$(subst /,\\,$@) $(subst /,\\,$(filter %.obj,$^)) $(subst /,\\,$(filter %.res,$^))
|
|
|
498 |
ar_term =
|
|
|
499 |
|
|
|
500 |
define ar_pre
|
| 6177 |
dpurdie |
501 |
echo '[$@] Building library ..';
|
| 227 |
dpurdie |
502 |
endef
|
|
|
503 |
|
|
|
504 |
define ar_post
|
|
|
505 |
endef
|
|
|
506 |
|
|
|
507 |
|
|
|
508 |
#.. Archive Merge
|
|
|
509 |
#
|
|
|
510 |
armerge = $(XX_PRE) $(GBE_TOOLS)/armerge
|
|
|
511 |
armerge_init =
|
|
|
512 |
armerge_cmdfile =
|
| 261 |
dpurdie |
513 |
armerge_flags = -d $(MLIBDIR) -t MSVC
|
| 227 |
dpurdie |
514 |
armerge_o_switch= $(subst /,\\,$@) $(subst /,\\,$^)
|
|
|
515 |
|
|
|
516 |
define armerge_pre
|
| 6177 |
dpurdie |
517 |
-echo '[$@] Merging library ..'; $(rm) -f $@
|
| 227 |
dpurdie |
518 |
endef
|
|
|
519 |
armerge_post =
|
|
|
520 |
|
|
|
521 |
###############################################################################
|
|
|
522 |
#.. Linker
|
|
|
523 |
#
|
|
|
524 |
|
|
|
525 |
# Standard flags
|
|
|
526 |
#
|
|
|
527 |
#..
|
|
|
528 |
vc_ldflags = \
|
|
|
529 |
-nologo\\n\
|
|
|
530 |
-incremental:no\\n\
|
| 255 |
dpurdie |
531 |
-debug\\n\
|
|
|
532 |
$(subst $(spacealt),$(space),$(patsubst %,-libpath:\"%\"\\n,$(subst /,\\\\,$(ALL_LIBDIRS))))\
|
| 7010 |
dpurdie |
533 |
$(subst $(spacealt),$(space),$(patsubst %,\"-%\"\\n,$(LDFLAGS)))\
|
| 227 |
dpurdie |
534 |
$(patsubst %,-%\\n,$(purecov_ld_flags))
|
|
|
535 |
|
|
|
536 |
ifdef LDSUBSYSTEM
|
|
|
537 |
vc_ldflags += -subsystem:$(LDSUBSYSTEM)\\n
|
|
|
538 |
endif
|
|
|
539 |
|
|
|
540 |
#.. Shared library (dll)
|
|
|
541 |
#
|
|
|
542 |
|
|
|
543 |
shld = $(CC_PRE) link
|
|
|
544 |
shld_cmdfile = $(subst /,\\,$(basename $@).ld)
|
|
|
545 |
shld_flags =
|
|
|
546 |
shld_o_switch = @$(shld_cmdfile)
|
|
|
547 |
shld_term =
|
|
|
548 |
|
|
|
549 |
define shld_pre
|
| 6177 |
dpurdie |
550 |
$(AA_PRE)$(cmdfile) -wkWeo$(shld_cmdfile) \
|
| 227 |
dpurdie |
551 |
"$(vc_ldflags) $($(notdir $(SHBASE))_shld)"; \
|
| 6177 |
dpurdie |
552 |
echo '[$@] Linking shared library ..';\
|
| 303 |
dpurdie |
553 |
$(call show_cmdfile,$(shld_cmdfile))
|
| 227 |
dpurdie |
554 |
endef
|
|
|
555 |
|
|
|
556 |
ifndef LEAVETMP
|
|
|
557 |
define shld_post
|
|
|
558 |
@$(rm) -f $(shld_cmdfile)
|
|
|
559 |
endef
|
|
|
560 |
else
|
|
|
561 |
define shld_post
|
|
|
562 |
endef
|
|
|
563 |
endif
|
|
|
564 |
|
|
|
565 |
define SHLDDEPEND
|
| 6177 |
dpurdie |
566 |
$(AA_PRE)$(cmdfile) -wkWeo$(@) "$($(DPLIST))"
|
| 227 |
dpurdie |
567 |
endef
|
|
|
568 |
|
|
|
569 |
#.. Application
|
|
|
570 |
#
|
|
|
571 |
|
|
|
572 |
ld = $(CC_PRE) link
|
|
|
573 |
ld_cmdfile = $(subst /,\\,$(basename $@).ld)
|
|
|
574 |
ld_flags =
|
|
|
575 |
ld_o_switch = @$(ld_cmdfile)
|
|
|
576 |
ld_term =
|
|
|
577 |
|
|
|
578 |
define ld_pre
|
| 6177 |
dpurdie |
579 |
$(AA_PRE)$(cmdfile) -wkWeo$(ld_cmdfile) \
|
| 227 |
dpurdie |
580 |
"$(vc_ldflags) $($(notdir $(basename $@))_ld)"; \
|
| 6177 |
dpurdie |
581 |
echo '[$@] Linking application ..';\
|
| 303 |
dpurdie |
582 |
$(call show_cmdfile,$(ld_cmdfile))
|
| 227 |
dpurdie |
583 |
endef
|
|
|
584 |
|
|
|
585 |
ifndef LEAVETMP
|
|
|
586 |
define ld_post
|
|
|
587 |
@$(rm) -f $(ld_cmdfile)
|
|
|
588 |
endef
|
|
|
589 |
else
|
|
|
590 |
define ld_post
|
|
|
591 |
endef
|
|
|
592 |
endif
|
|
|
593 |
|
|
|
594 |
define LDDEPEND
|
| 6177 |
dpurdie |
595 |
$(AA_PRE)$(cmdfile) -wkWeo$(@) "$($(DPLIST))"
|
| 227 |
dpurdie |
596 |
endef
|
|
|
597 |
|
|
|
598 |
#.. Resource Compiler
|
|
|
599 |
# Convert a .rc file into a .res file
|
|
|
600 |
# Set up the INCLUDE envar to conatin the path to locate required
|
|
|
601 |
# files and the local and interface directories then the compiler directories
|
|
|
602 |
#
|
|
|
603 |
# Currently RC has a limit of 100 include paths to seach
|
|
|
604 |
# Simply limit the list to the system paths and the directories
|
|
|
605 |
# required by the prerequisite files
|
|
|
606 |
#
|
|
|
607 |
rc_defines = $(subst -D,/d ,$(vc_defines))
|
|
|
608 |
rc_dirs = $(subst /,\,$(sort $(dir $^)))
|
|
|
609 |
rc_dirs += $(LINCDIRS)
|
|
|
610 |
rc_dirs += $(vc_includes)
|
|
|
611 |
rc_include = $(subst $(spacealt),$(space),$(subst $(space),$(empty),$(patsubst %,%;,$(subst /,\,$(rc_dirs)))))
|
|
|
612 |
rc_include1 = $(subst \;,;,$(rc_include))
|
|
|
613 |
|
|
|
614 |
define RC
|
| 6177 |
dpurdie |
615 |
@$(echo) '[$@] Compile Resource File ..'
|
| 227 |
dpurdie |
616 |
@$(show_environment)
|
|
|
617 |
$(XX_PRE) export INCLUDE; INCLUDE="$(rc_include1)"; \
|
|
|
618 |
RC /l 0xC09 $(rc_defines) /fo $(subst /,\\,$@) $(subst /,\\,$<)
|
|
|
619 |
endef
|
|
|
620 |
|
|
|
621 |
#.. Browser Information
|
|
|
622 |
# Create a .BSC file from many .SBR files
|
|
|
623 |
# Filter out non .SBR files to assist in rule creation
|
|
|
624 |
#
|
|
|
625 |
define BSCMAKE
|
| 6177 |
dpurdie |
626 |
@$(echo) '[$@] Create Source Browser Information ..'
|
| 227 |
dpurdie |
627 |
@$(show_environment)
|
|
|
628 |
$(XX_PRE) bscmake -nologo -n -o $(subst /,\\,$@) $(subst /,\\,$(filter %.sbr,$^))
|
|
|
629 |
endef
|
|
|
630 |
|
|
|
631 |
#
|