Subversion Repositories DevTools

Rev

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

Rev Author Line No. Line
227 dpurdie 1
###############################################################################
2
# File:         TOOLSET/standard.rul[e]
3
#
4
# Contents:     Toplevel toolset driver for doing stuff
5
#
6
#       CC              Compile a C source file
7
#       CCDEPEND
8
#       CXX             Compile a C++ source file
9
#       CCDEPEND
10
#       AS              Compile an assembler file
11
#       ASDEPEND
12
#       AR              Archive
13
#       LD              Linker
14
#       SHLD            Linked (shared library)
15
#
16
###############################################################################
17
 
18
#
19
#   Global control of compiler filters
20
#   USE_FILTER is defined by default
21
#
22
ifndef USE_FILTER
23
    cc_error_filter =
24
    cxx_error_filter =
25
    as_error_filter =
26
endif
27
 
28
###############################################################################
29
#  Compile a C file.
30
###############################################################################
31
 
32
cc_term		+=
33
 
34
ifdef cc_error_filter
35
 ifdef cc_redirect
36
define CC
37
	@$(cc_pre)
38
	@$(show_environment)
39
	$(cc) $(cc_flags) $(cc_o_switch) $(cc_source) > $(basename $@).err $(cc_term);\
40
	rv=$$?;\
41
	$(cc_error_filter) < $(basename $@).err;\
42
	exit $$rv;
43
	@$(cc_post)
44
endef
45
 else
46
  ifdef cc_redirect_stderr
47
define CC
48
	@$(cc_pre)
49
	@$(show_environment)
50
	$(cc) $(cc_flags) $(cc_o_switch) $(cc_source) 2>&1 | $(cc_error_filter) $(cc_term)
51
	@$(cc_post)
52
endef
53
  else
54
define CC
55
	@$(cc_pre)
56
	@$(show_environment)
57
	$(cc) $(cc_flags) $(cc_o_switch) $(cc_source) | $(cc_error_filter) $(cc_term)
58
	@$(cc_post)
59
endef
60
  endif
61
 endif
62
else
63
define CC
64
	@$(cc_pre)
65
	@$(show_environment)
66
	$(cc) $(cc_flags) $(cc_o_switch) $(cc_source) $(cc_term)
67
	@$(cc_post)
68
endef
69
endif
70
 
71
$(OBJDIR)/%.${o}:	%.c $(cc_init)
72
	$(CC)
73
 
74
ccdep_term +=
75
define CCDEPEND
76
	@$(ccdep_pre)
77
	@$(show_environment)
78
	$(ccdep) $(ccdep_flags) $(ccdep_o_switch) $(ccdep_source) $(ccdep_term)
79
	@$(ccdep_post)
80
endef
81
 
82
 
83
###############################################################################
84
#  Compile a C++ file.
85
###############################################################################
86
 
87
cxx_term	+=
88
 
89
ifdef cxx_error_filter
90
 ifdef cxx_redirect
91
define CXX
92
	@$(cxx_pre)
93
	@$(show_environment)
94
	$(cxx) $(cxx_flags) $(cxx_o_switch) $(cxx_source) > $(basename $@).err $(cxx_term);\
95
        rv=$$?;\
96
	    $(cxx_error_filter) < $(basename $@).err;\
97
        exit $$rv
98
	@$(rm) $(basename $@).err
99
	@$(cxx_post)
100
endef
101
 else
102
  ifdef cxx_redirect_stderr
103
define CXX
104
	@$(cxx_pre)
105
	@$(show_environment)
106
	$(cxx) $(cxx_flags) $(cxx_o_switch) $(cxx_source) 2>&1 | $(cxx_error_filter) $(cxx_term)
107
	@$(cxx_post)
108
endef
109
  else
110
define CXX
111
	@$(cxx_pre)
112
	@$(show_environment)
113
	$(cxx) $(cxx_flags) $(cxx_o_switch) $(cxx_source) | $(cxx_error_filter) $(cxx_term)
114
	@$(cxx_post)
115
endef
116
  endif
117
 endif
118
else
119
define CXX
120
	@$(cxx_pre)
121
	@$(show_environment)
122
	$(cxx) $(cxx_flags) $(cxx_o_switch) $(cxx_source) $(cxx_term)
