Subversion Repositories DevTools

Rev

Rev 367 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
227 dpurdie 1
# -*- mode: mak -*-
2
###############################################################################
3
# File:         TOOLSET/mri68k.rul[e]
4
# Contents:     MRI 68k rules
5
#               Make definitions for the Microtec tools.
6
#
7
# Version   Who   Date     Description
8
#           APY   10/03/00 Error filtering
9
#                 20/03/00 LEAVETMP shall leave .src files
10
#                 22/03/00 NODEPDIRS
11
#                 05/06/00 __SOURCE__
12
#                 26/02/02 Build system +v2 support.
13
#                          - ; appended to several directives, forcing use of
14
#                         'sh.exe' during execution.  Required by WIN32
15
#                          toolsets (see xx_term variables),
16
#                          - added depend post processing to append OBJDIR
17
#                 27/05/02 - realpath
18
#                          - quoted __SOURCE__, unquoted broke MRI 4.4
19
#                 12/03/04 mkdepend -b -o -p
20
#
21
###############################################################################
22
 
23
###############################################################################
24
#..     Remove "undef" warnings
25
#
26
cc_includes	+=
27
cc_defines	+=
28
as_includes	+=
29
as_defines	+=
30
cxx_includes	+=
31
cxx_defines	+=
32
 
33
###############################################################################
34
#..     C Compiler definition
35
#
36
#	-v      detects and issue warnings for features in source files
37
#		that can cause problems.
38
#	-Gf     Generate fully qualified pathnames for input files.
39
#	-nOc    Pop stack after each function call.
40
#	-nQ     Dont terminate compile based on error count.
41
#	-Kf     Generate stack frame for all functions.
42
#	-Z4     4 byte alignment.
43
#	-Feo    Writes diagnostic message to stdout.
44
#
45
#	-nOl    Disable local optimisation.
46
#	-nOR    Disable automatic register variable assignment.
47
#
48
#	-Og     Enables global-flow optimisation.
49
#	-Or     Enables intruction scheduling optimisation.
50
#	-Ob     Assume memory will not be changed externally.
51
#	-Oe     Generate only one from a return.
52
#	-Os     Favor code size.
53
#
54
cc		= mcc68k
55
cc_init 	=
56
cc_o_switch	=
57
cc_object	= -o$@
58
cc_source	=
59
cc_cmdfile	= $(basename $@).cmd
60
cc_flags	= -d$(cc_cmdfile)
61
cc_term 	= ;				# ';' forces use of 'sh.exe'
62
 
63
cc_filter	:= "$(notdir $(wildcard $(GBE_ROOT)/warnings.mri*))"
64
ifeq ($(strip $(cc_filter)), "warnings.mri")	# dos
5909 dpurdie 65
cc_redirect	= 1
227 dpurdie 66
cc_error_filter = $(awk) -f $(GBE_ROOT)/warnings.mri
67
mri_flags	+= -nFee			# Dont Output to stderr.
68
endif
69
 
70
cc_filter      := "$(notdir $(wildcard $(GBE_ROOT)/WARNINGS.MRI*))"
71
ifeq ($(strip $(cc_filter)), "WARNINGS.MRI")	# WIN32 mixed case
72
cc_redirect	= 1
73
cc_error_filter = $(awk) -f $(GBE_ROOT)/WARNINGS.MRI
74
mri_flags	+= -nFee			# Dont Output to stderr.
75
endif
76
 
77
mri_includes	+= $(mri)
78
 
79
mri_flags	+= -pCPU32 -c			# Compile only
80
mri_flags	+= -v -Gf -nOc -nQ -Kf -Z4 -Feo
81
ifdef LEAVETMP
82
mri_flags	+= -H -Fsm			# Save assembly (with comments)
83
endif
84
ifdef MRI_NONANSI
85
mri_flags	+= -nv				# Non ANSI
86
endif
87
ifeq "$(DEBUG)" "1"
88
mri_flags	+= -g -DDEBUG			# Full debug
89
mri_flags	+= -nOl -nOR -nOg		# no optimisation
90
else
91
 ifdef MRI_OPTIM
92
 mri_flags	+= -Og -Or -Ob -Oe -Os		# Full optimisation
