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/wc386.rul[e]
4
# Contents:     WATCOM/386 rules
5
#
6
# Revision History:
7
#       95       JONW   CMOS dev env
8
#       xx/08/99 APY    Ported
9
#       09/12/99 APY    LDDEPEND
10
#       10/01/00 APY    WASM interface broken
11
#       22/03/00 APY    NODEPDIRS
12
#       05/06/00 APY    __SOURCE__
13
#       14/06/00 APY    __TNT__ and __DOS4G__
14
#       26/02/02 APY    Build system +v2 support.
15
#                       - ; appended to several directives, forcing use of
16
#                         'sh.exe' during execution.  Required by WIN32
17
#                         toolsets (see xx_term variables),
18
#                       - added depend post processing to append OBJDIR
19
#       09/04/02        - __WATCOMC__ defined within asm sessions
20
#                       - trimmed white space
21
#       30/05/02        - realpath() usage during assembler sessions.
22
#                         (MASM and ASM386 only)
23
#                       - switch doco
24
#                       - (zc) enabled
25
###############################################################################
26
# Additional options above those supported by the basic build
27
# environment are...
28
#
29
# TS_MASM_AS:
30
#	If this variable is defined then the masm assembler will be
31
#	used rather than the watcom one.
32
#
33
# TS_PHARLAP_AS:
34
#	If this variable is defined then the pharlap assembler will be
35
#	used rather than the watcom one.
36
#
37
# TS_PHARLAP_LD:
38
#	If this variable is defined then the pharlap linker will be
39
#	used rather than the watcom one.
40
#
41
###############################################################################
42
 
43
###############################################################################
44
#..     Remove "undef" warnings
45
#
46
cc_includes	+=
47
cc_defines	+=
48
cxx_includes	+=
49
cxx_defines	+=
50
as_includes	+=
51
as_defines	+=
52
 
53
###############################################################################
54
#..     C Compiler definition
55
#
56
#    -mf          FLAT memory model
57
#    -s           remove stack overflow checks
58
#    -ez          generate PharLap EZ-OMF object files
59
#    -ei          force enums to be type int
60
#    -zq          operate quietly
61
#    -w3          set warning level number to 3
62
#    -3r          386 register calling conventions (default).
63
#
64
#    -fpi         inline 80x87 instructions with emulation
65
#    -zc          place literal strings in the code segment
66
#
67
cc		= wcc386
68
cc_init		=
69
cc_o_switch	=
70
cc_object	= -fo=$@
71
cc_source	= $(subst /,\\,$<)
72
cc_cmdfile	= $(subst /,\\,$(basename $@).cmd)
73
cc_flags	= @$(cc_cmdfile)
74
cc_term		= ;				# ; force use of 'sh.exe'
75
 
76
cc_filter	:= "$(notdir $(wildcard $(GBE_ROOT)/warnings.wc*))"
77
ifeq ($(strip $(cc_filter)), "warnings.wc")
78
cc_redirect	= 1
79
cc_error_filter = $(awk) -f $(GBE_ROOT)/warnings.wc
80
endif
81
 
82
ifdef tnt70
83
wc_includes	+= $(tnt70)/include
84
endif
85
wc_includes	+= $(watcom)/h
86
 
87
wc_flags	=  -mf -s -ez -wx -ei -zq -w3
88
wc_flags	+= -fpi -zc
89
ifeq "$(DEBUG)" "1"
90
wc_flags	+= -DDEBUG -d2
91
else
92
wc_flags	+= -ox
93
endif
94
ifdef ALVL
95
wc_flags	+= -DALVL=$(ALVL)
96
endif
97
ifdef DLVL
98
wc_flags	+= -DDLVL=$(DLVL)
99
endif
100
wc_flags	+= -D__SOURCE__=\"$(notdir $<)\"
101
ifdef tnt70
102
wc_flags	+= -D__TNT__
103
else
104
wc_flags	+= -D__DOS4G__
105
endif
106
 
