WinDriver/Makefile
Scott Duensing fbb1cce5c3 Add TrueType font support via stb_truetype.h
Integrate stb_truetype.h to rasterize TTF glyphs into 1-bit .FNT v3
format consumed by Win3.x display drivers. Key implementation detail:
.FNT bitmaps use column-major byte order (all rows of byte-column 0
first, then byte-column 1, etc.), not row-major.

New API: wdrvLoadFontTtf(path, pointSize) loads any TTF at any size.
Demo 7 renders Liberation Sans/Serif/Mono at 16/20/24pt.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 00:38:16 -06:00

67 lines
1.8 KiB
Makefile

# ============================================================================
# Makefile for windrv demo - Windows 3.x display driver loader for DJGPP/DOS
#
# Targets:
# all - Build libwindrv.a and demo.exe (default)
# lib - Build only libwindrv.a
# demo - Build only demo.exe
# clean - Remove all build artifacts
#
# Output:
# bin/demo.exe - Demo program
# bin/CWSDPMI.EXE - DPMI host (extracted from tools/cwsdpmi.zip)
# bin/*.DRV - Driver files (copied from drivers/)
# win31drv/libwindrv.a - Static library
# ============================================================================
DJGPP_PREFIX ?= $(HOME)/djgpp/djgpp
CC = $(DJGPP_PREFIX)/bin/i586-pc-msdosdjgpp-gcc
CFLAGS = -Wall -Wextra -O2 -std=gnu99 -Iwin31drv
LDFLAGS = -lm
# DJGPP binutils need libfl.so.2 which may not be installed system-wide
export LD_LIBRARY_PATH := $(realpath tools/lib):$(LD_LIBRARY_PATH)
OBJDIR = obj
BINDIR = bin
LIBDIR = win31drv
LIB = $(LIBDIR)/libwindrv.a
DEMO_SRC = demo.c
DEMO_OBJ = $(OBJDIR)/demo.o
DEMO_EXE = $(BINDIR)/demo.exe
.PHONY: all clean lib demo
all: lib demo
lib:
$(MAKE) -C $(LIBDIR)
demo: $(DEMO_EXE)
$(DEMO_EXE): $(DEMO_OBJ) lib | $(BINDIR)
$(CC) $(CFLAGS) -o $@ $(DEMO_OBJ) -L$(LIBDIR) -lwindrv $(LDFLAGS)
unzip -oj tools/cwsdpmi.zip bin/CWSDPMI.EXE -d $(BINDIR) 2>/dev/null; true
cp tools/TEST.BAT $(BINDIR)/
-cp -n drivers/*.DRV $(BINDIR)/ 2>/dev/null; true
-cp -n fon/*.FON $(BINDIR)/ 2>/dev/null; true
-cp -n ttf/*.TTF $(BINDIR)/ 2>/dev/null; true
$(OBJDIR)/%.o: %.c | $(OBJDIR)
$(CC) $(CFLAGS) -c -o $@ $<
$(OBJDIR):
mkdir -p $(OBJDIR)
$(BINDIR):
mkdir -p $(BINDIR)
# Dependencies
$(OBJDIR)/demo.o: demo.c win31drv/windrv.h win31drv/wintypes.h
clean:
$(MAKE) -C $(LIBDIR) clean
-rm -rf $(OBJDIR) $(BINDIR)