93
 else
94
 mri_flags	+= -nOl -nOR -nOg		# Disable optimisation
95
 endif
96
endif
97
ifdef ALVL
98
mri_flags	+= -DALVL=$(ALVL)
99
endif
100
ifdef DLVL
101
mri_flags	+= -DDLVL=$(DLVL)
102
endif
103
mri_flags	+= -D__SOURCE__=\"$(notdir $<)\"
104
 
105
define cc_pre
106
	@$(echo) [\$<] compiling.. ; \
107
	$(cmdfile) -ko$(cc_cmdfile) "\
108
		$(patsubst %,%\\n,$(CFLAGS)) \
109
		$(patsubst %,-D%\\n,$(cc_defines)) \
110
		$(patsubst %,%\\n,$(mri_flags)) \
111
		-J$(subst /,\\\\,$(dir $<))\\n \
112
		$(patsubst %,-J%\\n,$(subst /,\\\\,$(INCDIRS))) \
113
		$(patsubst %,-J%\\n,$(subst /,\\\\,$(cc_includes))) \
114
		$(patsubst %,-J%\\n,$(subst /,\\\\,$(mri_includes))) \
115
		$(subst /,\\\\,$(cc_object))\\n\
116
		@(realpath,$(subst /,\\,$<))"
117
endef
118
 
119
ifndef LEAVETMP
120
define cc_post
121
	@$(rm) -f $(cc_cmdfile)
122
endef
123
else
124
define cc_post
125
endef
126
endif
127
 
128
cxx		=
129
cxx_init	=
130
cxx_o_switch	=
131
cxx_object	=
132
cxx_source	=
133
cxx_cmdfile	=
134
cxx_flags	=
135
cxx_term 	= ;				# ';' forces use of 'sh.exe'
136
 
137
 
138
###############################################################################
139
#..     C/C++ dependencies
140
#       depend and depend.err
141
#
142
mri_depend	=  -D__STDC__ -D_MCC68K
143
ifeq "$(DEBUG)" "1"
144
mri_depend	+= -DDEBUG
145
endif
146
ifdef ALVL
147
mri_depend	+= -DALVL=$(ALVL)
148
endif
149
ifdef DLVL
150
mri_depend	+= -DDLVL=$(DLVL)
151
endif
152
mri_depend	+= -D__SOURCE__=$(notdir $<)
153
 
367 dpurdie 154
ccdep		= $(XX_PRE) $(GBE_BIN)/mkdepend
227 dpurdie 155
ccdep_init	=
156
ccdep_o_switch	= -f -
157
#ccdep_source	= $(filter %.c %.cc %.cpp, $+) > $(subst /,/,$@).tmp 2> $@.err
158
ccdep_source	= $(filter %.c %.cc %.cpp, $+) > $@ 2> $@.err
159
ccdep_flags	= -MM -b -p '$$(OBJDIR)/' -o ".$(o)" \
160
		$(patsubst %,%,$(CFLAGS)) \
161
		$(patsubst %,-D%,$(cc_defines)) \
162
		$(patsubst %,%,$(mri_depend)) \
163
		$(patsubst %,-I %,$(INCDIRS)) \
164
		$(patsubst %,-Y %,$(cc_includes)) \
165
		$(patsubst %,-Y %,$(mri_includes)) \
166
                $(patsubst %,-Y %,$(NODEPDIRS))
167
 
168
ccdep_pre	=
169
ccdep_post	=
170
 
171
#ifndef LEAVETMP
172
#define ccdep_post
173
#	-sed s/\^/\$$\(OBJDIR\)\\// $(subst /,/,$@).tmp | \
174
#		grep \\.${o} > $(subst /,/,$@)
175
#	@rm $(subst /,/,$@).tmp
176
#endef
177
#else
178
#define ccdep_post
179
#	-sed s/\^/\$$\(OBJDIR\)\\// $(subst /,/,$@).tmp | \
180
#		grep \\.${o} > $(subst /,/,$@)
181
#endef
182
#endif
183
 
184
###############################################################################
185
#..     Assembler definition
186
#
187
# Note:  All the options go on the command line at present, as
188
#        such passes a minimal set of definitions. (v4.3 and v4.4)
189
#
190
#        Switchs should be embedded within the target source.
191
#
192
 
