| 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_flags = -map -symbols \
|
|
|
215 |
$(patsubst %,%,$(LDFLAGS)) \
|
|
|
216 |
$($(notdir $(basename $@))_ld) \
|
|
|
217 |
$(VRX_SYSLIBS)
|
|
|
218 |
|
|
|
219 |
ld_pre = @echo [$@] Linking..;
|
|
|
220 |
ld_post =
|
|
|
221 |
|
|
|
222 |
################################################################################
|
|
|
223 |
# Library dependency file generation
|
|
|
224 |
# Use cmdfile to create a file that will be included in this makefile
|
|
|
225 |
# The generated file will contain library path names that can only be
|
|
|
226 |
# calculated on the fly
|
|
|
227 |
#
|
|
|
228 |
define LDDEPEND
|
| 335 |
dpurdie |
229 |
$(XX_PRE)$(cmdfile) -wkWeo$(@) "$($(DPLIST))"
|
| 261 |
dpurdie |
230 |
endef
|
|
|
231 |
|
| 335 |
dpurdie |
232 |
|
| 261 |
dpurdie |
233 |
################################################################################
|
|
|
234 |
#.. Archiver Definitions
|
|
|
235 |
#
|
|
|
236 |
#.. Archiver
|
|
|
237 |
#
|
|
|
238 |
ar = $(XX_PRE) $(ARM_ar)
|
|
|
239 |
ar_init =
|
|
|
240 |
ar_cmdfile = $(basename $@).ar
|
|
|
241 |
ar_flags =
|
|
|
242 |
ar_o_switch = -via $(ar_cmdfile)
|
|
|
243 |
|
|
|
244 |
define ar_pre
|
|
|
245 |
@$(echo) [\$@] Creating library archive.. ; \
|
|
|
246 |
$(rm) -f $@ ;\
|
|
|
247 |
$(cmdfile) -ko$(ar_cmdfile) \
|
|
|
248 |
-create $@\\n\
|
|
|
249 |
$(patsubst %,-r %\\n,$(filter %.o, $^))
|
|
|
250 |
endef
|
|
|
251 |
|
|
|
252 |
ifndef LEAVETMP
|
|
|
253 |
define ar_post
|
|
|
254 |
@$(rm) -f $(ar_cmdfile)
|
|
|
255 |
endef
|
|
|
256 |
else
|
|
|
257 |
define ar_post
|
|
|
258 |
endef
|
|
|
259 |
endif
|
|
|
260 |
|
|
|
261 |
|
|
|
262 |
################################################################################
|
|
|
263 |
#.. Archive Merge
|
|
|
264 |
# The archive tool can directly merge libaries
|
|
|
265 |
#
|
|
|
266 |
armerge = $(XX_PRE) $(ARM_ar)
|
|
|
267 |
armerge_init =
|
|
|
268 |
armerge_flags = -create $@ -r $^
|
|
|
269 |
armerge_o_switch =
|
|
|
270 |
|
|
|
271 |
define armerge_pre
|
|
|
272 |
@$(echo) [\$@] Creating a Merged library.. ; \
|
|
|
273 |
$(rm) -f $@
|
|
|
274 |
endef
|
|
|
275 |
|
|
|
276 |
armerge_post =
|
|
|
277 |
|
|
|
278 |
|
|
|
279 |
################################################################################
|
|
|
280 |
# HEADER
|
|
|
281 |
#
|
|
|
282 |
# A function to modify the executable header
|
|
|
283 |
# Arguments
|
|
|
284 |
# $1 Command line arguments
|
|
|
285 |
# $2 Comment
|
|
|
286 |
#
|
|
|
287 |
# Assumes that $@ is the input/output file
|
|
|
288 |
define HEADER
|
|
|
289 |
@$(echo) [$@] $(2)..
|
|
|
290 |
$(CC_PRE) $(VERIX_hdr) $1 $@ || ( $(rm) -f $@; exit 1 )
|
|
|
291 |
endef
|
|
|
292 |
|
|
|
293 |
|
|
|
294 |
################################################################################
|
|
|
295 |
# FILESIGNATURE
|
|
|
296 |
#
|
|
|
297 |
# A function to sign a file
|
|
|
298 |
# Arguments
|
|
|
299 |
# $1 - Input file name
|
|
|
300 |
# $2 - Output file name for Certificate
|
|
|
301 |
# $3 - Options (-L for Flash )
|
|
|
302 |
#
|
|
|
303 |
# Note: The FileSignature program needs
|
|
|
304 |
# - '\' when being called
|
|
|
305 |
# - '\' for its input file
|
|
|
306 |
# - Absolute pathname for its input file
|
|
|
307 |
#
|
|
|
308 |
#
|
|
|
309 |
define FILESIGNATURE
|
|
|
310 |
@echo [$<] Signing Files ..;
|
|
|
311 |
$(CC_PRE) $(subst /,\\,$(VERIX_FileSignature)) -C $2 -F $(subst /,\\,$(abspath $1)) $3
|
|
|
312 |
endef
|
|
|
313 |
|
|
|
314 |
|
|
|
315 |
#
|