#
#  Makefile for Mixed Language Programs
#

#which memory model and processor to use by default
PROCESSOR = 386 # for the 32-bit compilers

# name the compiler
CC = wcc$(PROCESSOR)
FC = wfc$(PROCESSOR)
ASM = masm

!ifeq PROCESSOR 386
MODEL = f	# flat
!else
MODEL = l	# large
!endif

# options to use
CFLAGS = -m$(MODEL) -zq
FFLAGS = -m$(MODEL) -noterm
AFLAGS =

.EXTENSIONS:
.EXTENSIONS: .exe .rex .lib .obj .wbj .asm .c .for

.BEFORE
	@set INCLUDE=.;$(%watcom)\h
	@set DOS4G=QUIET

# explicit rules


all :	mix1.exe mix2.exe mix3.exe mix4.exe mix5.exe mix6.exe .symbolic
	@%null

bimodal.exe : bimodal.obj bimo.obj .PRECIOUS
	wlink opt quiet system dos4g name bimodal file bimodal,bimo

keystat.exe : keystat.obj .PRECIOUS
	wlink opt quiet system dos4g file keystat name keystat

keystapl.exp : keystapl.obj .PRECIOUS
	wlink opt quiet system pharlap file keystapl name keystapl

memory.exe : memory.obj .PRECIOUS
	wlink opt quiet system dos4g file memory name memory

mempls40.exp : mempls40.obj .PRECIOUS
	wlink opt quiet system pharlap file mempls40 name mempls40

memwin.exe : memwin.rex .PRECIOUS
	wbind -n memwin

memwin.rex : memwin.wbj .PRECIOUS
	wlink opt quiet system win386 file memwin.wbj name memwin

mouse.exe : mouse.obj .PRECIOUS
	wlink opt quiet system dos4g file mouse name mouse

screen.exe : screen.obj .PRECIOUS
	wlink opt quiet system dos4g file screen name screen

screenpl.exp : screenpl.obj .PRECIOUS
	wlink opt quiet system pharlap file screenpl name screenpl

simulate.exe : simulate.obj .PRECIOUS
	wlink opt quiet system dos4g file simulate name simulate

spwnrd4g.exe : spwndd4g.exe spwnrd4g.obj .PRECIOUS
	wlink opt quiet system dos4g file spwnrd4g name spwnrd4g

spwndd4g.exe : spwndd4g.obj .PRECIOUS
	wlink opt quiet system dos4g file spwndd4g name spwndd4g

spwnrpls.exe : spwndpls.exe spwnrpls.obj .PRECIOUS
	wlink opt quiet system pharlap runt minr=300K,maxr=400K file spwnrpls name spwnrpls

spwndpls.exe : spwndpls.obj .PRECIOUS
	wlink opt quiet system pharlap file spwndpls name spwndpls

spwnrecs.exe : spwndecs.exe spwnrecs.obj .PRECIOUS
	wlink opt quiet system ergo file spwnrecs name spwnrecs

spwndecs.exe : spwndecs.obj .PRECIOUS
	wlink opt quiet system ergo file spwndecs name spwndecs

winhandl.exe : winhandl.rex .PRECIOUS
	    wbind -n winhandl

winhandl.rex : winhandl.wbj iob.obj nfiles.obj .PRECIOUS
	wlink opt quiet system win386 file winhandl.wbj,iob.obj,nfiles.obj name winhandl

mix1.exe : mix1c.obj mix1f.obj .PRECIOUS
	wlink opt quiet file mix1c,mix1f name mix1

mix2.exe : mix2c.obj mix2f.obj .PRECIOUS
	wlink opt quiet file mix2c,mix2f name mix2

mix3.exe : mix3c.obj mix3f.obj .PRECIOUS
	wlink opt quiet file mix3c,mix3f name mix3

mix4.exe : mix4c.obj mix4f.obj .PRECIOUS
	wlink opt quiet file mix4c,mix4f name mix4

mix5.exe : mix5c.obj mix5f.obj .PRECIOUS
	wlink opt quiet file mix5c,mix5f name mix5

mix6.exe : mix6.obj .PRECIOUS
	wlink opt quiet file mix6 name mix6


run :	.SYMBOLIC
	-mix1.exe
	-mix2.exe
	-mix3.exe
	-mix4.exe
	-mix5.exe
	-mix6.exe

clean : .SYMBOLIC
	del mix*.obj
	del mix*.exe

# implicit rules

.c.obj :
	$(CC) $^& $(CFLAGS)

.c.wbj :
	$(CC) $^& $(CFLAGS) -zw -fo=$^&.wbj

.for.obj :
	$(FC) $^& $(FFLAGS)

.asm.obj :
	$(ASM) $(AFLAGS) $^&;
