aboutsummaryrefslogtreecommitdiff
path: root/makefile
diff options
context:
space:
mode:
Diffstat (limited to 'makefile')
-rw-r--r--makefile67
1 files changed, 67 insertions, 0 deletions
diff --git a/makefile b/makefile
new file mode 100644
index 0000000..a42e957
--- /dev/null
+++ b/makefile
@@ -0,0 +1,67 @@
+#!/usr/bin/env wmake
+
+# All binaries to build
+bins = test.exe chudisk.sys chud.exe
+
+# Object files for chdisk
+chudisk_objs = chudisk.obj chudinit.obj cio.obj
+
+# Compiler arguments for DOS
+dos_cflags = -bt=dos -3 -ms -osi -ox -w3 -wcd=202 -g=DGROUP
+# -ms to use small memory model (this assumes ss == ds)
+# -osi to optimize for size, put intrinsics inline (to avoid runtime calls)
+# -ox extra optimization (impact is not very big)
+# -w3 enables warnings
+# -wcd=202 disables the unreferenced function warning (e.g., for inline functions in headers)
+
+# Compiler arguments for the DOS drivers
+dosdrv_cflags = -bt=dos -3 -ms -zu -s -osi -ox -w3 -wcd=202 -g=DGROUP
+# -zu since ss != ds in the driver
+# -s to disable stack checks, since it inserts calls to the runtime
+
+# Full compiler command lines
+compile_dos = *wcc -fo=$^@ $(dos_cflags) $[@
+compile_dosdrv = *wcc -fo=$^@ $(dosdrv_cflags) $[@
+
+# Object files
+
+.BEFORE:
+ # We need DOS and Windows headers, not host platform's
+ set include=$(%watcom)/h/win;$(%watcom)/h
+
+all: $(bins) .SYMBOLIC
+
+test.exe: test.obj .AUTODEPEND
+ *wlink system dos name $@ file { test.obj }
+
+test.obj: test.c .AUTODEPEND
+ *wcc -fo=$^@ -bt=dos -3 -osi -w3 -wcd=202 $[@
+
+chudisk.sys: chudisk.lnk $(chudisk_objs) .AUTODEPEND
+ *wlink @$[@ name $@ file { $(chudisk_objs) }
+
+chudisk.obj: chudisk.c .AUTODEPEND
+ $(compile_dosdrv)
+
+chudinit.obj: chudinit.c .AUTODEPEND
+ $(compile_dosdrv)
+
+cio.obj: cio.c .AUTODEPEND
+ $(compile_dosdrv)
+
+chud.exe: chud.obj .AUTODEPEND
+ *wlink name $@ system dos file { chud.obj }
+
+chud.obj: chud.c .AUTODEPEND
+ $(compile_dos)
+
+clean: .SYMBOLIC
+ rm -f $(bins) *.obj
+
+# Build a zip with the driver binaries
+zip: $(bins) .SYMBOLIC
+ zip --DOS-names -fz- chu.zip $(bins)
+
+srczip: .SYMBOLIC
+ zip -fz- chusrc.zip COPYING README.md makefile *.lnk *.h *.c inc/*.h
+