Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
227 dpurdie 1
# -*- mode: mak; -*-
2
###############################################################################
3
# File:         TOOLSET/djgpp.rul[e]
4
# Contents:     DJGPP rules
5
#
6
# Revision History:
7
#       06/02/00  APY   Created
8
#       25/06/00  APY   - __SOURCE__
9
#                       - updated gcc_depend
10
###############################################################################
11
 
12
###############################################################################
13
#..     Remove "undef" warnings
14
#
15
cc_includes	+=
16
cc_defines	+=
17
cxx_includes	+=
18
cxx_defines	+=
19
as_includes	+=
20
as_defines	+=
21
 
22
###############################################################################
23
#..     C Compiler definition
24
#
25
cc		= @gcc
26
cc_init 	=
27
cc_o_switch	=
28
cc_object	= -o $@
29
cc_source	= $<
30
cc_cmdfile	= $(basename $@).cmd
31
cc_flags	= @$(cc_cmdfile)
32
 
33
gcc_includes	+= $(usr)/include
34
 
35
gcc_flags	= -Wall -c
36
ifeq "$(DEBUG)" "1"
37
gcc_flags	+= -g -O -DDEBUG
38
else
39
gcc_flags	+= -O2
40
endif
41
ifdef ALVL
42
gcc_flags	+= -DALVL=$(ALVL)
43
endif
44
ifdef DLVL
45
gcc_flags	+= -DDLVL=$(DLVL)
46
endif
47
wc_flags	+= -D__SOURCE__=\"$(notdir $<)\"
48
ifdef LEAVETMP
49
gcc_flags	+= -save-temps
50
endif
51
 
52
define cc_pre
6177 dpurdie 53
	@echo '[$<] compiling..'; \
227 dpurdie 54
	$(cmdfile) -ko$(cc_cmdfile) "\
55
		$(patsubst %,%\\n,$(CFLAGS)) \
56
		$(patsubst %,-D%\\n,$(cc_defines)) \
57
		$(patsubst %,%\\n,$(gcc_flags)) \
58
		$(patsubst %,-I %\\n,$(INCDIRS)) \
59
		$(patsubst %,-I %\\n,$(cc_includes)) \
60
		$(patsubst %,-I %\\n,$(gcc_includes)) \
61
		$(cc_object)"
62
endef
63
 
64
ifndef LEAVETMP
65
define cc_post
66
        @$(rm) -f $(cc_cmdfile)
67
endef
68
else
69
define cc_post
70
endef
71
endif
72
 
73
###############################################################################
74
#..     C/C++ dependencies
75
#       depend and depend.err
76
#
77
gcc_depend	=  -D__GNUC__=2 -D__STDC__
78
gcc_depend      =  -Dunix -Di386 -DGO32 -DDJGPP=2 -DMSDOS
79
ifeq "$(DEBUG)" "1"
80
gcc_depend	+= -DDEBUG
81
endif
82
ifdef ALVL
83
gcc_depend	+= -DALVL=$(ALVL)
84
endif
85
ifdef DLVL
86
gcc_depend	+= -DDLVL=$(DLVL)
87
endif
88
 
89
ccdep		= @$(SCM_BIN)/mkdepend
90
ccdep_init	=
91
ccdep_o_switch	= -o.${o} -f -
92
ccdep_source	= $(filter %.c %.cc %.cpp, $+) > $(subst /,\\,$@) 2> $@.err
93
ccdep_flags	= -MM \
94
                $(patsubst %,%,$(CFLAGS)) \
95
		$(patsubst %,-D%,$(cc_defines)) \
96
		$(patsubst %,%,$(gcc_depend)) \
97
		$(patsubst %,-I %,$(INCDIRS)) \
98
		$(patsubst %,-I %,$(cc_includes)) \
99
		$(patsubst %,-Y %,$(gcc_includes))
100
ccdep_pre       =
101
ccdep_post      =
102
 
103
#..     C++ Compiler definition
104
#
105
cxx		= @gcc
106
cxx_init	=
107
cxx_o_switch	=
108
cxx_object	= -o $@
109
cxx_source	= $<
110
cxx_cmdfile	= $(basename $@).cmd
111
cxx_flags	= @$(cxx_cmdfile)
112
 
