Subversion Repositories DevTools

Rev

Rev 227 | Rev 261 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 227 Rev 255
Line 52... Line 52...
52
GEN_SBR_FILES	= 1
52
GEN_SBR_FILES	= 1
53
endif
53
endif
54
 
54
 
55
endif
55
endif
56
 
56
 
-
 
57
################################################################################
-
 
58
#   Define a macro to assist in selecting compiler options based on the
-
 
59
#   type of compiler being being used. New versions of compilers will deprecate
-
 
60
#   options or replace some
-
 
61
#
-
 
62
#   select_co	- Select Compiler Option
-
 
63
#		- Arguments are for the different compilers as defined by VSCOMPILER
-
 
64
#		  VSCOMPILER in the range 1.. as defined in the .PL file
-
 
65
#
-
 
66
#		  Current usage
-
 
67
#			1 - vc6
-
 
68
#			2 - vc7
-
 
69
#			3 - vc8
-
 
70
#
-
 
71
$(if $(VSCOMPILER),,$(error VCWIN32 toolset requires VSCOMPILER to be defined))
-
 
72
select_co = $(subst --,,$(word $(VSCOMPILER),$1 $2 $3))
-
 
73
 
57
###############################################################################
74
###############################################################################
58
#   Standard library paths
75
#   Standard library paths
59
#   Export LIB as this is used by the compiler (#import) as well as the
76
#   Export LIB as this is used by the compiler (#import) as well as the
60
#   librarian and the linker. It is also used by the library generation
77
#   librarian and the linker. It is also used by the library generation
61
#   process.
78
#   process.
62
#
79
#
-
 
80
#	VC_LIB	    - Lib paths from Compiler toolkit
-
 
81
#		    - ';' seperated path list
-
 
82
#		    - Uses \ or / as a dir sep
-
 
83
#		    - Uses real spaces in pathnames
-
 
84
#		    - Should be Absolute Paths
-
 
85
#                   
-
 
86
#	LIBDIRS	    - Lib paths from JATS
-
 
87
#		    - Space seperated path list
-
 
88
#		    - Uses / as dir sep
-
 
89
#		    - Must not contain spaces
-
 
90
#		    - Will be Relative
-
 
91
#
-
 
92
#	ALL_LIBDIRS and LIB
-
 
93
#		    - Only contain valid paths
-
 
94
#		      VS2005 will complain about bad LIB entries
-
 
95
#		      Use $(wildcard ...) to limit to test for existence
-
 
96
#		    - Contain absolute paths
-
 
97
#		      msdev/devenv don't work with relative paths
-
 
98
#		      Use $(abspath ...) to convert
-
 
99
#
-
 
100
#	ALL_LIBDIRS - Used internally
-
 
101
#		    - Space seperated path list
-
 
102
#		    - Uses / as dir sep
-
 
103
#		    - Uses %20 as a altspace in pathnames
-
 
104
#                   
-
 
105
#	LIB         - Exported to tools
-
 
106
#		    - ';' seperated path list
-
 
107
#		    - Uses \ as a dir sep
-
 
108
#		    - Uses real spaces in pathnames
63
#..
109
#..
64
vc_libs		=\
-
 
65
		$(subst ;,$(space),$(subst \,/,$(subst $(space),$(spacealt),$(VC_LIB))))
-
 
66
 
-
 
67
ALL_LIBDIRS = $(LIBDIRS);$(vc_libs)
-
 
68
LIB		=\
-
 
69
		$(subst $(spacealt),$(space),$(subst $(space),$(empty),$(patsubst %,%;,$(subst /,\,$(ALL_LIBDIRS)))))
-
 
70
 
110
 
-
 
111
#
-
 
112
#   Work around for a bug in make 3.81 where abspath assumes that the input
-
 
113
#   is a relative path. The work around checks for paths that have a : or start
-
 
114
#   with a '/ - and assumes these are absolute.
-
 
115
#   It will only call makes 'abspath' for relative paths.
-
 
116
#
-
 
117
myabspath = $(foreach dir,$1,$(call myabs1path,$(dir)))
-
 
118
myabs1path = $(if $(or $(findstring :,$1),$(filter /%,$1)),$1,$(abspath $1))
-
 
119
 
-
 
120
vc_libs     := $(subst ;,$(space),$(subst \,/,$(subst $(space),$(spacealt),$(VC_LIB))))
-
 
121
ALL_LIBDIRS := $(wildcard $(call myabspath,$(LIBDIRS))) $(vc_libs)
-
 
122
LIB         := $(subst $(spacealt),$(space),$(subst $(space),$(empty),$(patsubst %,%;,$(subst /,\,$(ALL_LIBDIRS)))))
71
export LIB
123
export LIB
72
 
124
 
-
 
