# Part of KPCOMM, Copyright (c) 2026 Scott Duensing, under the MIT License. # See LICENSE.md for license information. # SPDX-License-Identifier: MIT # # watcom.mk -- KPCOMM.DRV built on Linux with Open Watcom v2's 16-bit # Windows target, for hosts without MSVC 1.52 (the makefile, for NMAKE, is # the MSVC build). Uses the Open Watcom JoeyLib's installer sets up, unless # WATCOM names another. # # make -f watcom.mk bin/kpcomm.drv # make -f watcom.mk clean remove obj/ and bin/ # make -f watcom.mk OBJ=DIR BIN=DIR build somewhere else # # Compiler flags, as the MSVC build's: Windows target (-bt=windows) DLL # (-bd), small model with SS != DS (-ms -zu), Windows prolog for exported # functions (-zw), no stack probes (-s), 286 code (-2), structures packed # on 2 bytes (-zp2), all warnings (-w4). The _asm blocks set variables # Watcom cannot see set (W200), so those warnings are off (-wcd=200); # kpcomm.lnk is commdrv.def for wlink. WATCOM ?= $(abspath $(CURDIR)/../../joeylib/toolchains/opt/openWatcom) export WATCOM export PATH := $(WATCOM)/binl64:$(PATH) CC := wcc LINK := wlink CFLAGS := -q -bt=windows -bd -ms -zu -zw -s -2 -zp2 -os -w4 -wcd=200 -we -i=$(WATCOM)/h -i=$(WATCOM)/h/win OBJ ?= obj BIN ?= bin TARGET := $(BIN)/kpcomm.drv OBJS := $(OBJ)/commdrv.obj $(OBJ)/isr.obj $(OBJ)/lpt.obj all: $(TARGET) $(OBJ)/%.obj: %.c commdrv.h watcom.mk | $(OBJ) $(CC) $(CFLAGS) -fo=$@ $< $(TARGET): $(OBJS) kpcomm.lnk | $(BIN) $(LINK) option quiet @kpcomm.lnk name $@ $(foreach o,$(OBJS),file $(o)) option map=$(OBJ)/kpcomm.map $(OBJ) $(BIN): mkdir -p $@ clean: rm -rf $(OBJ) $(BIN) .PHONY: all clean