51 lines
1.7 KiB
Makefile
51 lines
1.7 KiB
Makefile
# ============================================================================
|
|
# Makefile for win31drv - Windows 3.x display driver library for DJGPP/DOS
|
|
# ============================================================================
|
|
|
|
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.
|
|
|
|
# DOSBox-X's S3 Trio64 emulation corrupts specific memory addresses
|
|
# during 16-bit driver calls via thunkCall16. With -O2 GCSE enabled,
|
|
# the code layout places stack locals and register spills at addresses
|
|
# that overlap the corruption targets, causing wrong values in drawing
|
|
# parameters. Disabling GCSE for windrv.c changes the layout enough
|
|
# to avoid the overlap. 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
|
|
$(CC) $(WINDRV_CFLAGS) -c -o $@ $<
|
|
|
|
clean:
|
|
-rm -rf $(OBJDIR) $(LIB)
|