| 363 |
dpurdie |
1 |
###############################################################################
|
|
|
2 |
# Module name : TOOLSET/arm251
|
|
|
3 |
# Module type : Makefile system
|
|
|
4 |
# Environment(s): arm251
|
|
|
5 |
#
|
|
|
6 |
#
|
|
|
7 |
###################################################################
|
|
|
8 |
|
|
|
9 |
###############################################################################
|
|
|
10 |
#.. Remove "undef" warnings
|
|
|
11 |
#
|
|
|
12 |
cc_includes +=
|
|
|
13 |
cc_defines +=
|
|
|
14 |
cxx_include +=
|
|
|
15 |
cxx_defines +=
|
|
|
16 |
as_includes +=
|
|
|
17 |
as_defines +=
|
|
|
18 |
|
|
|
19 |
###############################################################################
|
|
|
20 |
#.. Parse user options
|
|
|
21 |
# Global options already parsed
|
|
|
22 |
# These options extend the global options
|
|
|
23 |
#
|
|
|
24 |
|
|
|
25 |
ifdef OPTIONS
|
|
|
26 |
|
|
|
27 |
ifneq "$(findstring wall,$(OPTIONS))" "" # Enable all warnings
|
|
|
28 |
USE_WALL = 1
|
|
|
29 |
endif
|
|
|
30 |
|
|
|
31 |
ifneq "$(findstring list,$(OPTIONS))" "" # Create Listings
|
|
|
32 |
USE_LIST = 1
|
|
|
33 |
endif
|
|
|
34 |
|
|
|
35 |
endif
|
|
|
36 |
|
|
|
37 |
###############################################################################
|
|
|
38 |
#
|
|
|
39 |
# Extend LIBDIRS with toolset libraries
|
|
|
40 |
# Create a ';' separated list
|
|
|
41 |
# Start with a space separated list
|
|
|
42 |
# May need to change if ARMLIB is to be installed
|
|
|
43 |
# in a path with spaces in it.
|
|
|
44 |
|
|
|
45 |
LIB := $(patsubst %,%;,$(LIBDIRS) $(ARMLIB) $(INGEDEV_LIBS) )
|
|
|
46 |
export LIB
|
|
|
47 |
|
|
|
48 |
|
|
|
49 |
###############################################################################
|
|
|
50 |
#.. C Compiler definition
|
|
|
51 |
#
|
|
|
52 |
|
|
|
53 |
cc_filter := $(wildcard $(GBE_ROOT)/warnings.arm251)
|
|
|
54 |
ifdef cc_filter
|
|
|
55 |
cc_redirect = 1
|
|
|
56 |
cc_error_filter = $(awk) -f $(GBE_ROOT)/warnings.arm251
|
|
|
57 |
endif
|
|
|
58 |
|
|
|
59 |
################################################################################
|
|
|
60 |
# Compiler options
|
|
|
61 |
#
|
|
|
62 |
# -zz-1 # Same as zz0 - sets the zero initialised variable(bss) threshold
|
|
|
63 |
# # zz0 forces unitialisaed global to be placed in the ZI degment
|
|
|
64 |
# -c # Compiler, but don't link
|
|
|
65 |
# -apcs 3/noswst/nofp/interwork # proceedure call options
|
|
|
66 |
# # 3 - is default ( use unknown)
|
|
|
67 |
# # /noswst - no software stack checking
|
|
|
68 |
# # /nofp - no frame pointers
|
|
|
69 |
# # /interwork - arm/Thumb interworking
|
|
|
70 |
# -littleend # Generate Little Endian (default)
|
|
|
71 |
# -list # Create a listing file
|
|
|
72 |
# -g # Enable generation of debug tables
|
|
|
73 |
# -zc # Char type is signed
|
|
|
74 |
# -zap1 # Pointers to Structs aligned to Min
|
|
|
75 |
# -zat1 # Alignment of top level static objects (default = 1)
|
|
|
76 |
# -zas1 # Min Byte alignment (default is 4)
|
|
|
77 |
# -fa # Check for certain types of data flow anomalies
|
|
|
78 |
# -o filename # Specifies output file
|
|
|
79 |
# -Ospace # Optimise for Space (default)
|
|
|
80 |
# -Otime # Optimise for time
|
|
|
81 |
# -O2 # Full optimize
|
|
|
82 |
#
|
|
|
83 |
# -DBSP_LITTLE_ENDIAN=1
|
|
|
84 |
# -D__thumb=1
|
|
|
85 |
|
|
|
86 |
# Standard defines
|
|
|
87 |
#
|
|
|
88 |
#..
|
|
|
89 |
arm_defines += -D__SOURCE__=\"$(notdir $<)\"
|
|
|
90 |
|
|
|
91 |
# Standard flags
|
|
|
92 |
#
|
|
|
93 |
arm_flags += -c -apcs 3/noswst/nofp/interwork
|
|
|
94 |
arm_flags += -zz-1 -zc -zap1 -zat1 -zas1 -fa -littleend
|
|
|
95 |
arm_defines += -D__thumb=1
|
|
|
96 |
arm_defines += -DBSP_LITTLE_ENDIAN=1
|
|
|
97 |
|
|
|
98 |
ifdef USE_OPTIMISE # default for production
|
|
|
99 |
ifdef OPT_MODE
|
|
|
100 |
arm_flags += -O$(OPT_MODE)
|
|
|
101 |
endif
|
|
|
102 |
arm_flags += -O2
|
|
|
103 |
else
|
|
|
104 |
arm_flags += -O0
|
|
|
105 |
endif
|
|
|
106 |
|
|
|
107 |
ifdef USE_DEBUGINFO # default for debug
|
|
|
108 |
arm_flags += -g
|
|
|
109 |
arm_defines += -DDEBUG
|
|
|
110 |
else
|
|
|
111 |
arm_defines += -DNDEBUG
|
|
|
112 |
endif
|
|
|
113 |
|
|
|
114 |
ifdef USE_STRICT_ANSI # default NO
|
|
|
115 |
arm_flags += -strict
|
|
|
116 |
endif
|
|
|
117 |
|
|
|
118 |
ifdef LEAVETMP # default NO
|
|
|
119 |
arm_flags +=
|
|
|
120 |
endif
|
|
|
121 |
|
|
|
122 |
ifdef USE_LIST
|
|
|
123 |
arm_flags += -list
|
|
|
124 |
endif
|
|
|
125 |
|
|
|
126 |
ifdef USE_WALL
|
|
|
127 |
arm_flags +=
|
|
|
128 |
else
|
|
|
129 |
endif
|
|
|
130 |
|
|
|
131 |
# Standard includes
|
|
|
132 |
#
|
|
|
133 |
#..
|
|
|
134 |
|
|
|
135 |
arm_includes +=
|
|
|
136 |
arm_includes += $(ARM_INCLUDES) # From Toolset Defs
|
|
|
137 |
|
|
|
138 |
###############################################################################
|
|
|
139 |
#.. C Compiler definition
|
|
|
140 |
#
|
|
|
141 |
cc = $(CC_PRE) $(compiler)
|
|
|
142 |
cc_init =
|
|
|
143 |
cc_o_switch = -o $@
|
|
|
144 |
cc_source = $<
|
|
|
145 |
cc_flags = \
|
|
|
146 |
$(patsubst %,%,$(CFLAGS)) \
|
|
|
147 |
$(patsubst %,%,$(arm_flags)) \
|
|
|
148 |
$(patsubst %,%,$(arm_defines)) \
|
|
|
149 |
$(patsubst %,-D%,$(cc_defines)) \
|
|
|
150 |
$(patsubst %,-I %,$(INCDIRS)) \
|
|
|
151 |
$(patsubst %,-I %,$(cc_includes)) \
|
|
|
152 |
$(patsubst %,-I %,$(arm_includes))
|
|
|
153 |
cc_term =
|
|
|
154 |
|
|
|
155 |
define cc_pre
|
| 6177 |
dpurdie |
156 |
@echo '[$<] compiling..'
|
| 363 |
dpurdie |
157 |
endef
|
|
|
158 |
|
|
|
159 |
cc_post =
|
|
|
160 |
|
|
|
161 |
###############################################################################
|
|
|
162 |
#.. C++ Compiler definition
|
|
|
163 |
#
|
|
|
164 |
cxx = $(CC_PRE) $(compiler)
|
|
|
165 |
cxx_init =
|
|
|
166 |
cxx_o_switch = -o $@
|
|
|
167 |
cxx_source = $<
|
|
|
168 |
cxx_flags = \
|
|
|
169 |
$(patsubst %,%,$(CXXFLAGS)) \
|
|
|
170 |
$(patsubst %,%,$(arm_flags)) \
|
|
|
171 |
$(patsubst %,%,$(arm_defines)) \
|
|
|
172 |
$(patsubst %,-d%,$(cxx_defines)) \
|
|
|
173 |
$(patsubst %,-I %,$(INCDIRS)) \
|
|
|
174 |
$(patsubst %,-I %,$(cxx_includes)) \
|
|
|
175 |
$(patsubst %,-I %,$(arm_includes))
|
|
|
176 |
|
|
|
177 |
define cxx_pre
|
| 6177 |
dpurdie |
178 |
@echo '[$<] compiling..'
|
| 363 |
dpurdie |
179 |
endef
|
|
|
180 |
|
|
|
181 |
define cxx_post
|
|
|
182 |
endef
|
|
|
183 |
|
|
|
184 |
###############################################################################
|
|
|
185 |
#.. C/C++ dependencies
|
|
|
186 |
#
|
|
|
187 |
ccdep = $(XX_PRE) $(GBE_BIN)/mkdepend
|
|
|
188 |
ccdep_init =
|
|
|
189 |
ccdep_o_switch = -f -
|
|
|
190 |
ccdep_flags = -MM -b -We -p '$$(OBJDIR)/' -o ".$(o)"
|
|
|
191 |
ccdep_source = $(filter %.c %.cc %.cpp, $+) > $@ 2> $(OBJDIR)/depend.err
|
|
|
192 |
|
|
|
193 |
ccdep_flags += \
|
|
|
194 |
$(patsubst %,%,$(CFLAGS)) \
|
|
|
195 |
$(patsubst %,%,$(arm_depend)) \
|
|
|
196 |
$(patsubst %,%,$(arm_defines)) \
|
|
|
197 |
$(patsubst %,-D%,$(cc_defines)) \
|
|
|
198 |
$(patsubst %,-I %,$(INCDIRS)) \
|
|
|
199 |
$(patsubst %,-I %,$(cc_includes)) \
|
|
|
200 |
$(patsubst %,-Y %,$(arm_includes))
|
|
|
201 |
ccdep_pre =
|
|
|
202 |
ccdep_post =
|
|
|
203 |
|
|
|
204 |
###############################################################################
|
|
|
205 |
#.. Linker definition
|
|
|
206 |
#
|
|
|
207 |
ld = $(CC_PRE) $(linker)
|
|
|
208 |
ld_cmdfile = $(subst /,\\,$(basename $@).ld)
|
|
|
209 |
ld_flags =
|
|
|
210 |
ld_file_flags =
|
|
|
211 |
ld_o_switch = -output $@ -via $(ld_cmdfile)
|
|
|
212 |
ld_term =
|
|
|
213 |
|
|
|
214 |
define ld_pre
|
|
|
215 |
$(AA_PRE)$(cmdfile) -wkWeo$(ld_cmdfile) \
|
|
|
216 |
"$(ld_file_flags) $($(notdir $(basename $@))_ld)"; \
|
| 6177 |
dpurdie |
217 |
echo '[$@] Linking..';\
|
| 363 |
dpurdie |
218 |
$(call show_cmdfile,$(ld_cmdfile))
|
|
|
219 |
endef
|
|
|
220 |
|
|
|
221 |
ifndef LEAVETMP
|
|
|
222 |
define ld_post
|
|
|
223 |
@$(rm) -f $(ld_cmdfile)
|
|
|
224 |
endef
|
|
|
225 |
else
|
|
|
226 |
define ld_post
|
|
|
227 |
endef
|
|
|
228 |
endif
|
|
|
229 |
|
|
|
230 |
################################################################################
|
|
|
231 |
# Library dependency file generation
|
|
|
232 |
# Use cmdfile to create a file that will be included in this makefile
|
|
|
233 |
# The generated file will contain library path names that can only be
|
|
|
234 |
# calculated on the fly
|
|
|
235 |
#
|
|
|
236 |
define LDDEPEND
|
|
|
237 |
$(AA_PRE)$(cmdfile) -wkWeo$(@) "$($(DPLIST))"
|
|
|
238 |
endef
|
|
|
239 |
|
|
|
240 |
################################################################################
|
|
|
241 |
#.. Archiver Definitions
|
|
|
242 |
#
|
|
|
243 |
#.. Archiver
|
|
|
244 |
#
|
|
|
245 |
ar = $(XX_PRE) $(librarian)
|
|
|
246 |
ar_init =
|
|
|
247 |
ar_cmdfile = $(basename $@).ar
|
|
|
248 |
ar_flags =
|
|
|
249 |
ar_o_switch = -v $(ar_cmdfile)
|
|
|
250 |
|
|
|
251 |
define ar_pre
|
| 6177 |
dpurdie |
252 |
$(XX_PRE) $(echo) '[$@] Creating library archive..' ; \
|
| 363 |
dpurdie |
253 |
$(rm) -f $@ ;\
|
|
|
254 |
$(cmdfile) -ko$(ar_cmdfile) \
|
|
|
255 |
-c $@\\n\
|
|
|
256 |
$(patsubst %,%\\n,$(filter %.o, $^));\
|
|
|
257 |
$(call show_cmdfile,$(ar_cmdfile))
|
|
|
258 |
|
|
|
259 |
endef
|
|
|
260 |
|
|
|
261 |
ifndef LEAVETMP
|
|
|
262 |
define ar_post
|
|
|
263 |
@$(rm) -f $(ar_cmdfile)
|
|
|
264 |
endef
|
|
|
265 |
else
|
|
|
266 |
define ar_post
|
|
|
267 |
endef
|
|
|
268 |
endif
|
|
|
269 |
|
|
|
270 |
|
|
|
271 |
################################################################################
|
|
|
272 |
#.. Archive Merge
|
|
|
273 |
# The archive tool can directly merge libaries
|
|
|
274 |
#
|
|
|
275 |
armerge = $(XX_PRE) $(GBE_TOOLS)/armerge
|
|
|
276 |
armerge_init =
|
|
|
277 |
armerge_flags = -d $(MLIBDIR) -t unix -a $(librarian)
|
|
|
278 |
armerge_o_switch= $@ $^
|
|
|
279 |
|
|
|
280 |
define armerge_pre
|
| 6177 |
dpurdie |
281 |
@$(echo) '[$@] Creating a Merged library..' ; \
|
| 363 |
dpurdie |
282 |
$(rm) -f $@
|
|
|
283 |
endef
|
|
|
284 |
|
|
|
285 |
armerge_post =
|
|
|
286 |
|
|
|
287 |
###############################################################################
|
|
|
288 |
#.. Assembler definition
|
|
|
289 |
#
|
|
|
290 |
#
|
|
|
291 |
as = $(XX_PRE) $(assembler)
|
|
|
292 |
as_init =
|
|
|
293 |
as_o_switch = -o $@
|
|
|
294 |
as_source = $<
|
|
|
295 |
|
|
|
296 |
asm_flags += -16
|
|
|
297 |
asm_flags += -apcs /interwork
|
|
|
298 |
asm_flags += -fpu none
|
|
|
299 |
|
|
|
300 |
asm_flags += $(ASFLAGS)
|
|
|
301 |
|
|
|
302 |
ifdef as_defines
|
|
|
303 |
#asm_flags += $(addprefix -D,$(as_defines))
|
|
|
304 |
endif
|
|
|
305 |
|
|
|
306 |
ifdef USE_DEBUGINFO
|
|
|
307 |
#asm_flags += -DDEBUG
|
|
|
308 |
asm_flags += -g
|
|
|
309 |
else
|
|
|
310 |
#asm_flags += -DNDEBUG
|
|
|
311 |
endif
|
|
|
312 |
|
|
|
313 |
as_flags = $(asm_flags)
|
|
|
314 |
ifdef as_includes
|
|
|
315 |
as_flags += "-I$(subst $(space),;,$(strip $(as_includes)))"
|
|
|
316 |
endif
|
|
|
317 |
|
|
|
318 |
as_flags += $(patsubst %,-I%,$(INCDIRS))
|
|
|
319 |
|
|
|
320 |
ifdef USE_LIST
|
|
|
321 |
as_flags += -list $(addsuffix .lst, $(basename $(@F)))
|
|
|
322 |
endif
|
|
|
323 |
|
|
|
324 |
ifdef USE_WALL
|
|
|
325 |
as_flags +=
|
|
|
326 |
else
|
|
|
327 |
as_flags += -nowarn
|
|
|
328 |
endif
|
|
|
329 |
|
|
|
330 |
define as_pre
|
| 6177 |
dpurdie |
331 |
@$(echo) '[$<] Assembling file..'
|
| 363 |
dpurdie |
332 |
endef
|
|
|
333 |
|
|
|
334 |
define as_post
|
|
|
335 |
endef
|
|
|
336 |
|