107
define cc_pre
6177 dpurdie 108
	@echo '[$<] compiling..'
227 dpurdie 109
	@$(cmdfile) -ko$(cc_cmdfile) "\
110
		$(patsubst %,%\\n,$(CFLAGS))\
111
		$(patsubst %,-d%\\n,$(cc_defines))\
112
		$(patsubst %,%\\n,$(wc_flags))\
113
		$(patsubst %,-i=%\\n,$(subst /,\\\\,$(INCDIRS)))\
114
		$(patsubst %,-i=%\\n,$(subst /,\\\\,$(cc_includes)))\
115
		$(patsubst %,-i=%\\n,$(subst /,\\\\,$(wc_includes)))\
116
		$(subst /,\\\\,$(cc_object))\\n"
117
endef
118
 
119
ifndef LEAVETMP
120
define cc_post
121
        @$(rm) -f $(cc_cmdfile)
122
endef
123
else
124
define cc_post
125
endef
126
endif
127
 
128
###############################################################################
129
#..     C/C++ dependencies
130
#       depend and depend.err
131
#
132
wc_depend	=  -D__WATCOMC__=1000 -D__STDC__
133
wc_depend	+= -D__386__ -DMSDOS -D__DOS__
134
ifeq "$(DEBUG)" "1"
135
wc_depend	+= -DDEBUG
136
endif
137
ifdef ALVL
138
wc_depend	+= -DALVL=$(ALVL)
139
endif
140
ifdef DLVL
141
wc_depend	+= -DDLVL=$(DLVL)
142
endif
143
wc_depend	+= -D__SOURCE__=\"$(notdir $<)\"
144
ifdef tnt70
145
wc_depend	+= -D__TNT__
146
else
147
wc_depend	+= -D__DOS4G__
148
endif
149
 
150
ccdep		= @$(SCM_BIN)/mkdepend
151
ccdep_init	=
152
ccdep_o_switch	= -f -
153
ccdep_source	= $(filter %.c %.cc %.cpp, $+) > $(subst /,/,$@).tmp 2> $@.err
154
ccdep_flags	= -MM \
155
		$(patsubst %,%,$(CFLAGS)) \
156
		$(patsubst %,-D%,$(cc_defines)) \
157
		$(patsubst %,%,$(wc_depend)) \
158
		$(patsubst %,-I %,$(INCDIRS)) \
159
		$(patsubst %,-Y %,$(cc_includes)) \
160
		$(patsubst %,-Y %,$(wc_includes)) \
161
                $(patsubst %,-Y %,$(NODEPDIRS))
162
 
163
ccdep_pre	=
164
 
165
define ccdep_post
166
	-sed s/\^/\$$\(OBJDIR\)\\// $(subst /,/,$@).tmp | grep \\.${o} > $(subst /,/,$@)
167
	@rm $(subst /,/,$@).tmp 
168
endef
169
 
170
#..     C++ Compiler definition
171
#
172
cxx		= wcc386
173
cxx_init	=
174
cxx_o_switch	=
175
cxx_object	= -fo=$@
176
cxx_source	= $(subst /,\\,$<)
177
cxx_cmdfile	= $(subst /,\\,$(basename $@).cmd)
178
cxx_flags	= @$(cxx_cmdfile)
179
cxx_term	= ;				# ; force use of 'sh.exe'
180
 
181
define cxx_pre
6177 dpurdie 182
	@echo '[$<] compiling..'
227 dpurdie 183
	@$(cmdfile) -ko$(cxx_cmdfile) "\
184
		$(patsubst %,%\\n,$(CXXFLAGS))\
185
		$(patsubst %,-d%\\n,$(cxx_defines))\
186
		$(patsubst %,%\\n,$(wc_flags))\
187
		$(patsubst %,-i=%\\n,$(subst /,\\\\,$(INCDIRS)))\
188
		$(patsubst %,-i=%\\n,$(subst /,\\\\,$(cxx_includes)))\
