WinDriver/win31drv/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

53 lines
1.8 KiB
Makefile

# ============================================================================
# Makefile for win31drv - Windows 3.x display driver library for DJGPP/DOS
#
# Builds libwindrv.a from: log.c neload.c thunk.c winstub.c windrv.c
# windrv.c is compiled with -fno-gcse (see WINDRV_CFLAGS below).
# ============================================================================
DJGPP_PREFIX ?= $(HOME)/djgpp/djgpp
CC = $(DJGPP_PREFIX)/bin/i586-pc-msdosdjgpp-gcc
AR = $(DJGPP_PREFIX)/bin/i586-pc-msdosdjgpp-ar
CFLAGS = -Wall -Wextra -O2 -std=gnu99 -I.
# With -O2 GCSE enabled, GCC's code layout for windrv.c places stack
# locals and register spills at addresses that get corrupted during
# 16-bit driver calls via thunkCall16, causing wrong values in drawing
# parameters. Disabling GCSE changes the layout enough to avoid the
# issue. Only windrv.c is affected (it has the drawing functions that
# call thunkCall16 with interleaved parameter setup).
WINDRV_CFLAGS = $(CFLAGS) -fno-gcse
# 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
SRCS = log.c neload.c thunk.c winstub.c windrv.c
OBJS = $(addprefix $(OBJDIR)/,$(SRCS:.c=.o))
LIB = libwindrv.a
.PHONY: all clean
all: $(LIB)
$(LIB): $(OBJS)
$(AR) rcs $@ $^
$(OBJDIR)/%.o: %.c | $(OBJDIR)
$(CC) $(CFLAGS) -c -o $@ $<
$(OBJDIR):
mkdir -p $(OBJDIR)
# Dependencies
$(OBJDIR)/log.o: log.c log.h
$(OBJDIR)/neload.o: neload.c neload.h neformat.h wintypes.h log.h
$(OBJDIR)/thunk.o: thunk.c thunk.h wintypes.h log.h
$(OBJDIR)/winstub.o: winstub.c winstub.h thunk.h wintypes.h log.h
$(OBJDIR)/windrv.o: windrv.c windrv.h wintypes.h winddi.h neformat.h neload.h thunk.h winstub.h log.h stb_truetype.h
$(CC) $(WINDRV_CFLAGS) -c -o $@ $<
clean:
-rm -rf $(OBJDIR) $(LIB)