193
as		= asm68k
194
as_init 	=
195
as_i_switch	= -I
196
as_o_switch	= -o$@
197
as_source	= <$<
198
as_cmdfile	=
199
as_term 	= ;				# ';' forces use of 'sh.exe'
200
 
201
asm68_flags	= -f"P=CPU32,d" 		# embedded debug info
202
#asm68_flags	+= -f"NOPCR"
203
#ifeq "$(DEBUG)" "1"
204
#asm68_flags	+= -DDEBUG
205
#endif
206
ifdef ASFLAGS
207
asm68_flags	+= $(ASFLAGS)
208
endif
209
ifdef as_defines
210
asm68_flags	+= $(addprefix -D,$(as_defines))
211
endif
212
 
213
as_flags	= $(asm68_flags)
214
#ifdef INCDIRS
215
#as_flags	+= "-I$(subst $(space),;,$(strip $(INCDIRS)))"
216
#endif
217
ifdef as_includes
218
as_flags	+= "-I$(subst $(space),;,$(strip $(as_includes)))"
219
endif
220
 
221
define as_pre
222
endef
223
define as_post
224
endef
225
 
226
#..     Archiver
227
#
228
ar		= lib68k
229
ar_init 	=
230
ar_cmdfile	= $(basename $@).ar
231
ar_flags	=
232
ar_o_switch	= < $(ar_cmdfile)
233
ar_term 	= ;				# ';' forces use of 'sh.exe'
234
 
235
define ar_pre
236
	-$(rm) -f $@
237
	@$(cmdfile) -ko$(ar_cmdfile) \
238
		create $@\\n\
239
		$(patsubst %,addmod %\\n,$(filter %.obj, $^))\
240
		save\\n end\\n
241
endef
242
 
243
ifndef LEAVETMP
244
define ar_post
245
	@$(rm) -f $(ar_cmdfile)
246
endef
247
else
248
define ar_post
249
endef
250
endif
251
 
252
 
253
#..     Linker
254
#
255
ld		= lnk68k
256
ld_cmdfile	= $(basename $@).ld
257
ldabs_flags	= -m -c$(ld_cmdfile)
258
ldabs_o_switch	= -o$@ > $(basename $@).map
259
ldhex_flags	= -m -Fs -c$(ld_cmdfile)
260
ldhex_o_switch	= -o$(basename $@).s > $(basename $@).map
261
ld_term 	= ;             # ';' forces use of 'sh.exe'
262
rel_ld_term	= ;
263
 
264
define ld_pre
265
	@export MRI_LIB; \
266
		MRI_LIB="$(subst $(space),;,$(LIBDIRS))"; \
267
	$(cmdfile) -ko$(ld_cmdfile) "$($(notdir $(basename $@))_ld)"
268
endef
269
 
270
define ldabs_post
271
	@if [ -n "$$VISIONCLICK" ]; then \
272
		$(est32)/convert "$@" -c -m arm -b; \
273
	fi
274
endef
275
 
276
define ldhex_post
277
endef
278
 
279
ifndef LEAVETMP
280
define ld_post
281
	@$(rm) -f $(ld_cmdfile)
282
endef
283
else
284
define ld_post
285
endef
286
endif
287
 
288
define LDDEPEND
289
	@export MRI_LIB; \
290
		MRI_LIB="$(subst $(space),;,$(LIBDIRS))"; \
291
	$(cmdfile) -ko$(BINDIR)/$(notdir $(basename $@)).dep "$($(notdir $(basename $@))_dp)"
292
endef
293
 
294
define LDABS
295
	@$(show_environment)
296
	$(ld_pre)
297
    $(ld) $(ldabs_flags) $(ldabs_o_switch) $(ld_term)
298
	$(ldabs_post)
299
	$(ld_post)
300
endef
301
 
302
define LDBIN
303
	@$(show_environment)
304
	$(ld_pre)
305
    $(ld) $(ldhex_flags) $(ldhex_o_switch) $(ld_term)
306
	$(ldhex_post)
307
	$(ld_post)
308
endef
309
 
310
#