aboutsummaryrefslogtreecommitdiff
path: root/makefile
diff options
context:
space:
mode:
Diffstat (limited to 'makefile')
-rw-r--r--makefile51
1 files changed, 42 insertions, 9 deletions
diff --git a/makefile b/makefile
index 907a8e5..efa98a3 100644
--- a/makefile
+++ b/makefile
@@ -2,7 +2,7 @@
# Assuming you have sourced `owsetenv` beforehand.
# All binaries to build
-bins = vbmouse.exe vbsf.exe vbmouse.drv
+bins = vbmouse.exe vbsf.exe vbmouse.drv moustest.exe
# Inf files
infs = oemsetup.inf
@@ -16,7 +16,7 @@ sfdos_objs = sftsr.obj sfmain.obj kitten.obj vbox.obj
# Compiler arguments for DOS
dos_cflags = -bt=dos -ms -6 -osi -w3 -wcd=202
-# -ms to use small memory model (though sometimes ss != ds...)
+# -ms to use small memory model (this assumes ss == ds)
# -osi to optimize for size, put intrinsics inline (to avoid runtime calls)
# -w3 enables warnings
# -wcd=202 disables the unreferenced function warning (e.g., for inline functions in headers)
@@ -37,16 +37,25 @@ w16dll_cflags = -bt=windows -bd -mc -zu -s -6 -osi -w3 -wcd=202
compile_dos = *wcc -fo=$^@ $(dos_cflags) $[@
compile_dostsr = *wcc -fo=$^@ $(dostsr_cflags) $[@
compile_w16dll = *wcc -fo=$^@ $(w16dll_cflags) $[@
+compile_link_host = *wcl386 -i=$(%originclude) -os -fe=$^@ $[@
+
+!ifdef __UNIX__
+run_host = ./
+!else
+run_host =
+!endif
.BEFORE:
# We need DOS and Windows headers, not host platform's
+ set originclude=$(%include)
set include=$(%watcom)/h/win;$(%watcom)/h
all: $(bins) .SYMBOLIC
# DOS mouse driver
-vbmouse.exe: vbmouse.lnk $(mousedos_objs)
+vbmouse.exe: vbmouse.lnk $(mousedos_objs) kittenc.exe
*wlink @$[@ name $@ file { $(mousedos_objs) }
+ $(run_host)kittenc.exe $@ attach nls/vbmouse.*
mousetsr.obj: mousetsr.c .AUTODEPEND
$(compile_dostsr)
@@ -62,13 +71,14 @@ mousew16.obj: mousew16.c .AUTODEPEND
$(compile_w16dll)
# DOS shared folders
-vbsf.exe: vbsf.lnk $(sfdos_objs)
+vbsf.exe: vbsf.lnk $(sfdos_objs) kittenc.exe
*wlink @$[@ name $@ file { $(sfdos_objs) }
+ $(run_host)kittenc.exe $@ attach nls/vbsf.*
sftsr.obj: sftsr.c .AUTODEPEND
$(compile_dostsr)
-sfmain.obj: sfmain.c .AUTODEPEND
+sfmain.obj: sfmain.c unitbl.h .AUTODEPEND
$(compile_dos)
# Auxiliary object files
@@ -78,14 +88,35 @@ vbox.obj: vbox.c .AUTODEPEND
kitten.obj: kitten.c .AUTODEPEND
$(compile_dos)
+# embed all unitbl/*.tbl files into a single unitbl.h
+unitbl.h: unitbl2c.exe $(unitbls)
+ $(run_host)unitbl2c.exe $@ unitbl/*.tbl
+
+# Test programs
+moustest_objs = moustest.obj
+
+moustest.exe: moustest.obj
+ *wlink system dos name $@ file { $(moustest_objs) }
+
+moustest.obj: moustest.c .AUTODEPEND
+ $(compile_dos) -mc -zu
+
+# Programs to build for the host
+host_bins = unitbl2c.exe kittenc.exe
+unitbl2c.exe: unitbl2c.c
+ $(compile_link_host)
+
+kittenc.exe: kittenc.c
+ $(compile_link_host)
+
# Other targets
clean: .SYMBOLIC
- rm -f vbmouse.exe vbmouse.drv vbsf.exe vbados.flp *.obj *.map
+ rm -f vbados.zip vbados.flp vbasrc.zip
+ rm -f $(bins) $(host_bins)
+ rm -f *.obj *.map
vbados.flp:
mformat -C -f 1440 -v VBADOS -i $^@ ::
- mcopy -i $^@ nls/*.tbl ::
- mcopy -i $^@ nls/vbsf.* nls/vbmouse.* ::
# Build a floppy image containing the driver
flp: vbados.flp $(bins) $(infs) .SYMBOLIC
@@ -93,5 +124,7 @@ flp: vbados.flp $(bins) $(infs) .SYMBOLIC
# Build a zip with the driver binaries
zip: vbmouse.exe vbmouse.drv oemsetup.inf vbsf.exe .SYMBOLIC
- zip --DOS-names -fz- -j vbados.zip nls/*.tbl nls/vbsf.* nls/vbmouse.*
zip --DOS-names -fz- vbados.zip $(bins) $(infs)
+
+srczip: .SYMBOLIC
+ zip --DOS-names -fz- vbasrc.zip COPYING README.md makefile *.lnk *.h *.c *.inf nls/* unitbl/* doc/*