diff options
| author | Javier <dev.git@javispedro.com> | 2026-10-26 00:50:06 +0100 |
|---|---|---|
| committer | Javier <dev.git@javispedro.com> | 2026-10-26 00:50:06 +0100 |
| commit | 6b8a368c51082fdd010ef5e1b0be4eb9b5059d1a (patch) | |
| tree | e274d41a8dd5e912e20617a937a1fda5af91f8de /dos/makefile | |
| parent | 9b1cf601360fb194047e6dcc2af75c2f38c611ec (diff) | |
| download | chu-6b8a368c51082fdd010ef5e1b0be4eb9b5059d1a.tar.gz chu-6b8a368c51082fdd010ef5e1b0be4eb9b5059d1a.zip | |
refactor common parts into inc/ch375.h and add win9x, linux drivers
Diffstat (limited to 'dos/makefile')
| -rw-r--r-- | dos/makefile | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/dos/makefile b/dos/makefile new file mode 100644 index 0000000..aa328c2 --- /dev/null +++ b/dos/makefile @@ -0,0 +1,66 @@ +#!/usr/bin/env wmake + +# Debug Settings +!ifeq debug 1 +# Dump debug log to serial port, 0x3F8 UART (COM1) +debug_cflags = -DENABLE_DLOG=1 -DDLOG_TARGET=DLOG_TARGET_SERIAL -DDLOG_TARGET_PORT=0x3F8 +!endif + +# All binaries to build +bins = chudisk.sys chud.exe utest.exe + +# Object files for chudisk +chudisk_objs = chudisk.obj chudinit.obj cio.obj + +# Compiler arguments for DOS +dos_cflags = -bt=dos -i=../inc -3 -ms -osi -ox -w3 -wcd=202 $(debug_cflags) +# -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 = $(dos_cflags) -zu -s -g=DGROUP +# -zu since ss != ds in the driver +# -s to disable stack checks, since it inserts calls to the runtime +# -g=DGROUP put everything into the same segment + +# 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 + +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) + +utest.exe: utest.obj .AUTODEPEND + *wlink system dos name $@ file { utest.obj } + +utest.obj: utest.c .AUTODEPEND + $(compile_dos) + +clean: .SYMBOLIC + rm -f $(bins) *.obj |