189
		$(patsubst %,-i=%\\n,$(subst /,\\\\,$(wc_includes)))\
190
		$(subst /,\\\\,$(cxx_object))\\n"
191
endef
192
 
193
ifndef LEAVETMP
194
define cxx_post
195
	@$(rm) -f $(cxx_cmdfile)
196
endef
197
else
198
define cxx_post
199
endef
200
endif
201
 
202
 
203
###############################################################################
204
#..     Assembler definition
205
#
206
 
207
ifdef TS_MASM_AS
208
#..     Assembler (Microsoft 6.11)
209
#
210
as		= ml
211
as_init		=
212
as_i_switch	= /I
213
as_o_switch	=
214
as_object	= /Fl$(basename $@).lst /Fo$@
215
as_source	=
216
as_cmdfile	= $(subst /,\\,$(basename $@)).cmd
217
as_flags	= @$(as_cmdfile)
218
as_term 	= ;				# ; force use of 'sh.exe'
219
 
220
ifdef tnt70
221
as_includes	+= $(tnt70)/include
222
endif
223
as_includes	+= $(masm)/include
224
 
225
ml_flags	= /c /Zm /Cp /X /nologo
226
ml_flags	+= /D__WATCOMC__		# Target C/C++ compiler
227
ifeq "$(DEBUG)" "1"
228
ml_flags	+= /W2 /Zd /DDEBUG
229
endif
230
ifdef DLVL
231
ml_flags	+= /DDLVL=$(DLVL)
232
endif
233
ifdef ALVL
234
ml_flags	+= /DALVL=$(ALVL)
235
endif
236
as_defines	:= $(addprefix /D,$(as_defines))
237
as_defines	+= $(ml_flags)
238
 
239
else
240
 ifdef TS_PHARLAP_AS
241
#...    Pharlap 386asm
242
#
243
as		= 386asm
244
as_init		=
245
as_i_switch	= -i$(space)
246
as_o_switch	=
247
as_object	= -l$(basename $@).lst -o$@
248
as_source	=
249
as_cmdfile	= $(subst /,\\,$(basename $@)).cmd
250
as_flags        = @$(as_cmdfile)
251
 
252
ifdef tnt70
253
as_includes	+= $(tnt70)/include
254
endif
255
as_defines	+=
256
 
257
386asm_flags	= -nos -nol -twocase
258
386asm_flags	+= -d __WATCOMC__		# Target C/C++ compiler
259
ifdef DLVL
260
386asm_flags	+= -d DLVL=$(DLVL)
261
endif
262
ifdef ALVL
263
386asm_flags	+= -d ALVL=$(ALVL)
264
endif
265
ifeq "$(DEBUG)" "1"
266
386asm_flags	+= -d DEBUG -LNUM
267
endif
268
as_defines	:= $(addprefix -d ,$(as_defines))
269
as_defines	+= $(386asm_flags)
270
 
271
 else
272
#...    WASM (default)
273
#
274
ifndef TS_WASM_AS
275
TS_WASM_AS	=
276
endif
277
as		= @export WASM; WASM='\
278
		        $(patsubst %,%,$(ASFLAGS)) \
279
		        $(patsubst %,%,$(as_defines)) \
280
		        $(patsubst %,$(as_i_switch)%,$(subst /,\\,$(INCDIRS))) \
281
		        $(patsubst %,$(as_i_switch)%,$(subst /,\\,$(as_includes))) \
282
		        $(as_object)'; \
283
                  wasm /3
284
as_init		=
285
as_i_switch	= -i=
286
as_o_switch	=
287
as_object	= -fo=$(subst /,\\,$@)
288
as_source	= $(subst /,\\,$<)
289
as_cmdfile	= $(subst /,\\,$(basename $@)).cmd
290
as_flags	= @WASM
291
 
292
as_includes	+=
293
as_defines	+=
294
 
