Subversion Repositories DevTools

Rev

Rev 261 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
227 dpurdie 1
# -*- mode: mak -*-
2
###############################################################################
3
# Module name   : TOOLSET/gnupro_h8.rul
4
# Module type   : Makefile system
5
# Environment(s): GnuPro H8
6
#
7
# Version   Who   Date      Description
8
#           DDP   23-Nov-04 Created
9
#
10
###################################################################
11
 
12
###############################################################################
13
#..  Remove "undef" warnings
14
#
15
cc_includes	+=
16
cc_defines	+=
17
cxx_include	+=
18
cxx_defines	+=
19
as_includes	+=
20
as_defines	+=
21
 
22
###############################################################################
23
#..     Parse user options
24
#       Global options already parsed
25
#       These options extend the global options
26
#
27
 
28
ifdef OPTIONS
29
 
30
ifneq "$(findstring wall,$(OPTIONS))" ""	    # Enable all warnings
31
USE_WALL	= 1
32
endif
33
 
34
endif
35
 
36
 
37
###############################################################################
38
#..  C Compiler definition
39
#
40
#    -ms                Generate code for the H8S chip.
41
#    -c                 Compile only
42
#    -0                 Optimize
43
#    -ffloat-store      Do not store floating point variables in registers
44
#                       and inhabit other options that might change whether
45
#                       floating point value is taken from register or
46
#                       memory.
47
#    -g3                The compiler debugging option, followed by the level.
48
#                       Level 3 included extra information.
49
#    -Wall              Issue warnings.
50
#    -r                 Elimates the use of built-in implicit rules.
51
#    -save-temps        Do not delete intermediate files
52
#    -mint32            Make int data 32 bits by default.
53
#    -malign-300        Align longs and floats on 2 byte boundaries.
54
#
55
 
56
cc		= $(CC_PRE) gcc
57
cc_init 	=
58
cc_o_switch	= -o $@
59
cc_source	= $<
60
cc_flags	= \
61
		$(patsubst %,%,$(CFLAGS)) \
62
		$(patsubst %,-D%,$(cc_defines)) \
63
		$(patsubst %,%,$(gcc_flags)) \
64
		$(patsubst %,-I %,$(INCDIRS)) \
65
		$(patsubst %,-I %,$(cc_includes)) \
66
		$(patsubst %,-I %,$(gcc_includes))
67
cc_term 	= ;				# ';' forces use of 'sh.exe'
68
 
69
gcc_includes	+= $(H8Dir)/Include
70
gcc_flags	= -c -ms -Wall -W -ffloat-store -r -mint32 -malign-300
71
 
72
ifdef USE_WALL
73
#gcc_flags	+= -Wuninitialized		# only makes sense with `-O'
74
gcc_flags	+= -Wwrite-strings
75
gcc_flags	+= -Wcast-qual
76
gcc_flags	+= -Wbad-function-cast
77
gcc_flags	+= -Wpointer-arith
78
gcc_flags	+= -Wstrict-prototypes
79
gcc_flags	+= -Wmissing-prototypes
80
gcc_flags	+= -Wmissing-declarations
81
gcc_flags	+= -Wnested-externs
82
gcc_flags	+= -Wtraditional
83
gcc_flags	+= -Wconversion
84
gcc_flags	+= -Wcomment
85
gcc_flags	+= -Wcast-align
86
#gcc_flags	+= -Winline
87
gcc_flags	+= -Wshadow
88
gcc_flags	+= -Wredundant-decls
89
gcc_flags	+= -Wid-clash-31
90
endif
91
 
92
ifdef FORCE_C_COMPILE
93
gcc_flags       += -x c
94
endif
95
 
96
ifdef FORCE_CC_COMPILE
97
gcc_flags       += -x c++
98
endif
99
 
100
ifdef LEAVETMP
101
gcc_flags       += -save-temps
102
endif
103
 
104
ifdef USE_STRICT_ANSI
105
gcc_flags       += -ansi
106
endif
107
 
108
ifdef USE_OPTIMISE
109
gcc_flags       += -O3
110
else
111
gcc_flags       +=
112
endif
113
 
114
ifdef USE_DEBUGINFO
115
gcc_flags       += -g3 -DDEBUG
116
else
117
gcc_flags       += -DNDEBUG
118
endif
119
 
120
ifeq "$(DEBUG)" "1"
121
gcc_flags	+=
122
else
123
gcc_flags	+=
124
endif
125
 
126
ifdef ALVL
127
gcc_flags	+= -DALVL=$(ALVL)
128
endif
129
 
