Files
gw-basic-2026/Makefile.dos
Eremey Valetov 8ff9ff22bf Cross-compile to DOS with OpenWatcom -- 24/24 files, 154KB executable
All 24 source files compile and link for DOS/4GW 32-bit target using
OpenWatcom V2 cross-compiler (wcc386 -bt=dos -mf -za99 -D__MSDOS__).

Platform portability fixes:
- hal_dos.c: use int386() instead of int86() for 32-bit DOS
- interp.c: mkdir() 1-arg on DOS, _dos_findfirst/findnext for FILES,
  monotonic_time() portable wrapper for clock_gettime/clock()
- virmem.c: replace clock_gettime with portable time()/localtime()
- graphics.c: define M_PI, avoid non-constant aggregate initializers
- tui.c: guard sys/ioctl.h and sigaction, use signal() on DOS,
  use HAL screen size instead of TIOCGWINSZ

Produces: gwbasic.exe (154KB LE executable, requires DOS4GW.EXE)
Linux build and all 72+14+69 tests unaffected.
2026-03-30 19:42:45 -04:00

60 lines
1.9 KiB
Makefile

# Makefile for building GW-BASIC 2026 with OpenWatcom for DOS
#
# Usage:
# wmake -f Makefile.dos (from OpenWatcom environment)
# wmake -f Makefile.dos clean
#
# Requires: OpenWatcom 2.0+ with DOS/4GW 32-bit target
# Produces: GWBASIC.EXE (interpreter), GWBASCOM.EXE (compiler), GWRT.LIB (runtime)
CC = wcc386
CFLAGS = -bt=dos -mf -ox -w4 -zq -za99 -Iinclude -D__MSDOS__
LINKER = wlink
LIBRARIAN = wlib
# Interpreter sources (excludes compiler_main, analysis, codegen, gwrt)
INTERP_OBJS = &
src/main.obj src/tokens.obj src/tokenizer.obj src/error.obj &
src/eval.obj src/interp.obj src/vars.obj src/arrays.obj &
src/input.obj src/math_int.obj src/math_float.obj &
src/math_transcend.obj src/strings.obj src/print.obj &
src/fileio.obj src/program_io.obj src/print_using.obj &
src/graphics.obj src/virmem.obj src/portio.obj src/strpool.obj &
src/sound.obj src/tui.obj platform/hal_dos.obj
# Runtime library (for compiled programs)
GWRT_OBJS = &
src/tokens.obj src/tokenizer.obj src/error.obj &
src/eval.obj src/interp.obj src/vars.obj src/arrays.obj &
src/input.obj src/math_int.obj src/math_float.obj &
src/math_transcend.obj src/strings.obj src/print.obj &
src/fileio.obj src/program_io.obj src/print_using.obj &
src/graphics.obj src/virmem.obj src/portio.obj src/strpool.obj &
src/sound.obj src/tui.obj src/gwrt.obj platform/hal_dos.obj
# Compiler sources
COMP_OBJS = &
src/compiler_main.obj src/analysis.obj src/codegen.obj &
src/tokens.obj src/tokenizer.obj
.c.obj:
$(CC) $(CFLAGS) -fo=$@ $<
all: gwbasic.exe gwbascom.exe gwrt.lib
gwbasic.exe: $(INTERP_OBJS)
$(LINKER) system dos4g name $@ file { $< }
gwrt.lib: $(GWRT_OBJS)
$(LIBRARIAN) -q -n $@ $(GWRT_OBJS)
gwbascom.exe: $(COMP_OBJS)
$(LINKER) system dos4g name $@ file { $< }
clean: .SYMBOLIC
del src\*.obj
del platform\*.obj
del gwbasic.exe
del gwbascom.exe
del gwrt.lib