Debian Codegraph @

terps/tads/tads2/msdos/makefile.bc

raw
1 # $Header: d:/cvsroot/tads/TADS2/msdos/makefile.bc,v 1.3 1999/07/11 00:46:38 MJRoberts Exp $
2 #
3 # makefile for building TADS with Borland C++ v4.
4 #
5 # make - to build real-mode and protected-mode executables
6 # make prot16=1 - to build protected-mode executables (tcx.exe, trx.exe, etc)
7 # make WINDOWS=1 - to build Windows run-time (trwin.exe)
8 #
9 #
10 # Note that when neither prot16 nor WINDOWS is defined, the makefile will
11 # build BOTH the real- and protected-mode executables; it does this by
12 # spawning a sub-make with prot16 defined.
13 #
14 # Run this makefile from the TADS root directory:
15 #
16 # make -f msdos\makefile.bc
17
18
19 # borland C compiler root directory
20 BCDIR=c:\progra~1\bc45
21
22 # executables, library, and MSDOS-specific source file directories
23 EXEDIR = exe
24 LIBDIR = lib
25 MSDOSDIR = msdos
26
27 .path.exe = $(EXEDIR)
28 .path.lib = $(LIBDIR)
29 .path.def = $(MSDOSDIR)
30
31
32 #----------------------------------------------------------------------------
33 !if $d(WINDOWS)
34 #
35 # Build for Windows
36 #
37
38 CONFIG_FILE = msdos\bccwin.cfg
39 XCFLAGS = -v -I$(BCDIR)\include -I. -Imsdos -D_M_IX86 \
40 -DMSDOS -c -ml -DTURBO $(DBGFLG) -W -D_Windows
41 LDFLAGS= /v /Tw /n /c
42 LIBOBJS= ler.obj ltkwin.obj
43 OVLFLG=
44
45 # windows library directory
46 TADSWIN= ..\win
47
48 CRT0= $(CLIB)\c0wl
49 CLIBS= $(CLIB)\cwinl $(CLIB)\cl $(CLIB)\import
50
51 .path.obj = winobjs
52
53 all: trwin.exe
54
55 #----------------------------------------------------------------------------
56 !elif $d(prot16)
57 #
58 # Build DOS 16-bit DPMI protected-mode executables
59 #
60
61 CONFIG_FILE = msdos\bccdosx.cfg
62 XCFLAGS = -v -I$(BCDIR)\include -I. -Imsdos -D_M_IX86 \
63 -DMSDOS -c -ml -DTURBO $(DBGFLG) -WX -RT-
64 LDFLAGS= /v /Txe /P /s
65 LIBOBJS= ler.obj ltkwin.obj
66 OVLFLG=
67
68 CRT0= $(CLIB)\c0x
69 CLIBS= $(CLIB)\dpmi16 $(CLIB)\cwl
70
71 TC_PROG = tcx
72 TR_PROG = trx
73 TR_OEM_OBJ = oem_trx.obj
74 TDB_PROG = tdbx
75
76 TC_DEF_FILE = msdos\tc_dpmi.def
77 TR_DEF_FILE = msdos\tr_dpmi.def
78 TDB_DEF_FILE = msdos\tdb_dpmi.def
79
80 .path.obj = xobjs
81
82 all: tcx trx tdbx
83
84 tcx: $(CONFIG_FILE) tcx.exe
85 trx: $(CONFIG_FILE) trx.exe
86 tdbx: $(CONFIG_FILE) tdbx.exe
87
88 clean:
89 del $(EXEDIR)\*.exe
90 del xobjs\*.obj
91
92 #----------------------------------------------------------------------------
93 !else
94 #
95 # Build DOS real-mode executables. Optionally spawn a sub-make to build
96 # protected-mode executables as well.
97 #
98
99 CONFIG_FILE = msdos\bccdos.cfg
100 LDFLAGS= /v
101 LIBOBJS= ler.obj
102 XCFLAGS = -2- -v -I$(BCDIR)\include -I. -Imsdos -D_M_IX86 \
103 -DMSDOS -c -ml -DTURBO $(DBGFLG) -RT-
104 #OVLFLG= -Yo
105 OVLFLG=
106
107 CRT0= $(CLIB)\c0l
108 CLIBS= $(CLIB)\cl
109
110 TC_PROG = tc
111 TR_PROG = tr
112 TR_OEM_OBJ = oem_tr.obj
113 TDB_PROG = tdb
114
115 TC_DEF_FILE =
116 TR_DEF_FILE =
117 TDB_DEF_FILE =
118
119 .path.obj = objs
120
121 #
122 # Default target: build everything, including real-mode and protected-mode
123 # executables, as well as any other derived files included in a release.
124 #
125 #all: tc tr tdb tadsrsc.exe tge.exe tgi.exe tadsux.obj
126 all: real_all prot16_all adv_new.t
127
128 # all real-mode targets
129 real_all: tc tr tdb tadsrsc.exe maketrx.exe trcolor.exe tadsux.obj mkchrtab.exe
130
131 # all protected-mode targets - spawn a sub-make to build these targets
132 prot16_all:
133 make -f$(MAKEFILE) prot16=1
134
135 # targets for the standard executables
136 tc: $(CONFIG_FILE) tc.exe tadserr.msg
137 tr: $(CONFIG_FILE) tr.exe tadserr.msg
138 tdb: $(CONFIG_FILE) tdb.exe tadserr.msg
139
140
141 #
142 # If the makefile is run without "prot16" defined, but a protected-mode
143 # target is requested, automatically spawn a sub-make to build the
144 # requested target.
145 #
146
147 trx:
148 make -f$(MAKEFILE) prot16=1 trx
149 tcx:
150 make -f$(MAKEFILE) prot16=1 tcx
151 tdbx:
152 make -f$(MAKEFILE) prot16=1 tdbx
153
154 clean:
155 del $(EXEDIR)\*.exe
156 del objs\*.obj
157 del xobjs\*.obj
158
159 !endif
160 #----------------------------------------------------------------------------
161
162 #
163 # use an external configuration file to prevent command line arguments
164 # from growing too large
165 #
166
167 MAKEFILE = msdos\makefile.bc
168 CFLAGS= +$(CONFIG_FILE)
169
170 $(CONFIG_FILE) : $(MAKEFILE)
171 echo >$(CONFIG_FILE) $(XCFLAGS)
172
173 # CLIB= c:\bc4\lib
174 CLIB= $(BCDIR)\lib
175 CC= bcc
176 ASM= $(BCDIR)\tasm\tasm
177 LD= tlink
178 LINTFLAGS= -Ic: -I. -Imsdos -D_M_IX86 \
179 -DMSDOS -c -ml -DTURBO -w-pia -wnod
180 AFLAGS=
181 SOUNDINC= \sb\msc\include
182 SOUNDLIB= \sb\msc\lib\embed\sbcl
183
184
185 # objects in common to all executables
186 COMMONOBJS= $(LIBOBJS) mcm.obj mcs.obj mch.obj obj.obj cmd.obj \
187 errmsg.obj fioxor.obj os0.obj argize.obj \
188 oserr.obj cmap.obj osifc.obj
189
190 # common objects for all executables incorporating a run-time
191 CMNRUNOBJS= $(COMMONOBJS) \
192 dat.obj lst.obj out.obj voc.obj bif.obj \
193 output.obj suprun.obj regex.obj
194
195 # objects for the run-time system
196 RUNOBJS= $(CMNRUNOBJS) \
197 vocab.obj execmd.obj runstat.obj ply.obj trd.obj \
198 linfdum.obj fio.obj askf_os.obj \
199 osdosstk.obj getstr.obj qas.obj dbgtr.obj run_nd.obj
200
201 # extra objects for character-mode run-time
202 CHAROBJS= \
203 osr.obj osdosnui.obj osgenr.obj osnoui.obj ossdos.obj os0tr.obj \
204 bifgdum.obj osdosex.obj osrestad.obj indlg_tx.obj osscolor.obj
205
206 # extra objects for windows run-time
207 WINOBJS= \
208 $(TADSWIN)\oswin.obj bifgdum.obj
209
210 # extra objects for BBS DOOR run-time
211 DOOROBJS= \
212 osdosdor.obj os0trdor.obj osgendor.obj bifgdum.obj ossdoor.obj
213
214 # objects for compiler (includes run-time system)
215 COMPOBJS= $(CMNRUNOBJS) \
216 linf.obj prs.obj emt.obj sup.obj fiowrt.obj tok.obj \
217 tcd.obj os0tc.obj fio.obj objcomp.obj prscomp.obj \
218 osdosstk.obj getstr.obj osdos.obj osdosnui.obj \
219 osgen.obj tokth.obj dbg.obj \
220 voccomp.obj bifgdum.obj osnoui.obj osdosex.obj run_nd.obj \
221 askf_tx.obj indlg_tx.obj
222
223 TCOBJS= $(COMPOBJS) tcgdum.obj osrestad.obj
224
225 # objects for debugger
226 DBGOBJS= $(CMNRUNOBJS) \
227 vocab.obj execmd.obj runstat.obj ply.obj fio.obj sup.obj \
228 linf.obj prs.obj emt.obj tok.obj tdd.obj os0td.obj dbgu.obj \
229 dbg.obj dbgrun.obj osdbg.obj objcomp.obj tokth.obj voccomp.obj \
230 osdosstk.obj getstr.obj osr.obj osdosnui.obj osgenr.obj ossdos.obj \
231 qas.obj bifgdum.obj osnoui.obj osdosex.obj run_d.obj osrestad.obj \
232 askf_os.obj indlg_tx.obj osscolor.obj
233
234 # tads/pro object files
235 TPOBJS= $(CMNRUNOBJS) \
236 linf.obj linm.obj prs.obj emt.obj sup.obj tok.obj fio.obj \
237 objcomp.obj osdosstk.obj getstr.obj osdos.obj osdosnui.obj \
238 osgen.obj tokth.obj \
239 dbg.obj voccomp.obj bifgdum.obj qas.obj tpd.obj vocab.obj \
240 execmd.obj dbgrun.obj runstat.obj ply.obj ced.obj prscomp.obj \
241 osnoui.obj osdosex.obj run_d.obj
242
243 # TADS/G compiler objects
244 TCGOBJS= $(COMPOBJS) tcg.obj
245
246 # objects for tads/graphic picture editor
247 TGEOBJS= \
248 $(LIBOBJS) tge.obj osdosg.obj osgeng.obj ossdosg.obj osspcx.obj \
249 osspcx2.obj
250
251 # objects for tads/graphic icon editor
252 TGIOBJS= \
253 $(LIBOBJS) tgi.obj osdosg.obj osgeng.obj ossdosg.obj osspcx.obj
254
255 # objects for picture format converter
256 CONV16OBJS= \
257 $(LIBOBJS) conv16.obj osspcx.obj osspcx2.obj ossdosg.obj osdosg.obj \
258 osgeng.obj
259
260 # files to lint
261 LINTFILES= mcm.lnt mcs.lnt mch.lnt obj.lnt dat.lnt lst.lnt linf.lnt \
262 tok.lnt prs.lnt emt.lnt err.lnt run.lnt out.lnt voc.lnt bif.lnt \
263 vocab.lnt execmd.lnt sup.lnt dbg.lnt fio.lnt tcd.lnt os0tc.lnt \
264 cmd.lnt os0tr.lnt ply.lnt runstat.lnt output.lnt errmsg.lnt \
265 fiowrt.lnt tokth.lnt linfdum.lnt tdd.lnt os0td.lnt dbgu.lnt \
266 fioxor.lnt dbgrun.lnt osdbg.lnt os0.lnt oserr.lnt
267
268 lint: $(LINTFILES)
269
270 #
271 # The primary executables
272 #
273
274 # the TADS compiler
275 $(TC_PROG).exe: $(TCOBJS)
276 $(LD) $(LDFLAGS) @&&!
277 $(CRT0) $**
278 $*
279 $(TC_PROG).map/m
280 $(CLIBS)
281 $(TC_DEF_FILE)
282 !
283
284 # the TADS runtime system
285 tr: tr.exe tadserr.msg
286
287 $(TR_PROG).exe: $(RUNOBJS) $(CHAROBJS) $(TR_OEM_OBJ)
288 $(LD) $(LDFLAGS) @&&!
289 $(CRT0) $**
290 $*
291 $(TR_PROG).map/m
292 $(CLIBS)
293 $(TR_DEF_FILE)
294 !
295
296
297 # the TADS debugger
298 tdb: tdb.exe tadserr.msg
299
300 $(TDB_PROG).exe: $(DBGOBJS) $(TR_OEM_OBJ)
301 $(LD) $(LDFLAGS) @&&!
302 $(CRT0) $**
303 $*
304 tdb
305 $(CLIBS)
306 $(TDB_DEF_FILE)
307 !
308
309 # error message file
310 tadserr.msg: tadserr.exe
311 $(EXEDIR)\tadserr
312
313 tadserr.obj: errmsg.c $(CONFIG_FILE)
314 $(CC) $(CFLAGS) -DERR_LINK_MESSAGES=1 -DERR_BUILD_FILE -o$@ errmsg.c
315
316 tadserr.exe: tadserr.obj osterm.obj
317 $(LD) $(LDFLAGS) @&&!
318 $(CRT0) $**
319 $*
320 nul
321 $(CLIBS)
322 !
323
324 # executable game builder
325 maketrx: maketrx.exe
326 maketrx.exe: dosmktrx.obj
327 $(LD) $(LDFLAGS) $(CRT0) $**,$@,nul,$(CLIBS)
328
329 # character map generator
330 mkchrtab: mkchrtab.exe
331 mkchrtab.exe: mkchrtab.obj osterm.obj
332 $(LD) $(LDFLAGS) $(CRT0) $**,$@,nul,$(CLIBS)
333
334 # build the TADS resource manager
335 tadsrsc: tadsrsc.exe
336 tadsrsc.exe: tadsrsc.obj osnoui.obj osdosnui.obj osterm.obj
337 $(LD) $(LDFLAGS) @&&!
338 $(CRT0) $**
339 $*
340 nul
341 $(CLIBS)
342 !
343
344 # runtime color-setting tool
345 trcolor: trcolor.exe
346 trcolor.exe: trcolor.obj ossdos.obj
347 $(LD) $(LDFLAGS) @&&!
348 $(CRT0) $**
349 $*
350 nul
351 $(CLIBS)
352 !
353
354
355 #
356 # ordinary object file associations
357 #
358 mcm.obj: mcm.c
359 mcs.obj: mcs.c
360 obj.obj: obj.c
361 objcomp.obj: objcomp.c
362 dat.obj: dat.c
363 lst.obj: lst.c
364 linf.obj: linf.c
365 mch.obj: mch.c
366 tok.obj: tok.c
367 tokth.obj: tokth.c
368 prs.obj: prs.c
369 prscomp.obj: prscomp.c
370 emt.obj: emt.c
371 out.obj: out.c
372 voc.obj: voc.c
373 bif.obj: bif.c
374 execmd.obj: execmd.c
375 sup.obj: sup.c
376 dbg.obj: dbg.c
377 tcd.obj: tcd.c
378 os0tc.obj: msdos\os0tc.c
379 cmd.obj: cmd.c
380 os0tr.obj: msdos\os0tr.c
381 os0trxb.obj: msdos\os0trxb.c
382 ply.obj: ply.c
383 runstat.obj: runstat.c
384 output.obj: output.c
385 errmsg.obj: errmsg.c
386 fiowrt.obj: fiowrt.c
387 linfdum.obj: linfdum.c
388 tdd.obj: tdd.c
389 os0td.obj: msdos\os0td.c
390 dbgu.obj: msdos\dbgu.c
391 fioxor.obj: fioxor.c
392 qas.obj: qas.c
393 getstr.obj: getstr.c
394 dbgrun.obj: dbgrun.c
395 osdbg.obj: msdos\osdbg.c
396 oserr.obj: oserr.c
397 osdos.obj: msdos\osdos.c
398 osdosnui.obj: msdos\osdosnui.c
399 osdosex.obj: msdos\osdosex.c
400 osgen.obj: osgen.c
401 osrestad.obj: osrestad.c
402 osnoui.obj: osnoui.c
403 osterm.obj: osterm.c
404 ossdos.obj: msdos\ossdos.asm
405 #ossdosg.obj: ossdosg.asm
406 #osspcx.obj: osspcx.c
407 #osspcx2.obj: osspcx2.c
408 #ossfnt.obj: ossfnt.c
409 #tge.obj: tge.c
410 #tcg.obj: tcg.c
411 #osdosgf.obj: osdosgf.c
412 #ossdoor.obj: ossdoor.asm
413 tcgdum.obj: tcgdum.c
414 bifg.obj: bifg.c
415 tpd.obj: tpd.c
416 linm.obj: linm.c
417 ced.obj: ced.c
418 osdosstk.obj: msdos\osdosstk.c
419 voccomp.obj: voccomp.c
420 bifgdum.obj: bifgdum.c
421 t320.obj: t320.c
422 tadsrsc.obj: tadsrsc.c
423 dosmktrx.obj: msdos\dosmktrx.c
424 mkchrtab.obj: mkchrtab.c
425 tadsux.obj: msdos\tadsux.asm
426 oem_tr.obj: msdos\oem_tr.c
427 oem_trx.obj: msdos\oem_trx.c
428 argize.obj: argize.c
429 osifc.obj: osifc.c
430 askf_tx.obj: askf_tx.c
431 askf_os.obj: askf_os.c
432 indlg_tx.obj: indlg_tx.c
433 indlg_os.obj: indlg_os.c
434
435
436 #
437 # library objects
438 #
439 ltkwin.obj: msdos\ltkwin.c
440 ler.obj: ler.c
441
442
443 #
444 # objects that can be part of an overlay
445 #
446 os0.obj: os0.c $(CONFIG_FILE)
447 $(CC) $(CFLAGS) $(OVLFLG) -o$@ os0.c
448
449 fio.obj: fio.c $(CONFIG_FILE)
450 $(CC) $(CFLAGS) $(OVLFLG) -o$@ fio.c
451
452 suprun.obj: suprun.c $(CONFIG_FILE)
453 $(CC) $(CFLAGS) $(OVLFLG) -o$@ suprun.c
454
455 trd.obj: trd.c $(CONFIG_FILE)
456 $(CC) $(CFLAGS) $(OVLFLG) -o$@ trd.c
457
458 vocab.obj: vocab.c $(CONFIG_FILE)
459 $(CC) $(CFLAGS) $(OVLFLG) -o$@ vocab.c
460
461 #
462 # objects that require special builds
463 #
464 osr.obj: msdos\osdos.c $(CONFIG_FILE)
465 $(CC) $(CFLAGS) -DRUNTIME -o$@ msdos\osdos.c
466
467 osw.obj: msdos\osdos.c $(CONFIG_FILE)
468 $(CC) $(CFLAGS) -DRUNTIME -DWINDOWS -o$@ msdos\osdos.c
469
470 #osdosdor.obj: osdos.c $(CONFIG_FILE)
471 # $(CC) $(CFLAGS) -DUSE_DOOR -o$@ osdos.c
472
473 osgenr.obj: osgen.c $(CONFIG_FILE)
474 $(CC) $(CFLAGS) -DRUNTIME -o$@ osgen.c
475
476 osscolor.obj: msdos\osscolor.c $(CONFIG_FILE)
477 $(CC) $(CFLAGS) -DRUNTIME -o$@ msdos\osscolor.c
478
479 #osgendor.obj: osgen.c $(CONFIG_FILE)
480 # $(CC) $(CFLAGS) -DUSE_DOOR -o$@ osgen.c
481
482 #osgeng.obj: osgen.c $(CONFIG_FILE)
483 # $(CC) $(CFLAGS) -DUSE_GRAPH -DUSE_SOUND -o$@ osgen.c
484
485 runfast.obj: run.c $(CONFIG_FILE)
486 $(CC) $(CFLAGS) -DRUNFAST -DDBG_OFF -o$@ run.c
487
488 biffast.obj: bif.c $(CONFIG_FILE)
489 $(CC) $(CFLAGS) -DRUNFAST -o$@ bif.c
490
491 os0trg.obj: os0tr.obj $(CONFIG_FILE)
492 $(CC) $(OVLFLG) $(CFLAGS) -I$(SOUNDINC) -DUSE_GRAPH -DUSE_SOUND \
493 -o$@ os0tr.c
494
495 osdosg.obj: osdosg.c $(CONFIG_FILE)
496 $(CC) $(CFLAGS) -I$(SOUNDINC) -DRUNTIME -o$@ osdosg.c
497
498 os_sb.obj: os_sb.c $(CONFIG_FILE)
499 $(CC) $(CFLAGS) -I$(SOUNDINC) -DUSE_GRAPH -DUSE_SOUND -o$@ os_sb.c
500
501 #
502 # Main run engine - no debugger (run_nd.obj) and with debugger (run_d.obj).
503 # We could simply always use the with-debugger version, but games will
504 # run slightly faster if we build a separate no-debugger version for
505 # the executables that don't actually make any use of the debugger.
506 #
507 run_nd.obj: run.c $(CONFIG_FILE)
508 $(CC) $(CFLAGS) -DDBG_OFF -o$@ run.c
509
510 run_d.obj: run.c $(CONFIG_FILE)
511 $(CC) $(CFLAGS) -o$@ run.c
512
513
514
515 #
516 # more executables
517 #
518
519 untrx.exe: untrx.c
520 $(CC) -ml -I$(BCDIR)\include -I. -Imsdos -DMSDOS -o$@ untrx.c
521
522 tadsmdoc.exe: tadsmdoc.obj osterm.obj
523 $(LD) $(LDFLAGS) @&&!
524 $(CRT0) $**
525 $*
526 nul
527 $(CLIBS)
528 !
529
530 tadsmdoc.obj: errmsg.c $(CONFIG_FILE)
531 $(CC) $(CFLAGS) -DERR_LINK_MESSAGES=1 -DERR_BUILD_DOC -o$@ errmsg.c
532
533
534 #
535 # process adv.t to produce documentation and release version of adv.t
536 #
537
538 adv_new.t: adv.t procadv.exe
539 $(EXEDIR)\procadv adv.t adv_doc.tex adv_new.t
540
541 procadv.exe: procadv.c
542 $(CC) -ml -L$(BCDIR)\lib -I$(BCDIR)\include -I. -Imsdos -DMSDOS -DTURBO -nexe procadv.c
543
544 # build "spawn" user exit
545 uxsys.bin: uxsys.obj
546 tlink /t tadsux uxsys,uxsys.bin,nul
547
548 uxsys.obj: uxsys.c
549 tcc -mt -DMSDOS=1 -c uxsys.c
550
551 uxsys.gam: uxsys.t uxsys.bin
552 tc uxsys
553 tadsrsc uxsys -+uxsys.bin=spawn
554
555 # build the test user exit
556 testux.bin: testux.obj
557 tlink /t tadsux testux,testux.bin,nul
558
559 testux.obj: testux.c
560 tcc -mt -DMSDOS=1 -c testux.c
561
562 testux.gam: testux.t testux.bin
563 tc testux
564 tadsrsc testux -+testux.bin=myfunc
565
566
567
568 #
569 # windows version of the runtime
570 #
571
572 trwin.exe: $(RUNOBJS) $(WINOBJS)
573 $(LD) $(LDFLAGS) @&&!
574 $(CLIB)\c0wl $**
575 $*
576 trwin/m
577 $(CLIBS)
578 trwin
579 !
580 rc trwin.res
581
582
583 #
584 # TADS/Pro - DOS testing version
585 #
586
587 tpro.exe: $(TPOBJS)
588 $(LD) $(LDFLAGS) @&&!
589 $(CRT0) $**
590 $*
591 nul
592 $(CLIBS)
593 !
594
595
596 #
597 # implicit rules
598 #
599
600 .c.obj:
601 $(CC) $(CFLAGS) -o$@ $<
602
603 .asm.obj:
604 $(ASM) $(AFLAGS) $<,$@
605
606 .c.lnt:
607 $(CC) $(LINTFLAGS) -DLINT=1 -olintdmy.obj $<
608 echo ok >$*.lnt