Subversion Repositories DevTools

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
261 dpurdie 1
###############################################################################
2
# File:     TOOLSET/VERIX.RUL[e]
3
# Contents: VERIX rules
4
#
5
###############################################################################
6
 
7
###############################################################################
8
#..     Remove "undef" warnings
9
#
10
cc_includes	+=
11
cc_includes	+=
12
cc_defines	+=
13
cxx_includes	+=
14
cxx_defines	+=
15
VRX_SYSLIBS     +=
16
 
17
###############################################################################
18
#..     Toolset defaults
19
#
20
 
21
###############################################################################
22
#..     Parse user options
23
#       Global options already parsed
24
#       These options extend the global options
25
#
26
ifdef OPTIONS
27
 
28
ifneq "$(findstring wall,$(OPTIONS))" ""	# Enable all warnings
29
USE_WALL	= 1
30
endif
31
 
32
ifneq "$(findstring list,$(OPTIONS))" ""	# Create Listings
33
USE_LIST	= 1
34
endif
35
 
36
 
37
endif	#OPTIONS
38
 
39
###############################################################################
40
#
41
#	Extend LIBDIRS with toolset libraries
42
#	Create a ';' separated list
43
#	Start with a space separated list
44
#		May need to change if VERIX_LIB is to be installed
45
#		a path with spaces in it.
46
 
47
LIB         := $(patsubst %,%;,$(LIBDIRS) $(VERIX_LIB) )
48
export LIB
49
 
50
 
51
###############################################################################
52
#..     C Compiler definition
53
#
54
# Compile and link options
55
#   -g					: generate debug info
56
#   -v					: display arm tool commands as they are invoked
57
#   -armcc,"-E" 			: generate pre-processor output only
58
#   -armcc,"--list" 			: generate pre-processor output as well as compile
59
#   -armcc,"-Ospace" 			: perform unaligned data accesses via functions
60
#   -armcc,"-Otime" 			: perform unaligned data accesses inline
61
#   -armcc,"-W+s" 			: report any padding added to structures
62
#   -armcc,"--diag_suppress nnn,nnn"	: suppress warnings
63
 
64
 
65
# Standard defines
66
#
67
#..
68
ifdef ALVL
69
vrx_defines	+= -DALVL=$(ALVL)
70
endif
71
 
72
ifdef DLVL
73
vrx_defines	+= -DDLVL=$(DLVL)
74
endif
75
 
76
vrx_defines	+= -D__SOURCE__=\"$(notdir $<)\"
77
 
78
# Standard flags
79
#
80
vrx_flags	+= -c
81
 
82
ifdef FORCE_C_COMPILE
83
endif
84
 
85
ifdef FORCE_CC_COMPILE
86
endif
87
 
88
ifdef USE_OPTIMISE				# default for production
89
ifdef OPT_MODE
90
vrx_flags 	+= -armcc,"-O$(OPT_MODE)"
91
endif
92
else
93
endif
94
 
95
ifdef USE_DEBUGINFO				# default for debug
96
vrx_flags	+= -g
97
vrx_defines	+= -DDEBUG
98
else
99
vrx_defines	+= -DNDEBUG
100
endif
101
 
102
ifdef USE_STRICT_ANSI				# default NO
103
vrx_flags	+=
104
endif
105
 
106
ifdef LEAVETMP					# default NO
107
vrx_flags	+=
108
endif
109
 
110
ifdef USE_LIST
111
vrx_flags 	+= -armcc,"--list"
112
endif
113
 
114
ifdef USE_WALL
115
vrx_flags 	+= -armcc,"-W+s"
116
else
117
ifdef NOWARNLIST
118
vrx_flags 	+= -armcc,"--diag_suppress $(subst $(comma),\$(comma),$(NOWARNLIST))"
119
endif
120
endif
121
 
122
# Standard includes
123
#
124
#..
125
 
126
ifdef VRX_INCPATH				# From CompileOptions
127
vrx_includes	+= $(VRX_INCPATH)
128
endif
129
 
130
vrx_includes	+=
131
ifdef VERIX_INCLUDE
132
vrx_includes	+= $(VERIX_INCLUDE)         	# From Toolset Defs
133
endif
134
 
135
###############################################################################
136
#..     C Compiler definition
137
#
138
cc		= $(CC_PRE) $(VERIX_compiler)
139
cc_init		=
140
cc_o_switch	= -o $@
141
cc_source	= $<
142
cc_flags	= \
143
		$(patsubst %,%,$(CFLAGS)) \
144
		$(patsubst %,%,$(vrx_flags)) \
145
		$(patsubst %,%,$(vrx_defines)) \
146
		$(patsubst %,-D%,$(cc_defines)) \
147
		$(patsubst %,-I %,$(INCDIRS)) \
148
		$(patsubst %,-I %,$(cc_includes)) \
149
		$(patsubst %,-I %,$(vrx_includes))
150
cc_term		=
151
 
152
define cc_pre
153
	@echo [$<] compiling..
154
endef
155
 
156
ifdef USE_LIST
157
define cc_post
158
		$(mv) $(basename $(@F)).lst $(basename $@).lst
159
endef
160
else
161
define cc_post
162
endef
163
endif
164
 