125
#one_per_line = $(foreach aa,$2,$(info $1 :: $(subst $(spacealt),$(space),$(aa))))
-
 
126
#$(call one_per_line,Good LIBDIRS,$(ALL_LIBDIRS))
-
 
127
 
73
###############################################################################
128
###############################################################################
74
#..     Compiler definitions
129
#..     Compiler definitions
75
#
130
#
76
 
131
 
77
#..     C Compiler definition
132
#..     C Compiler definition
Line 121... Line 176...
121
	# Both compilers now use the same front end - you must still define either
176
	# Both compilers now use the same front end - you must still define either
122
	# _X86_ or _ALPHA_.  These have replaced the i386 and ALPHA definitions
177
	# _X86_ or _ALPHA_.  These have replaced the i386 and ALPHA definitions
123
	# which are not ANSI compliant.
178
	# which are not ANSI compliant.
124
	#
179
	#
125
	# Common compiler flags:
180
	# Common compiler flags:
126
	#   -c   - compile without linking
181
	#   -c    - compile without linking
127
	#   -W3  - Set warning level to level 3
182
	#   -W3   - Set warning level to level 3
128
	#   -Zi  - generate debugging information
183
	#   -Zi   - generate debugging information
129
	#   -Zd  - generate only public symbols and line numbers for debugging
184
	#   -Zd   - generate only public symbols and line numbers for debugging
130
	#   -Od  - disable all optimizations
185
	#   -Od   - disable all optimizations
131
	#   -Ox  - use maximum optimizations
186
	#   -Ox   - use maximum optimizations
132
	#   -Ge  - enable stack checks
187
	#   -Ge   - enable stack checks
133
	#   -Gm  - enable min builds
188
	#   -Gm   - enable min builds
-
 
189
	#   -GX   - (Deprecated: Use -EHsc) Enables synchronous exception handling (C++)
134
	#   -GX  - Enables synchronous exception handling (C++)
190
        #   -EHsc - Enables synchronous exception handling (C++)
135
	#   -YX  - generate precompiled headers
191
	#   -YX   - (Deprecated: Don't use) Automatically generate precompiled headers
136
	#   -Yd  - Place debug info within objects.
192
	#   -Yd   - Place debug info within objects.
137
	#   -GZ  - enable runtime debug checks
193
	#   -GZ   - (Deprecated: Use -RTC1)Enable runtime debug checks
138
	#   -GR  - Enables run-time type information (RTTI)
194
	#   -GR   - Enables run-time type information (RTTI)
139
	#   -MD  - Creates a multithreaded DLL, using MSVCRT.LIB
195
	#   -MD   - Creates a multithreaded DLL, using MSVCRT.LIB
140
	#   -MDd - Creates a debug multithreaded DLL, using MSVCRTD.LIB
196
	#   -MDd  - Creates a debug multithreaded DLL, using MSVCRTD.LIB
141
	#
197
	#
142
	# Output options:
198
	# Output options:
143
	#   -Fo<file>      name object file
199
	#   -Fo<file>      name object file
144
	#   -Fp<file>      name precompiled header file
200
	#   -Fp<file>      name precompiled header file
145
	#   -Fd[file]      name .PDB file
201
	#   -Fd[file]      name .PDB file
Line 171... Line 227...
171
	#   data structure.
227
	#   data structure.
172
	#..
228
	#..
173
vc_flags	+= -c -nologo
229
vc_flags	+= -c -nologo
174
vc_flags	+= -GR
230
vc_flags	+= -GR
175
vc_flags	+= -Gd
231
vc_flags	+= -Gd
176
vc_flags	+= -GX
232
vc_flags	+= $(call select_co,-GX,-GX,-EHsc)
177
ifdef USE_WALL
233
ifdef USE_WALL
178
vc_flags	+= -W4
234
vc_flags	+= -W4
179
else
235
else
180
vc_flags	+= -W3
236
vc_flags	+= -W3
181
endif
237
endif
Line 194... Line 250...
194
else
250
else
195
vc_flags	+= -Od
251
vc_flags	+= -Od
196
endif
252
endif
197
 
253
 
198
ifdef USE_DEBUGINFO				# default for debug
254
ifdef USE_DEBUGINFO				# default for debug
199
vc_flags	+= -GZ
255
vc_flags	+= $(call select_co,-GZ,-GZ,-RTC1)
200
vc_defines	+= -DDEBUG
256
vc_defines	+= -DDEBUG
201
else
257
else
202
vc_flags	+=
258
vc_flags	+=
203
endif
259
endif
204
 
260
 
Line 231... Line 287...
231
ifndef PDB_NONE                 		# Supress PDB generation
287
ifndef PDB_NONE                 		# Supress PDB generation
232
vc_flags	+= -Zi
288
vc_flags	+= -Zi
233
endif
289
endif
234
 