123
	@$(cxx_post)
124
endef
125
endif
126
 
127
ifdef cxx_init
128
$(OBJDIR)/%.${o}:	%.cc $(cxx_init)
129
	$(CXX)
130
 
131
$(OBJDIR)/%.${o}:	%.cpp $(cxx_init)
132
	$(CXX)
133
endif
134
 
135
###############################################################################
136
#  Assemble a file of assembler.
137
###############################################################################
138
 
139
as_term		+=
140
 
141
 
142
ifdef as_error_filter
143
 ifdef as_redirect
144
define AS
145
	@$(as_pre)
146
	@$(show_environment)
147
	$(as) $(as_flags) $(as_o_switch) $(as_source) > $(basename $@).as $(as_term)
148
	@$(as_error_filter) < $(basename $@).as
149
	@$(rm) $(basename $@).as
150
	@$(as_post)
151
  endef
152
 else
153
define AS
154
	@$(as_pre)
155
	@$(show_environment)
156
	$(as) $(as_flags) $(as_o_switch) $(as_source) | $(as_error_filer) $(as_term)
157
	@$(as_post)
158
endef
159
 endif
160
else
161
define AS
162
	@$(as_pre)
163
	@$(show_environment)
164
	$(as) $(as_flags) $(as_o_switch) $(as_source) $(as_term)
165
	@$(as_post)
166
endef
167
endif
168
 
169
ifdef as_init
170
$(OBJDIR)/%.${o}:	%.${s} $(as_init)
171
	$(AS)
172
endif
173
 
174
###############################################################################
175
#  Build a library
176
###############################################################################
177
 
178
ar_term		+=
179
 
180
define AR
181
	@$(ar_pre)
182
	@$(show_environment)
183
	$(ar) $(ar_flags) $(ar_o_switch) $(ar_term)
184
	@$(ar_post)
185
endef
186
 
187
ifdef ar_depend
188
$(BINDIR)/%.${a}:	$(ar_depend) $(ar_init)
189
	$(AR)
190
endif
191
 
192
###############################################################################
193
#  Merge libraries
194
###############################################################################
195
 
196
define ARMERGE
197
	@$(armerge_pre)
198
	@$(show_environment)
199
	$(armerge) $(armerge_flags) $(armerge_o_switch)
200
	@$(armerge_post)
201
endef
202
 
203
ifdef armerge_depend
204
$(BINDIR)/%.${a}:	$(armerge_depend) $(armerge_init)
205
	$(ARMERGE)
206
endif
207
 
208
 
209
###############################################################################
210
# Generate a large relocatable object module from a bunch of object
211
# modules. Only bother with this if the compiler suite defines a
212
# `rel' extension for file names.
213
###############################################################################
214
 
215
rel_ld_term	+=
216
 
217
ifdef rel
218
ifneq (${a},${rel})
219
#
220
#       Only have the rules for a large relocatable build if it's not
221
#       the same as a normal library build.
222
#
223
$(BINDIR)/%.$(rel):	$(rel_ld_init)
224
	@$(rel_ld_pre)
225
	@$(show_environment)
226
	$(rel_ld) $(rel_ldflags) $(rel_ld_o_switch) $(rel_ld_term)
227
	@$(rel_ld_post)
228
endif
229
endif
230
 
231
###############################################################################
232
#  Link a shared library
233
###############################################################################
234
 
235
shld_term	+=
236
 
237
ifdef shld
238
define SHLD
239
	@$(shld_pre)
240
	@$(show_environment)
241
	$(shld) $(shld_flags) $(shld_o_switch) $(shld_term)
242
	@$(shld_post)
243
endef
244
endif
245
 
246
###############################################################################
247
#  Link an executable
248
###############################################################################
249
 
250
ld_term		+=
251
 
252
define LD
253
	@$(ld_pre)
254
	@$(show_environment)
255
	$(ld) $(ld_flags) $(ld_o_switch) $(ld_term)
256
	@$(ld_post)
257
endef
258
 
259
ifdef ld_depend
260
$(BINDIR)/%$(exe):	$(ld_depend) $(ld_init)
261
	$(LD)
262
endif
263
 
264
#