Subversion Repositories DevTools

Rev

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