290
 
235
ifdef PRECOMPILEHDRS                           	# Precompile headers
291
ifdef PRECOMPILEHDRS                           	# Precompile headers
236
vc_flags	+= -YX
292
vc_flags	+= $(call select_co,-YX,-YX,--)
237
endif
293
endif
238
 
294
 
239
vc_flags	+= -Fp$(subst /,\\,$(OBJDIR)/)
295
vc_flags	+= -Fp$(subst /,\\,$(OBJDIR)/)
240
vc_flags	+= -Fd$(subst /,\\,$(PDB))
296
vc_flags	+= -Fd$(subst /,\\,$(PDB))
241
 
297
 
Line 245... Line 301...
245
 
301
 
246
SHCFLAGS	+= -GD
302
SHCFLAGS	+= -GD
247
SHCXXFLAGS	+= -GD
303
SHCXXFLAGS	+= -GD
248
 
304
 
249
	# Standard includes
305
	# Standard includes
250
	#
-
 
-
 
306
	# INCLUDE    - a ';' seperated list of paths
-
 
307
        # vc_include - a 'space' seperated list of paths
-
 
308
        #            - Using / for path sep
-
 
309
        #            - Using 'spacealt'(%20) for 'space' placeholder
251
	#..
310
	#..
252
vc_includes	=\
311
vc_includes	=\
253
		$(subst ;,$(space),$(subst \,/,$(subst $(space),$(spacealt),$(INCLUDE))))
312
		$(subst ;,$(space),$(subst \,/,$(subst $(space),$(spacealt),$(INCLUDE))))
254
 
313
 
255
	# Command
314
	# Command
Line 266... Line 325...
266
		$(strip $(vc_compile_flags)) \
325
		$(strip $(vc_compile_flags)) \
267
		$(strip $(patsubst %,%,$(vc_flags))) \
326
		$(strip $(patsubst %,%,$(vc_flags))) \
268
		$(strip $(patsubst %,%,$(vc_defines))) \
327
		$(strip $(patsubst %,%,$(vc_defines))) \
269
		$(patsubst %,%,$(CFLAGS)) \
328
		$(patsubst %,%,$(CFLAGS)) \
270
		$(patsubst %,-D%,$(cc_defines)) \
329
		$(patsubst %,-D%,$(cc_defines)) \
271
		$(subst $(spacealt),$(space),$(patsubst %,-I"%",$(subst /,\,$(INCDIRS)))) \
330
		$(subst $(spacealt),$(space),$(patsubst %,"-I%",$(subst /,\,$(INCDIRS)))) \
272
		$(subst $(spacealt),$(space),$(patsubst %,-I"%",$(subst /,\,$(cc_includes)))) \
331
		$(subst $(spacealt),$(space),$(patsubst %,"-I%",$(subst /,\,$(cc_includes)))) \
273
		$(subst $(spacealt),$(space),$(patsubst %,-I"%",$(subst /,\,$(vc_includes))))
332
		$(subst $(spacealt),$(space),$(patsubst %,"-I%",$(subst /,\,$(vc_includes))))
274
cc_term		=
333
cc_term		=
275
 
334
 
276
define cc_pre
335
define cc_pre
277
	@$(echo) [$<] Compiling..
336
	@$(echo) [$<] Compiling..
278
endef
337
endef
Line 474... Line 533...
474
	#
533
	#
475
	#..
534
	#..
476
vc_ldflags	= \
535
vc_ldflags	= \
477
		-nologo\\n\
536
		-nologo\\n\
478
		-incremental:no\\n\
537
		-incremental:no\\n\
479
		-debug:full\\n\
538
		-debug\\n\
480
		$(subst $(spacealt),$(space),$(patsubst %,-libpath:\"%\"\\n,$(subst /,\\\\,$(LIBDIRS))))\
539
		$(subst $(spacealt),$(space),$(patsubst %,-libpath:\"%\"\\n,$(subst /,\\\\,$(ALL_LIBDIRS))))\
481
		$(subst $(spacealt),$(space),$(patsubst %,-libpath:\"%\"\\n,$(subst /,\\\\,$(vc_libs))))\
-
 
482
		$(patsubst %,-%\\n,$(LDFLAGS))\
540
		$(patsubst %,-%\\n,$(LDFLAGS))\
483
		$(patsubst %,-%\\n,$(purecov_ld_flags))
541
		$(patsubst %,-%\\n,$(purecov_ld_flags))
484
 
542
 
485
ifdef LDSUBSYSTEM
543
ifdef LDSUBSYSTEM
486
vc_ldflags += -subsystem:$(LDSUBSYSTEM)\\n
544
vc_ldflags += -subsystem:$(LDSUBSYSTEM)\\n