joeylib2/make/win16.mk
2026-10-13 14:01:46 -05:00

40 lines
1.9 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 -- libxmp-lite and the shared
# 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-colour 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)
$(call requireTool,$(LIBXMP_DIR)/include/libxmp-lite/xmp.h,toolchain:win16)
WIN16_OWCC := $(REPO_DIR)/make/support/win16/owcc.sh
HOSTED_CC := $(WIN16_OWCC) cc
HOSTED_AR := $(WIN16_OWCC) ar
HOSTED_BACKEND := win16
HOSTED_DEFINES := -DJOEYLIB_PLATFORM_HOSTED -DJOEYLIB_HOSTED_WIN16 -DHOSTED_FRAME_INDEXED -DHOSTED_FRAME_BOTTOM_UP -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
include $(REPO_DIR)/make/hosted.mk