165
###############################################################################
166
#..     C++ Compiler definition
167
#
168
cxx		= $(CC_PRE) $(VERIX_compiler)
169
cxx_init	=
170
cxx_o_switch	= -o $@
171
cxx_source	= $<
172
cxx_flags	= \
173
		$(patsubst %,%,$(CXXFLAGS)) \
174
		$(patsubst %,%,$(vrx_flags)) \
175
		$(patsubst %,%,$(vrx_defines)) \
176
		$(patsubst %,-d%,$(cxx_defines)) \
177
		$(patsubst %,-I %,$(INCDIRS)) \
178
		$(patsubst %,-I %,$(cxx_includes)) \
179
		$(patsubst %,-I %,$(vrx_includes))
180
 
181
define cxx_pre
182
	@echo [$<] compiling..
183
endef
184
 
185
define cxx_post
186
endef
187
 
188
###############################################################################
189
#..     C/C++ dependencies
190
#
191
ccdep		= $(XX_PRE) $(GBE_BIN)/mkdepend
192
ccdep_init	=
193
ccdep_o_switch	= -f -
194
ccdep_flags	= -MM -b -We -p '$$(OBJDIR)/' -o ".$(o)"
195
ccdep_source	= $(filter %.c %.cc %.cpp, $+) > $@ 2> $(OBJDIR)/depend.err
196
 
197
ccdep_flags	+= \
198
		$(patsubst %,%,$(CFLAGS)) \
199
		$(patsubst %,%,$(vrx_depend)) \
200
		$(patsubst %,%,$(vrx_defines)) \
201
		$(patsubst %,-D%,$(cc_defines)) \
202
		$(patsubst %,-I %,$(INCDIRS)) \
203
		$(patsubst %,-I %,$(cc_includes)) \
204
		$(patsubst %,-Y %,$(vrx_includes))
205
ccdep_pre	=
206
ccdep_post	=
207
 
208
###############################################################################
209
#..     Linker definition
210
#
211
ld		= $(CC_PRE) $(VERIX_compiler)
212
ld_init		=
213
ld_o_switch	= -o $@
214
ld_depfile	= $(subst /,\\,$(basename $@).dep)
215
ld_flags	= -map -symbols \
216
		$(patsubst %,%,$(LDFLAGS)) \
217
		$($(notdir $(basename $@))_ld) \
218
                $(VRX_SYSLIBS)
219
 
220
ld_pre   	= @echo [$@] Linking..;
221
ld_post		=
222
 
223
################################################################################
224
#	Library dependency file generation
225
#	Use cmdfile to create a file that will be included in this makefile
226
#	The generated file will contain library path names that can only be
227
#	calculated on the fly
228
#
229
define LDDEPEND
230
	$(XX_PRE) $(cmdfile) -wkWeo$(ld_depfile) \
231
		"$($(notdir $(basename $@))_dp)";
232
endef
233
 
234
################################################################################
235
#..	Archiver Definitions
236
#
237
#..     Archiver
238
#
239
ar              = $(XX_PRE) $(ARM_ar)
240
ar_init         =
241
ar_cmdfile      = $(basename $@).ar
242
ar_flags        =
243
ar_o_switch     = -via $(ar_cmdfile)
244
 
245
define ar_pre
246
        @$(echo) [\$@] Creating library archive.. ; \
247
        $(rm) -f $@ ;\
248
        $(cmdfile) -ko$(ar_cmdfile) \
249
                -create $@\\n\
250
                $(patsubst %,-r %\\n,$(filter %.o, $^))
251
endef
252
 
253
ifndef LEAVETMP
254
define ar_post
255
        @$(rm) -f $(ar_cmdfile)
256
endef
257
else
258
define ar_post
259
endef
260
endif
261
 
262
 
263
################################################################################
264
#..     Archive Merge
265
#	The archive tool can directly merge libaries
266
#
267
armerge              = $(XX_PRE) $(ARM_ar)
268
armerge_init         =
269
armerge_flags        = -create $@ -r $^
270
armerge_o_switch     =
271
 
272
define armerge_pre
273
        @$(echo) [\$@] Creating a Merged library.. ; \
274
        $(rm) -f $@
275
endef
276
 
277
armerge_post 	     =
278
 
279
 
280
################################################################################
281
#	HEADER
282
#
283
# A function to modify the executable header
284
# Arguments
285
#	$1 Command line arguments
286
#	$2 Comment
287
#
288
# Assumes that $@ is the input/output file
289
define HEADER
290
        @$(echo) [$@] $(2)..
291
        $(CC_PRE) $(VERIX_hdr) $1 $@ || ( $(rm) -f $@; exit 1 )
292
endef
293
 
294
 
295
################################################################################
296
#	FILESIGNATURE
297
#
298
# A function to sign a file
299
# Arguments
300
#	$1 - Input file name
301
#	$2 - Output file name for Certificate
302
#	$3 - Options (-L for Flash )
303
#
304
# Note: The FileSignature program needs
305
#        - '\' when being called
306
#        - '\' for its input file
307
#        - Absolute pathname for its input file
308
#
309
#
310
define FILESIGNATURE
311
	@echo [$<] Signing Files ..;
312
	$(CC_PRE) $(subst /,\\,$(VERIX_FileSignature)) -C $2 -F $(subst /,\\,$(abspath  $1)) $3
313
endef
314
 
315
 
316
#