Subversion Repositories DevTools

Rev

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

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