| 227 |
dpurdie |
1 |
# -*- mode: mak -*-
|
|
|
2 |
###############################################################################
|
|
|
3 |
# File: TOOLSET/cygnus_thyron.rul[e]
|
|
|
4 |
# Contents: Cygnus Thyron rules
|
|
|
5 |
#
|
|
|
6 |
# Revision History:
|
|
|
7 |
# 17/10/02 APY Created from gcc toolset
|
|
|
8 |
###################################################################
|
|
|
9 |
|
|
|
10 |
###############################################################################
|
|
|
11 |
#.. Remove "undef" warnings
|
|
|
12 |
#
|
|
|
13 |
cc_includes +=
|
|
|
14 |
cc_defines +=
|
|
|
15 |
cxx_include +=
|
|
|
16 |
cxx_defines +=
|
|
|
17 |
as_includes +=
|
|
|
18 |
as_defines +=
|
|
|
19 |
|
|
|
20 |
###############################################################################
|
|
|
21 |
#.. C Compiler definition
|
|
|
22 |
#
|
|
|
23 |
# -mapcs32 Generate code for a processor running with a 32-bit program
|
|
|
24 |
# counter, and conforming to the function calling standards for
|
|
|
25 |
# the APCS 32-bit option.
|
|
|
26 |
# -mcpu specifies the name of the target ARM processor.
|
|
|
27 |
# -msoft-float Generate output containing library calls for floating point.
|
|
|
28 |
# -c Compile only
|
|
|
29 |
# -0 Optimize
|
|
|
30 |
# -ffloat-store Do not store floating point variables in registers
|
|
|
31 |
# and inhabit other options that might change whether
|
|
|
32 |
# floating point value is taken from register or
|
|
|
33 |
# memory.
|
|
|
34 |
# -g3 The compiler debugging option, followed by the level.
|
|
|
35 |
# Level 3 included extra information.
|
|
|
36 |
# -Wall Issue warnings.
|
|
|
37 |
# -r Elimates the use of built-in implicit rules.
|
|
|
38 |
# -save-temps Do not delete intermediate files
|
|
|
39 |
#
|
|
|
40 |
|
|
|
41 |
cc = gcc
|
|
|
42 |
cc_init =
|
|
|
43 |
cc_o_switch = -o $@
|
|
|
44 |
cc_source = $<
|
|
|
45 |
cc_flags = \
|
|
|
46 |
$(patsubst %,%,$(CFLAGS)) \
|
|
|
47 |
$(patsubst %,-D%,$(cc_defines)) \
|
|
|
48 |
$(patsubst %,%,$(gcc_flags)) \
|
|
|
49 |
$(patsubst %,-I %,$(INCDIRS)) \
|
|
|
50 |
$(patsubst %,-I %,$(cc_includes)) \
|
|
|
51 |
$(patsubst %,-I %,$(gcc_includes))
|
|
|
52 |
cc_term = ; # ';' forces use of 'sh.exe'
|
|
|
53 |
|
|
|
54 |
gcc_includes += $(MPTLIB)/genlib/asc/src # Src/xxx.h
|
|
|
55 |
gcc_includes += $(MPTLIB)/genlib/com/src
|
|
|
56 |
gcc_includes += $(MPTLIB)/genlib/dat/src
|
|
|
57 |
gcc_includes += $(MPTLIB)/genlib/lwip/src
|
|
|
58 |
gcc_includes += $(MPTLIB)/genlib/pcc/src
|
|
|
59 |
gcc_includes += $(MPTLIB)/genlib/tmr/src
|
|
|
60 |
gcc_includes += $(MPTLIB)/genlib/tsk/src
|
|
|
61 |
gcc_includes += $(MPTLIB)/genlib/xtr/src
|
|
|
62 |
gcc_includes += $(MPTLIB)/lib # Include/xxx.h, must be prior to GNU
|
|
|
63 |
gcc_includes += $(MPTLIB)/stdclib/include
|
|
|
64 |
gcc_includes += $(MPTLIB)/lib/include
|
|
|
65 |
|
|
|
66 |
gcc_flags = -mapcs-32 -mcpu=arm7tdmi -msoft-float
|
|
|
67 |
gcc_flags += -c -Wall -ffloat-store
|
|
|
68 |
ifeq "$(DEBUG)" "1"
|
|
|
69 |
gcc_flags += -g3 -O -DDEBUG
|
|
|
70 |
else
|
|
|
71 |
gcc_flags += -O
|
|
|
72 |
endif
|
|
|
73 |
ifdef ALVL
|
|
|
74 |
gcc_flags += -DALVL=$(ALVL)
|
|
|
75 |
endif
|
|
|
76 |
ifdef DLVL
|
|
|
77 |
gcc_flags += -DDLVL=$(DLVL)
|
|
|
78 |
endif
|
|
|
79 |
gcc_flags += -D__SOURCE__=\"$(notdir $<)\"
|
|
|
80 |
ifdef LEAVETMP
|
|
|
81 |
gcc_flags += -save-temps
|
|
|
82 |
endif
|
|
|
83 |
|
|
|
84 |
define cc_pre
|
|
|
85 |
@echo [\$<] compiling..
|
|
|
86 |
endef
|
|
|
87 |
|
|
|
88 |
define cc_post
|
|
|
89 |
endef
|
|
|
90 |
|
|
|
91 |
|
|
|
92 |
###############################################################################
|
|
|
93 |
#.. C/C++ dependencies
|
|
|
94 |
#
|
|
|
95 |
# -M Generate make dependencies
|
|
|
96 |
# -MM As -M, but ignore system header files
|
|
|
97 |
# -MG Treat missing header files as generated
|
|
|
98 |
#
|
|
|
99 |
|
|
|
100 |
ifeq "$(DEBUG)" "1"
|
|
|
101 |
gcc_depend += -DDEBUG
|
|
|
102 |
endif
|
|
|
103 |
ifdef ALVL
|
|
|
104 |
gcc_depend += -DALVL=$(ALVL)
|
|
|
105 |
endif
|
|
|
106 |
ifdef DLVL
|
|
|
107 |
gcc_depend += -DDLVL=$(DLVL)
|
|
|
108 |
endif
|
|
|
109 |
|
|
|
110 |
#ccdep = gcc -MG
|
|
|
111 |
ccdep = $(GBE_BIN)/mkdepend
|
|
|
112 |
ccdep_o_switch = -f -
|
|
|
113 |
ccdep_init =
|
|
|
114 |
ccdep_source = $(filter %.c %.cc %.cpp, $+) > $(subst /,/,$@).tmp 2> $@.err
|
|
|
115 |
ccdep_flags = -MM \
|
|
|
116 |
$(patsubst %,%,$(CFLAGS)) \
|
|
|
117 |
$(patsubst %,-D%,$(cc_defines)) \
|
|
|
118 |
$(patsubst %,%,$(gcc_depend)) \
|
|
|
119 |
$(patsubst %,-I %,$(INCDIRS)) \
|
|
|
120 |
$(patsubst %,-I %,$(cc_includes)) \
|
|
|
121 |
$(patsubst %,-Y %,$(gcc_includes))
|
|
|
122 |
ccdep_pre =
|
|
|
123 |
|
|
|
124 |
ifndef LEAVETMP
|
|
|
125 |
define ccdep_post
|
|
|
126 |
-sed s/\^/\$$\(OBJDIR\)\\// $(subst /,/,$@).tmp | \
|
|
|
127 |
grep \\.${o} > $(subst /,/,$@)
|
|
|
128 |
@rm $(subst /,/,$@).tmp
|
|
|
129 |
endef
|
|
|
130 |
else
|
|
|
131 |
define ccdep_post
|
|
|
132 |
-sed s/\^/\$$\(OBJDIR\)\\// $(subst /,/,$@).tmp | \
|
|
|
133 |
grep \\.${o} > $(subst /,/,$@)
|
|
|
134 |
endef
|
|
|
135 |
endif
|
|
|
136 |
|
|
|
137 |
|
|
|
138 |
###############################################################################
|
|
|
139 |
#.. C++ Compiler definition
|
|
|
140 |
#
|
|
|
141 |
|
|
|
142 |
cxx = gcc
|
|
|
143 |
cxx_init =
|
|
|
144 |
cxx_switch = -o $@
|
|
|
145 |
cxx_source = $<
|
|
|
146 |
cxx_flags = \
|
|
|
147 |
$(patsubst %,%,$(CXXFLAGS)) \
|
|
|
148 |
$(patsubst %,-d%,$(cxx_defines)) \
|
|
|
149 |
$(patsubst %,%,$(gcc_flags)) \
|
|
|
150 |
$(patsubst %,-I %,$(INCDIRS)) \
|
|
|
151 |
$(patsubst %,-I %,$(cxx_includes)) \
|
|
|
152 |
$(patsubst %,-I %,$(gcc_includes))
|
|
|
153 |
cxx_term = ; # ';' forces use of 'sh.exe'
|
|
|
154 |
|
|
|
155 |
define cxx_pre
|
|
|
156 |
@echo [\$<] compiling..
|
|
|
157 |
endef
|
|
|
158 |
|
|
|
159 |
define cxx_post
|
|
|
160 |
endef
|
|
|
161 |
|
|
|
162 |
|
|
|
163 |
###############################################################################
|
|
|
164 |
#.. Assembler definition
|
|
|
165 |
#
|
|
|
166 |
as = @as
|
|
|
167 |
as_init =
|
|
|
168 |
as_i_switch = -I$(space)
|
|
|
169 |
as_o_switch =
|
|
|
170 |
as_object = # BROKEN
|
|
|
171 |
as_source = $<
|
|
|
172 |
as_cmdfile = $(basename $@).cmd
|
|
|
173 |
as_flags = $(as_object) @$(as_cmdfile)
|
|
|
174 |
|
|
|
175 |
as_term = ; # ';' forces use of 'sh.exe'
|
|
|
176 |
|
|
|
177 |
as_flags = -Wall
|
|
|
178 |
ifeq "$(DEBUG)" "1"
|
|
|
179 |
as_flags += -g
|
|
|
180 |
as_defines += DEBUG=1
|
|
|
181 |
endif
|
|
|
182 |
ifdef DLVL
|
|
|
183 |
as_defines += DLVL=$(DLVL)
|
|
|
184 |
endif
|
|
|
185 |
ifdef ALVL
|
|
|
186 |
as_defines += ALVL=$(ALVL)
|
|
|
187 |
endif
|
|
|
188 |
as_defines += --gstabs
|
|
|
189 |
as_defines += $(as_flags)
|
|
|
190 |
|
|
|
191 |
define as_pre
|
|
|
192 |
@$(cmdfile) -ko$(as_cmdfile) "\
|
|
|
193 |
$(patsubst %,%\\n,$(ASFLAGS))\
|
|
|
194 |
$(patsubst %,--defsym %\\n,$(as_defines))\
|
|
|
195 |
$(patsubst %,$(as_i_switch)%\\n,$(INCDIRS))\
|
|
|
196 |
$(patsubst %,$(as_i_switch)%\\n,$(as_includes))"
|
|
|
197 |
endef
|
|
|
198 |
|
|
|
199 |
ifndef LEAVETMP
|
|
|
200 |
define as_post
|
|
|
201 |
@rm -f $@; mv a.out $@
|
|
|
202 |
@$(rm) -f $(as_cmdfile)
|
|
|
203 |
endef
|
|
|
204 |
else
|
|
|
205 |
define as_post
|
|
|
206 |
@rm -f $@; mv a.out $@
|
|
|
207 |
endef
|
|
|
208 |
endif
|
|
|
209 |
|
|
|
210 |
|
|
|
211 |
###############################################################################
|
|
|
212 |
#.. Archiver
|
|
|
213 |
#
|
|
|
214 |
ar = @ar
|
|
|
215 |
ar_cmdfile = $(basename $@).ar
|
|
|
216 |
ar_flags = -cvr
|
|
|
217 |
ar_o_switch = $@ @$(ar_cmdfile)
|
|
|
218 |
ar_term = ; # ';' forces use of 'sh.exe'
|
|
|
219 |
|
|
|
220 |
define ar_pre
|
|
|
221 |
@rm -f $@
|
|
|
222 |
@$(cmdfile) -ko$(ar_cmdfile) \
|
|
|
223 |
$(patsubst %,%\\n,$^)
|
|
|
224 |
endef
|
|
|
225 |
|
|
|
226 |
ifndef LEAVETMP
|
|
|
227 |
define ar_post
|
|
|
228 |
@$(rm) -f $(ar_cmdfile)
|
|
|
229 |
endef
|
|
|
230 |
else
|
|
|
231 |
define ar_post
|
|
|
232 |
endef
|
|
|
233 |
endif
|
|
|
234 |
|
|
|
235 |
|
|
|
236 |
###############################################################################
|
|
|
237 |
#.. Linker
|
|
|
238 |
#
|
|
|
239 |
ld = @ld
|
|
|
240 |
ld_init =
|
|
|
241 |
ld_cmdfile = $(basename $@).ld
|
|
|
242 |
ld_o_switch = @$(ld_cmdfile)
|
|
|
243 |
ld_term = ; # ';' forces use of 'sh.exe'
|
|
|
244 |
|
|
|
245 |
ld_flags =
|
|
|
246 |
|
|
|
247 |
define LDDEPEND
|
|
|
248 |
@export GCC_LIB; \
|
|
|
249 |
GCC_LIB="$(subst $(space),;,$(LIBDIRS))"; \
|
|
|
250 |
$(cmdfile) -o$(BINDIR)/$(notdir $(basename $@)).dep "$($(notdir $(basename $@))_dp)"
|
|
|
251 |
endef
|
|
|
252 |
|
|
|
253 |
#
|
|
|
254 |
|
|
|
255 |
define ld_pre
|
|
|
256 |
@export GCC_LIB; \
|
|
|
257 |
GCC_LIB="$(subst $(space),;,$(LIBDIRS))"; \
|
|
|
258 |
$(cmdfile) -o$(ld_cmdfile) "$($(notdir $(basename $@))_ld)"; \
|
|
|
259 |
echo [\$@] Linking image ..
|
|
|
260 |
endef
|
|
|
261 |
|
|
|
262 |
ifndef LEAVETMP
|
|
|
263 |
define ld_post
|
|
|
264 |
@$(rm) -f $(ld_cmdfile)
|
|
|
265 |
endef
|
|
|
266 |
else
|
|
|
267 |
define ld_post
|
|
|
268 |
endef
|
|
|
269 |
endif
|
|
|
270 |
|
|
|
271 |
define LDBIN
|
|
|
272 |
@$(show_environment)
|
|
|
273 |
$(ld_pre)
|
|
|
274 |
$(ld) $(ld_flags) $(ld_o_switch) $(ld_term)
|
|
|
275 |
$(ld_post)
|
|
|
276 |
endef
|
|
|
277 |
|
|
|
278 |
#
|