130
ifdef DLVL
131
gcc_flags	+= -DDLVL=$(DLVL)
132
endif
133
 
134
gcc_flags	+= -D__SOURCE__=\"$(notdir $<)\"
135
ifdef LEAVETMP
136
gcc_flags	+= -save-temps
137
endif
138
 
139
define cc_pre
6177 dpurdie 140
	@echo '[$<] compiling..'
227 dpurdie 141
endef
142
 
143
define cc_post
144
endef
145
 
146
 
147
###############################################################################
148
#..     C/C++ dependencies
149
#
150
#    -M		Generate make dependencies
151
#    -MM	As -M, but ignore system header files
152
#    -MG	Treat missing header files as generated
153
#
154
 
155
ifeq "$(DEBUG)" "1"
156
gcc_depend	+= -DDEBUG
157
endif
158
ifdef ALVL
159
gcc_depend	+= -DALVL=$(ALVL)
160
endif
161
ifdef DLVL
162
gcc_depend	+= -DDLVL=$(DLVL)
163
endif
164
 
165
###############################################################################
166
#..     C/C++ dependencies
167
#       depend and depend.err
168
#
169
ccdep		= $(XX_PRE) $(GBE_BIN)/mkdepend
170
ccdep_o_switch	= -f -
171
ccdep_init	=
172
#ccdep_source	= $(filter %.c %.cc %.cpp, $+) > $(subst /,/,$@).tmp 2> $@.err
173
ccdep_source	= $(filter %.c %.cc %.cpp, $+) > $@ 2> $@.err
174
ccdep_flags	= -MM -b -p '$$(OBJDIR)/' -o ".$(o)" \    
175
		$(patsubst %,%,$(CFLAGS)) \
176
		$(patsubst %,-D%,$(cc_defines)) \
177
		$(patsubst %,%,$(gcc_depend)) \
178
		$(patsubst %,-I %,$(INCDIRS)) \
179
		$(patsubst %,-I %,$(cc_includes)) \
180
		$(patsubst %,-Y %,$(gcc_includes))
181
ccdep_pre	=
182
ccdep_post	=
183
 
184
 
185
###############################################################################
186
#..     C++ Compiler definition
187
#
188
 
189
cxx		= $(CC_PRE) gcc
190
cxx_init	=
191
cxx_switch	= -o $@
192
cxx_source	= $<
193
cxx_flags	= \
194
		$(patsubst %,%,$(CXXFLAGS)) \
195
		$(patsubst %,-d%,$(cxx_defines)) \
196
		$(patsubst %,%,$(gcc_flags)) \
197
		$(patsubst %,-I %,$(INCDIRS)) \
198
		$(patsubst %,-I %,$(cxx_includes)) \
199
		$(patsubst %,-I %,$(gcc_includes))
200
cxx_term	= ;				# ';' forces use of 'sh.exe'
201
 
202
define cxx_pre
6177 dpurdie 203
	@echo '[$<] compiling..'
227 dpurdie 204
endef
205
 
206
define cxx_post
207
endef
208
 
209
 
210
###############################################################################
211
#..     Archiver
212
#
213
ar		= $(XX_PRE) $(H8Dir)/bin/ar
214
ar_o_switch	=
215
ar_flags	= -scvr $@ $(patsubst %,%,$^)
216
 
217
define ar_pre
6177 dpurdie 218
	@$(echo) '[$@] Creating library archive..'
227 dpurdie 219
endef
220
 
221
ar_post =
222
 
223
 
224
###############################################################################
225
#..     Archive Merge
226
#
227
arnull          = arnull.txt
228
armerge		    = $(XX_PRE) $(GBE_TOOLS)/armerge
229
armerge_init	=
261 dpurdie 230
armerge_flags	= -d $(MLIBDIR)/merge -t unix -a ar -n $(arnull)
227 dpurdie 231
armerge_o_switch= $@ $^
232
 
233
define  armerge_pre
6177 dpurdie 234
	@$(echo) '[$@] Merging library archive..'
227 dpurdie 235
	$(XX_PRE) rm -f $@ $(arnull)
236
endef
237
 
238
ifndef LEAVETMP
239
define armerge_post
240
	@-$(rm) -rf $(arnull) $(OBJDIR)/merge
241
endef
242
else
243
define armerge_post
244
endef
245
endif
246
 
247
###############################################################################
248
#..     Assembler definition
249
#       Although the assembler is not currently supported the following
250
#       definition is required by the make system
251
#
252
as_init		=
253
 
254
 
255
 
256
#