113
define cxx_pre
6177 dpurdie 114
	@echo '[$<] compiling..'
227 dpurdie 115
	@$(cmdfile) -ko$(cxx_cmdfile) "\
116
		$(patsubst %,%\\n,$(CXXFLAGS)) \
117
		$(patsubst %,-d%\\n,$(cxx_defines)) \
118
                $(patsubst %,%\\n,$(gcc_flags)) \
119
		$(patsubst %,-i=%\\n,$(INCDIRS)) \
120
		$(patsubst %,-i=%\\n,$(cxx_includes)) \
121
		$(patsubst %,-i=%\\n,$(gcc_includes)) \
122
		$(subst /,\\\\,$(cxx_object))"
123
endef
124
 
125
ifndef LEAVETMP
126
define cxx_post
127
        @$(rm) -f $(cxx_cmdfile)
128
endef
129
else
130
define cxx_post
131
endef
132
endif
133
 
134
 
135
###############################################################################
136
#..     Assembler definition
137
#
138
 
139
#..     Assembler (GCC)
140
#
141
as		= @gcc 
142
as_init		=
143
as_i_switch	= -I$(space)
144
as_o_switch	=
145
as_object	= -o $@
146
as_source	= $<
147
as_cmdfile	= $(basename $@).cmd
148
as_flags	= @$(as_cmdfile)
149
 
150
gas_flags	= -Wall -x assembler-with-cpp -c
151
ifeq "$(DEBUG)" "1"
152
gas_flags	+= -g -DDEBUG
153
endif
154
ifdef DLVL
155
gas_flags	+= -DDLVL=$(DLVL)
156
endif
157
ifdef ALVL
158
gas_flags	+= -DALVL=$(ALVL)
159
endif
160
as_defines	:= $(addprefix -D,$(as_defines))
161
as_defines	+= $(gas_flags)
162
 
163
define as_pre
164
	@$(cmdfile) -ko$(as_cmdfile) "\
165
		$(patsubst %,%\\n,$(ASFLAGS)) \
166
		$(patsubst %,%\\n,$(as_defines)) \
167
		$(patsubst %,$(as_i_switch)%\\n,$(INCDIRS)) \
168
		$(patsubst %,$(as_i_switch)%\\n,$(as_includes)) \
169
		$(as_object)\\n"
170
endef
171
 
172
ifndef LEAVETMP
173
define as_post
174
	@$(rm) -f $(as_cmdfile)
175
endef
176
else
177
define as_post
178
endef
179
endif
180
 
181
 
182
#..     Archiver
183
#
184
ar		= ar
185
ar_cmdfile	= $(basename $@).ar
186
ar_flags	= -cvr
187
ar_o_switch	= $@ @$(ar_cmdfile)
188
 
189
define ar_pre
190
	@rm -f $@
191
	@$(cmdfile) -ko$(ar_cmdfile) \
192
		$(patsubst %,%\\n,$^)
193
endef
194
 
195
ifndef LEAVETMP
196
define ar_post
197
	@$(rm) -f $(ar_cmdfile)
198
endef
199
else
200
define ar_post
201
endef
202
endif
203
 
204
#..     Linker
205
#
206
ld		= gcc
207
ld_init		=
208
ld_cmdfile	= $(basename $@).ld
209
ifeq "$(DEBUG)" "1"
210
ld_flags	= -g
211
endif
212
ld_o_switch	= @$(ld_cmdfile)
213
 
214
define ld_pre
215
	@export DJGPP_LIB; \
216
		DJGPP_LIB="$(subst $(space),;,$(LIBDIRS))"; \
217
	$(cmdfile) -ko$(ld_cmdfile) "$($(notdir $(basename $@))_ld)"
218
endef
219
 
220
ifndef LEAVETMP
221
define ld_post
222
	@$(rm) -f $(ld_cmdfile)
223
endef
224
else
225
define ld_post
226
endef
227
endif
228
 
229
define LDDEPEND
230
	@export DJGPP_LIB; \
231
		DJGPP_LIB="$(subst $(space),;,$(LIBDIRS))"; \
232
	$(cmdfile) -ko$(BINDIR)/$(notdir $(basename $@)).dep "$($(notdir $(basename $@))_dp)"
233
endef
234
 
235
#