joeylib2/make/win16.mk
2026-10-19 15:46:47 -05:00

57 lines
2.5 KiB
Makefile

# Part of JoeyLib, Copyright (c) 2026 Scott Duensing, under the MIT License.
# See LICENSE.md for license information.
# SPDX-License-Identifier: MIT
#
# Win16 build rules: JoeyLib programs as Windows 3.x programs, through the
# hosted core and its Win16 backend (src/hosted, src/hosted/win16), for
# Windows 3.1 on a 386 or better. The rules are make/hosted.mk's; this file
# says what is the Win16 port's. A project reaches it through
# make/project.mk.
#
# Built with Open Watcom's Win386 target (the installer's openWatcom
# component) through make/support/win16/owcc.sh, which gives hosted.mk the
# gcc and ar it expects: 32-bit flat-model code -- the module player and the
# SFX mixer need a 32-bit int, and a 386 runs it faster than 16-bit far
# pointers -- bound to Watcom's supervisor, so a program is one Windows 3.x
# NE executable NAME.EXE, in bin/ or in its own bin/NAME/ with its DATA
# beside it, calling USER, GDI, KERNEL and MMSYSTEM through the supervisor.
# The frame is 8-bit indexed (a 256-color DIB holding all 16 palettes) and
# the sound 22.05 kHz mono, what Windows 3.1 and a 386 handle well. The port
# makes the program's folder the current directory when the window opens.
PLATFORM := win16
include $(dir $(lastword $(MAKEFILE_LIST)))/common.mk
$(call requireTool,$(WIN16_WATCOM)/binl64/owcc,toolchain:win16)
WIN16_OWCC := $(REPO_DIR)/make/support/win16/owcc.sh
HOSTED_CC := $(WIN16_OWCC) cc
HOSTED_AS := $(WIN16_OWCC) as
HOSTED_AR := $(WIN16_OWCC) ar
HOSTED_BACKEND := win16
HOSTED_DEFINES := -DJOEYLIB_PLATFORM_HOSTED -DJOEYLIB_HOSTED_WIN16 -DHOSTED_FRAME_INDEXED -DHOSTED_AUDIO_RATE=22050u -DHOSTED_AUDIO_CHANNELS=1u
# Watcom's Windows headers, and the set-1 scan code table the DOS port reads
# its keys through.
HOSTED_SDK_CFLAGS := -I$(WIN16_WATCOM)/h/win -I$(SRC_X86)
HOSTED_LINK :=
PROGRAM_EXT := .EXE
# Its icon, the one Program Manager shows and the window shows minimized:
# 32x32 in the 16 VGA colors, bound in from a resource script.
HOSTED_ICON = $(call programIconDir,$(1))/icon.rc
HOSTED_ICON_BAKE = $(call hostedIconScript,$(1),ico16)
HOSTED_ICON_LINK = $(call HOSTED_ICON,$(1))
# Sprites compiled to x86 code, as on DOS (src/x86).
HOSTED_X86 := 1
include $(REPO_DIR)/make/hosted.mk
# UBER's probe build is part of JoeyLib's own `all`
# (scripts/verify-win16-display.sh).
ifndef JOEY_PROJECT
all $(PLATFORM): $(call programTarget,UBERPROB)
# The serial throughput gate's program (scripts/verify-win16-serial-fast.sh).
.PHONY: win16-serfast
win16-serfast: $(call programTarget,SERFAST)
endif