aboutsummaryrefslogtreecommitdiff
path: root/makefile
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2026-10-26 00:50:06 +0100
committerJavier <dev.git@javispedro.com>2026-10-26 00:50:06 +0100
commit6b8a368c51082fdd010ef5e1b0be4eb9b5059d1a (patch)
treee274d41a8dd5e912e20617a937a1fda5af91f8de /makefile
parent9b1cf601360fb194047e6dcc2af75c2f38c611ec (diff)
downloadchu-6b8a368c51082fdd010ef5e1b0be4eb9b5059d1a.tar.gz
chu-6b8a368c51082fdd010ef5e1b0be4eb9b5059d1a.zip
refactor common parts into inc/ch375.h and add win9x, linux drivers
Diffstat (limited to 'makefile')
-rw-r--r--makefile94
1 files changed, 36 insertions, 58 deletions
diff --git a/makefile b/makefile
index a42e957..c7cc4db 100644
--- a/makefile
+++ b/makefile
@@ -1,67 +1,45 @@
#!/usr/bin/env wmake
-# All binaries to build
-bins = test.exe chudisk.sys chud.exe
+subdirs=dos w9x
-# 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)
+all: .SYMBOLIC
+ for %i in ($(subdirs)) do %make %i/$^@
clean: .SYMBOLIC
- rm -f $(bins) *.obj
+ for %i in ($(subdirs)) do %make %i/$^@
+
+# This would be so much easier with a multi-line macro...
+sd1=cd $^:
+!ifdef debug
+sd2=wmake $^. debug=$(debug)
+!else
+sd2=wmake $^.
+!endif
+sd3=cd ..
+
+dos/all: .SYMBOLIC
+ $(sd1)
+ $(sd2)
+ $(sd3)
+dos/clean: .SYMBOLIC
+ $(sd1)
+ $(sd2)
+ $(sd3)
+w9x/all: .SYMBOLIC
+ $(sd1)
+ $(sd2)
+ $(sd3)
+w9x/clean: .SYMBOLIC
+ $(sd1)
+ $(sd2)
+ $(sd3)
# Build a zip with the driver binaries
-zip: $(bins) .SYMBOLIC
- zip --DOS-names -fz- chu.zip $(bins)
+zip: dos/all w9x/all .SYMBOLIC
+ zip --DOS-names -fz- chu.zip dos/chudisk.sys dos/chud.exe w9x/chudisk.pdr w9x/chudisk.inf
srczip: .SYMBOLIC
- zip -fz- chusrc.zip COPYING README.md makefile *.lnk *.h *.c inc/*.h
-
+ zip -fz- chusrc.zip COPYING README.md makefile inc/*.h &
+ dos/makefile dos/*.c dos/*.h dos/*.lnk &
+ w9x/makefile w9x/*.c w9x/*.h w9x/*.lnk w9x/*.inf w9x/inc/*.h &
+ linux/makefile linux/*.c linux/*.h linux/*.sh