-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMAKEDEFS.WTC
543 lines (428 loc) · 10.3 KB
/
MAKEDEFS.WTC
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
# Copyright (c) 1993 Argonaut Software Ltd. All rights reserved.
#
# $Id: makedefs.wtc 1.9 1995/06/30 16:09:34 sam Exp $
# $Locker: sam $
#
# General defines, rules and macros for BRender built with watcom C32 9.5
#
# Pick up configuration from environment, if not defined, pick defaults
#
# Watcom build uses LIB_SUFFIX as the compiler model, R or S
#
.IMPORT .IGNORE: SERIAL LONG_ARGS LIB_SUFFIX
# Type of executable to produce - debug, profile, or release
#
.IF $(BUILD) ==
.IMPORT .IGNORE: BUILD
.ENDIF
BUILD*:=RELEASE
# Target type
#
.IF $(TARGET_TYPE) ==
.IMPORT .IGNORE: TARGET_TYPE
.END
TARGET_TYPE*:=LIB
# Extender
#
.IF $(EXTENDER) ==
.IMPORT .IGNORE: EXTENDER
.END
EXTENDER*:=DOS4GW
# Library base type
#
.IF $(BASE_TYPE) ==
.IMPORT .IGNORE: BASE_TYPE
.ENDIF
BASE_TYPE*:=FIXED
# Compiler part of library name - Watcom
#
LIB_SUFFIX_C=w
# Pick a library suffix based on library type
#
.IF $(BASE_TYPE) == FLOAT
LIB_SUFFIX_T=f
.ELIF $(BASE_TYPE) == FIXED
LIB_SUFFIX_T=x
.ELIF $(BASE_TYPE) == NONE
LIB_SUFFIX_T=
.ELSE
Unknown_BASE_TYPE:
.ENDIF
# Default to register calling
#
LIB_SUFFIX*:=r
## Build flags
##
OBJ_EXT:=.obj
LIB_EXT:=.lib
AS:=ml
CC:=wcc386
H2I:=h2inc
MKDEPFLAGS= -s -t -I$(BLD_DIR) $(INCLUDES)
4DOS=+c:\4dos\4dos.com /e:3048 /c
PERL=perl
# Flags for each process are constructed from
# a common prt, a per build part, and a per app. part
#
ASFLAGS=$(BASE_ASFLAGS) $(BUILD_ASFLAGS) $(EXTRA_ASFLAGS)
CFLAGS=$(BASE_CFLAGS) $(BUILD_CFLAGS) $(EXTRA_CFLAGS)
H2IFLAGS=$(BASE_H2IFLAGS) $(BUILD_H2IFLAGS) $(EXTRA_H2IFLAGS)
# Base flags
#
BASE_CFLAGS =-wx -we -zp4 -5$(LIB_SUFFIX) -DBASED_$(BASE_TYPE)=1 $(INCLUDES)
BASE_ASFLAGS =-nologo -Cp -D__WATCOMC__=1\
-DBASED_$(BASE_TYPE)=1 -I$(BLD_DIR) $(INCLUDES)
BASE_H2IFLAGS=/nologo /G3 /Zp4 /C /D__WATCOMC__ /D__H2INC__\
/D_NO_PROTOTYPES -DBASED_$(BASE_TYPE)=1 $(INCLUDES)
.IF $(BUILD) == RELEASE
# Release Flags
#
BUILD_CFLAGS =-omaxnet -fp3 -DDEBUG=0 -DPARANOID=0 -DSTATIC=static
BUILD_LDFLAGS =$(RELEASE_LDFLAGS)
BUILD_ASFLAGS =
BUILD_H2IFLAGS=
LIB_SUFFIX_B:=r
.ELIF $(BUILD) == TEST
# Check Flags (Release library with validation checks for debugging user code)
#
BUILD_CFLAGS =-omaxnet -fp3 -DDEBUG=0 -DPARANOID=1 -DSTATIC=static
BUILD_LDFLAGS =$(TEST_LDFLAGS)
BUILD_ASFLAGS =-DDEBUG=0 -DCHECK=1
BUILD_H2IFLAGS=-DDEBUG=0 -DCHECK=1
LIB_SUFFIX_B:=t
.ELIF $(BUILD) == DEBUG
# Debug Flags
#
# -en -ep -ee
#
BUILD_CFLAGS =-s -d2 -DDEBUG=1 -DPARANOID=1 -DSTATIC=
BUILD_LDFLAGS =$(DEBUG_LDFLAGS)
BUILD_ASFLAGS =-Zd
BUILD_H2IFLAGS=
LIB_SUFFIX_B:=d
.ELIF $(BUILD) == PROFILE
# Profile Flags
#
BUILD_CFLAGS =-omaxnet -fp3 -d1 -DDEBUG=0 -DPARANOID=0 -DSTATIC=
BUILD_LDFLAGS =$(PROFILE_LDFLAGS)
BUILD_ASFLAGS =-Zd
BUILD_H2IFLAGS=
LIB_SUFFIX_B:=p
.ELSE
Unknown_BASE_TYPE:
.ENDIF
## The build directory
##
LIB_TYPE:=$(LIB_SUFFIX_C)$(LIB_SUFFIX_T)$(LIB_SUFFIX_B)$(LIB_SUFFIX)
BLD_BASE*:=bld
BLD_DIR:=$(BLD_BASE)_$(LIB_TYPE)
## The library name <part><compiler><type><build><optional>.lib
##
LIB_NAME:=$(BASE_DIR)/lib/$(LIB_PART)$(LIB_TYPE).lib
# Keep proper dependencies (per build type)
#
.KEEP_STATE:=$(BLD_DIR)/state.out
## Generic rule for building objects and ASM header files
##
.IF $(LONG_ARGS)X != X
# Use environment variables to cut down the cmmand line size
#
$(BLD_DIR)/%.obj : %.c
@[
set _ARGS=$(CFLAGS) -fo$(@:s,/,\,) $<
$(CC) @_ARGS
]
# $(CC) @$(mktmp,wcl386.rsp $(CFLAGS:s,\,\\,)) -c -fo$(@:s,/,\,) $<
$(BLD_DIR)/%.obj : %.asm
$(AS) @$(mktmp,wcl386.rsp $(ASFLAGS:s,\,\\,) -c -Fo$(@:s,\,\\,:s,/,\\,)) $<
%.obj : %.c
@[
set _ARGS=$(CFLAGS) -fo$(@:s,/,\,) $<
$(CC) @_ARGS
]
%.pp : %.c
@[
set _ARGS=$(CFLAGS) -fo$(@:s,/,\,) -p $<
$(CC) @_ARGS
]
%.pp : %.h
@[
set _ARGS=$(CFLAGS) -fo$(@:s,/,\,) -p -D_NO_PROTOTYPES $<
$(CC) @_ARGS
]
%.obj : %.asm
$(AS) @$(mktmp $(ASFLAGS) -c -Fo$(@:s,/,\,) $<
$(BLD_DIR)/%.inc : %.h
@[
set H2INC=$(H2IFLAGS) /Fa$@ $<
$(H2I)
]
$(BLD_DIR)\%.inc : %.h
@[
set H2INC=$(H2IFLAGS) /Fa$@ $<
$(H2I)
]
.ELSE
# Pass argumants normally
#
$(BLD_DIR)/%.obj : %.c
$(CC) $(CFLAGS) -fo$(@:s,/,\,) $<
$(BLD_DIR)/%.obj : %.asm
$(AS) $(ASFLAGS) -c -Fo$(@:s,/,\,) $<
%.obj : %.c
$(CC) $(CFLAGS) -fo$(@:s,/,\,) $<
%.pp : %.c
$(CC) $(CFLAGS) -fo$(@:s,/,\,) -p $<
%.pp : %.h
$(CC) $(CFLAGS) -fo$(@:s,/,\,) -p $<
%.obj : %.asm
$(AS) $(ASFLAGS) -c -Fo$(@:s,/,\,) $<
$(BLD_DIR)/%.inc : %.h
cp $(mktmp set H2INC=$(H2IFLAGS:s,\,\\,) /Fa$(@:s,\,\\,) $<\n\
$(H2I)) _h2inc.bat
$(4DOS) _h2inc.bat
$(BLD_DIR)\%.inc : %.h
cp $(mktmp set H2INC=$(H2IFLAGS:s,\,\\,) /Fa$(@:s,\,\\,) $<\n\
$(H2I)) _h2inc.bat
$(4DOS) _h2inc.bat
.ENDIF
## Build ASM function prototype files
##
%.h .NOSTATE: %.fns
$(PERL) $(BASE_DIR)\bin\genasmpr.pl $< >$@
## The final target
##
OBJS := $(OBJS_C) $(OBJS_ASM) $(OBJS_EXTRA)
LDLIBS=$(BASE_LDLIBS) $(EXTRA_LDLIBS)
.IF $(TARGET_TYPE) == LIB
# Library
#
"$(LIB_NAME)": $(OBJS)
-rm -f $@
wlib -n -q $(@:s,/,\\) @$(mktmp,lib.rsp +$(<:t" +":s,\,\\,:s,/,\\)\n)
.ELIF $(TARGET_TYPE) == DRIVER
# Driver - Build a Win32 DLL
#
BASE_LDFLAGS:=option quiet,objalign=4k,stub=brdstub.exe
DEBUG_LDFLAGS:=debug all
PROFILE_LDFLAGS:=debug all
RELEASE_LDFLAGS:=
TEST_LDFLAGS:=
BASE_LDLIBS=clib3$(LIB_SUFFIX)
$(TARGET): $(EXTRA_LDLIBS)
$(TARGET): $(OBJS)
wlink @$(mktmp,link.rsp name $@\n\
system nt_dll\n\
$(BASE_LDFLAGS)\n\
$(BUILD_LDFLAGS)\n\
$(EXTRA_LDFLAGS)\n\
file $(<:t"\nfile ":s,\,/,)\n\
library $(LDLIBS:t"\nlibrary ":s,\,/,)\n\
)
.ELSE
.IF $(EXTENDER) == DOS4GW
# Executable - DOS4GW
#
BASE_LDFLAGS:=option dosseg,caseexact,quiet,stack=128k
DEBUG_LDFLAGS:=debug all
PROFILE_LDFLAGS:=debug all
RELEASE_LDFLAGS:=
TEST_LDFLAGS:=
BASE_LDLIBS=
LIB_SUFFIX_EXTENDER:=4g
$(TARGET): $(EXTRA_LDLIBS)
$(TARGET): $(OBJS)
wlink @$(mktmp,link.rsp name $@\n\
system dos4g\n\
$(BASE_LDFLAGS)\n\
$(BUILD_LDFLAGS)\n\
$(EXTRA_LDFLAGS)\n\
file $(<:t"\nfile ":s,\,/,)\n\
library $(LDLIBS:t"\nlibrary ":s,\,/,)\n\
)
.ELIF $(EXTENDER) == DOS4GWPRO
# Executable - DOS4GW Professional
#
BASE_LDFLAGS:=option dosseg,caseexact,quiet,stack=128k
DEBUG_LDFLAGS:=debug all
PROFILE_LDFLAGS:=debug all
RELEASE_LDFLAGS:=
TEST_LDFLAGS:=
BASE_LDLIBS=
LIB_SUFFIX_EXTENDER:=4g
$(TARGET): $(EXTRA_LDLIBS)
$(TARGET): $(OBJS)
wlink @$(mktmp,link.rsp name _tmp.exe\n\
system dos4g\n\
$(BASE_LDFLAGS)\n\
$(BUILD_LDFLAGS)\n\
$(EXTRA_LDFLAGS)\n\
file $(<:t"\nfile ":s,\,/,)\n\
library $(LDLIBS:t"\nlibrary ":s,\,/,)\n\
)
4gwbind 4gwpro.exe _tmp.exe $(TARGET) -Q
rm _tmp.exe
.ELIF $(EXTENDER) == X32
# Executable - Flashtek X-32
#
BASE_LDFLAGS:=option dosseg,caseexact,quiet
DEBUG_LDFLAGS:=debug all
PROFILE_LDFLAGS:=debug all
RELEASE_LDFLAGS:=
TEST_LDFLAGS:=
BASE_LDLIBS=
LIB_SUFFIX_EXTENDER:=x3
$(TARGET): $(EXTRA_LDLIBS)
$(TARGET): $(OBJS)
wlink @$(mktmp,link.rsp name $@\n\
$(BASE_LDFLAGS)\n\
$(BUILD_LDFLAGS)\n\
$(EXTRA_LDFLAGS)\n\
system x32$(LIB_SUFFIX)\n\
file $(<:t"\nfile ":s,\,/,)\n\
library $(LDLIBS:t"\nlibrary ":s,\,/,)\n\
)
x32fix $(TARGET)
.ELIF $(EXTENDER) == X32VM
# Executable - Flashtek X-32 with virtual memory
#
BASE_LDFLAGS:=option dosseg,caseexact,quiet
DEBUG_LDFLAGS:=debug all
PROFILE_LDFLAGS:=debug all
RELEASE_LDFLAGS:=
TEST_LDFLAGS:=
BASE_LDLIBS=
LIB_SUFFIX_EXTENDER:=x3
$(TARGET): $(EXTRA_LDLIBS)
$(TARGET): $(OBJS)
wlink @$(mktmp,link.rsp name $@\n\
$(BASE_LDFLAGS)\n\
$(BUILD_LDFLAGS)\n\
$(EXTRA_LDFLAGS)\n\
system x32$(LIB_SUFFIX)v\n\
file $(<:t"\nfile ":s,\,/,)\n\
library $(LDLIBS:t"\nlibrary ":s,\,/,)\n\
)
x32fix $(TARGET)
.ELIF $(EXTENDER) == PHARLAPz
# Executable - Pharlap TNT using 386link
#
BASE_LDFLAGS =-stack 65536 -offset 16384 -libpath t:\watcom10\lib386,t:\watcom10\lib386\dos
DEBUG_LDFLAGS:=-fullsym
PROFILE_LDFLAGS:=-fullsym
RELEASE_LDFLAGS:=
TEST_LDFLAGS:=
BASE_LDLIBS=
LIB_SUFFIX_EXTENDER:=pl
$(TARGET): $(EXTRA_LDLIBS)
$(TARGET): $(OBJS)
386link @wc386.dos -exe $(@:s,/,\,) @$(mktmp,386link.rsp $(<:t"\n":s,\,\\,)\n\
$(BASE_LDFLAGS)\n\
$(BUILD_LDFLAGS)\n\
$(EXTRA_LDFLAGS)\n\
-lib $(LDLIBS:s,\,\\,:s,/,\\,)\n\
)
# rebind $(TARGET)
.ELIF $(EXTENDER) == PHARLAP
# Executable - Pharlap TNT using wlink
#
BASE_LDFLAGS:=option dosseg,caseexact,quiet
DEBUG_LDFLAGS:=debug all
PROFILE_LDFLAGS:=debug all
RELEASE_LDFLAGS:=
TEST_LDFLAGS:=
BASE_LDLIBS=
LIB_SUFFIX_EXTENDER:=pl
$(TARGET): $(EXTRA_LDLIBS)
$(TARGET): $(OBJS)
wlink @$(mktmp,link.rsp name $@\n\
$(BASE_LDFLAGS)\n\
$(BUILD_LDFLAGS)\n\
$(EXTRA_LDFLAGS)\n\
system tnt\n\
file $(<:t"\nfile ":s,\,/,)\n\
library $(LDLIBS:t"\nlibrary ":s,\,/,)\n\
)
rebind $(TARGET)
.ELIF $(EXTENDER) == PHARLAP3
# Executable - Pharlap v3
#
BASE_LDFLAGS:=-stack 65536 -nobanner -twocase -pack -callbufs 16 -nomap \
-backcompat -libpath t:\watcom10\lib386,t:\watcom10\lib386\dos -lib clib3s,math387s,emu387
DEBUG_LDFLAGS:=-fullsym
PROFILE_LDFLAGS:=-fullsym
RELEASE_LDFLAGS:=
TEST_LDFLAGS:=
BASE_LDLIBS=
LIB_SUFFIX_EXTENDER:=p3
$(TARGET): $(EXTRA_LDLIBS)
$(TARGET): $(OBJS)
386link -exe $*.exp @$(mktmp,386link.rsp $(<:t"\n":s,\,\\,)\n\
$(BASE_LDFLAGS)\n\
$(BUILD_LDFLAGS)\n\
$(EXTRA_LDFLAGS)\n\
-lib $(LDLIBS:s,\,\\,:s,/,\\,)\n\
)
.ELIF $(EXTENDER) == OS2
# Executable - OS/2 VIO
#
BASE_LDFLAGS:=option dosseg,caseexact,quiet,stack=128k
DEBUG_LDFLAGS:=debug all
PROFILE_LDFLAGS:=debug all
RELEASE_LDFLAGS:=
TEST_LDFLAGS:=
BASE_LDLIBS=
#LIB_SUFFIX_EXTENDER:=4g
$(TARGET): $(EXTRA_LDLIBS)
$(TARGET): $(OBJS)
wlink @$(mktmp,link.rsp name $@\n\
system os2v2\n\
$(BASE_LDFLAGS)\n\
$(BUILD_LDFLAGS)\n\
$(EXTRA_LDFLAGS)\n\
file $(<:t"\nfile ":s,\,/,)\n\
library $(LDLIBS:t"\nlibrary ":s,\,/,)\n\
)
.ELIF $(EXTENDER) == NT
# Executable - NT Console App.
#
BASE_LDFLAGS:=option dosseg,caseexact,quiet,stack=128k
DEBUG_LDFLAGS:=debug all
PROFILE_LDFLAGS:=debug all
RELEASE_LDFLAGS:=
TEST_LDFLAGS:=
BASE_LDLIBS=
#LIB_SUFFIX_EXTENDER:=4g
$(TARGET): $(EXTRA_LDLIBS)
$(TARGET): $(OBJS)
wlink @$(mktmp,link.rsp name $@\n\
system nt\n\
$(BASE_LDFLAGS)\n\
$(BUILD_LDFLAGS)\n\
$(EXTRA_LDFLAGS)\n\
file $(<:t"\nfile ":s,\,/,)\n\
library $(LDLIBS:t"\nlibrary ":s,\,/,)\n\
)
.ELSE
Unknown_EXTENDER:
.ENDIF
.ENDIF
## Object directory
##
$(BLD_DIR)/exists:
-mkdir $(BLD_DIR)
echo $(BLD_DIR) >$(BLD_DIR)\exists
.IF $(LIB_INC)
%$(MAKE) $(MAKEFILE) $(BLD_DIR)/$(LIB_INC).inc
.ENDIF
# Dependencies
#
SRCS:=$(OBJS_C:s/.obj/.c/) $(OBJS_ASM:s/.obj/.asm/)
depend: $(BLD_DIR)/exists
depend:
sed "s/^$(BLD_DIR)\///" <$(mktmp,_mkdep.tmp $(SRCS:t"\n":s,\,/,)\n) >_mkdep.rsp
$(MKDEP) $(MKDEPFLAGS) @_mkdep.rsp -o_depend.tmp
sed "s/^/$(BLD_DIR)\//" <_depend.tmp >$(BLD_DIR)\\depend.out
$(RM) _mkdep.rsp
$(RM) _depend.tmp
.INCLUDE .IGNORE: $(BLD_DIR)/depend.out