295
wasm_flags	= /we /zq
296
wasm_flags	+= -d__WATCOMC__		# Target C/C++ compiler
297
ifdef DLVL
298
wasm_flags	+= -dDLVL=$(DLVL)
299
endif
300
ifdef ALVL
301
wasm_flags	+= -dALVL=$(ALVL)
302
endif
303
ifeq "$(DEBUG)" "1"
304
wasm_flags	+= /dDEBUG /d2
305
endif
306
as_defines	:= $(addprefix /d,$(as_defines))
307
as_defines	+= $(wasm_flags)
308
 
309
define as_pre
310
endef
311
 
312
define as_post
313
endef
314
 
315
 endif		#WASM
316
endif		#MASM
317
 
318
ifndef as_pre
319
define as_pre
320
	@$(cmdfile) -ko$(as_cmdfile) "\
321
		$(patsubst %,%\\n,$(ASFLAGS))\
322
		$(patsubst %,%\\n,$(as_defines))\
323
		$(patsubst %,$(as_i_switch)%\\n,$(subst /,\\\\,$(INCDIRS)))\
324
		$(patsubst %,$(as_i_switch)%\\n,$(subst /,\\\\,$(as_includes)))\
325
		$(as_object)\\n\
326
		@(realpath,$(subst /,\\,$<))"
327
endef
328
 
329
ifndef LEAVETMP
330
define as_post
331
	@$(rm) -f $(as_cmdfile)
332
endef
333
else
334
define as_post
335
endef
336
endif
337
endif   #!as_pre
338
 
339
#..     Archiver
340
#
341
ar		= wlib
342
ar_init 	=
343
ar_cmdfile	= $(subst /,\\,$(basename $@).ar)
344
ar_flags	= -b -c -n -q -p=512
345
ar_o_switch	= $(subst /,\\,$@) @$(ar_cmdfile)
346
ar_term 	= ;				# ; force use of 'sh.exe'
347
 
348
define ar_pre
349
	@$(cmdfile) -ko$(ar_cmdfile) \
350
		$(patsubst %,%\\n,$(subst /,\\\\,$^))
351
endef
352
 
353
ifndef LEAVETMP
354
define ar_post
355
	@$(rm) -f $(ar_cmdfile)
356
endef
357
else
358
define ar_post
359
endef
360
endif
361
 
362
 
363
#..     Linker
364
#
365
ifdef TS_PHARLAP_LD
366
TS_PHARLAP_LD	= 1
367
ld		= 386link
368
ld_cmdfile	= $(subst /,\\,$(basename $@).ld)
369
ld_flags	= @$(ld_cmdfile)
370
ld_o_switch	= -exe $@
371
ld_term 	= ;				# ; force use of 'sh.exe'
372
 
373
ld_pre		=
374
ld_post		=
375
 
376
else
377
TS_WATCOM_LD	= 1
378
ld		= wlink
379
ld_cmdfile	= $(subst /,\\,$(basename $@).ld)
380
ld_flags	= @$(ld_cmdfile)
381
ld_o_switch	=
382
ld_term 	= ;				# ; force use of 'sh.exe'
383
 
384
endif           #WLINK
385
 
386
define ld_pre
387
	@export WC386_LIB; \
388
		WC386_LIB="$(subst $(space),;,$(LIBDIRS))"; \
389
	$(cmdfile) -ko$(ld_cmdfile) "$($(notdir $(basename $@))_ld)"
390
endef
391
 
392
ifndef LEAVETMP
393
define ld_post
394
	@$(rm) -f $(ld_cmdfile)
395
endef
396
else
397
define ld_post
398
endef
399
endif
400
 
401
define LDDEPEND
402
	@export WC386_LIB; \
403
		WC386_LIB="$(subst $(space),;,$(LIBDIRS))"; \
404
	$(cmdfile) -ko$(BINDIR)/$(notdir $(basename $@)).dep "$($(notdir $(basename $@))_dp)"
405
endef
406
 
407
#