aboutsummaryrefslogtreecommitdiff
path: root/makefile
blob: 2f4d78a2aa6ab882ee1f28ad40c72dac4d3549ec (plain)
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
# This is an Open Watcom wmake makefile, not GNU make.
# Assuming you have sourced `owsetenv` beforehand.
# 
dosobjs = dostsr.obj dosmain.obj vbox.obj
doscflags = -bt=dos -ms -6 -os -w3
# -ms to use small memory model (though sometimes ss != ds...)
# -os to optimize for size
dostsrcflags = -zu -s -g=RES_GROUP -nd=RES -nt=RES_TEXT -nc=RES_CODE
# -s to disable stack checks, since it inserts calls to the runtime from the TSR part
# -zu since ss != ds on the TSR

w16objs = w16mouse.obj
w16cflags = -bt=windows -bd -mc -zu -s -6 -w3
# -bd to build DLL
# -mc to use compact memory model (far data pointers, ss != ds always)
# -zu for DLL calling convention (ss != ds)
# -s to disable stack checks, since the runtime uses MessageBox() to abort (which we can't call from mouse.drv)

.BEFORE:
	# We need DOS and Windows headers, not host platform's
	set include=$(%watcom)/h/win;$(%watcom)/h

# Main DOS driver file
vbmouse.exe: dosmouse.lnk $(dosobjs) 
	wlink @$[@ name $@ file { $(dosobjs) } 

dostsr.obj: dostsr.c .AUTODEPEND
	wcc -fo=$^@ $(doscflags) $(dostsrcflags) $[@

dosmain.obj: dosmain.c .AUTODEPEND
	wcc -fo=$^@ $(doscflags) $[@

vbox.obj: vbox.c .AUTODEPEND
	wcc -fo=$^@ $(doscflags) $[@

vbmouse.drv: w16mouse.lnk $(w16objs)
	wlink @$[@ name $@ file { $(w16objs) }

w16mouse.obj: w16mouse.c .AUTODEPEND
	wcc -fo=$^@ $(w16cflags) $[@

clean: .SYMBOLIC
	rm -f vbmouse.exe vbmouse.drv vbmouse.flp *.obj *.map

vbmouse.flp:
	mformat -C -f 1440 -v VBMOUSE -i $^@ ::

# Build a floppy image containing the driver
flp: vbmouse.flp vbmouse.exe vbmouse.drv .SYMBOLIC
	mcopy -i vbmouse.flp -o vbmouse.exe vbmouse.drv ::