# Released to the public domain.
#
# Anyone and anything may copy, edit, publish,
# use, compile, sell and distribute this work
# and all its parts in any form for any purpose,
# commercial and non-commercial, without any restrictions,
# without complying with any conditions
# and by any means.

# bytearray is necessary for BIOS structures.
VPATH=source;svga;../pdld/src/bytearray
CC=gccwin
CFLAGS=-O2
LD=pdld
LDFLAGS=-s -nostdlib --no-insert-timestamp
AS=pdas --oformat coff
COPTS=-S $(CFLAGS) -Wall -ansi -fno-common -I./source -I./svga -I../pdpclib -I../src -I../pdld/src/bytearray -D__WIN32__ -D__NOBIVA__ -D__32BIT__

OBJS=pfp.obj pfpsvga.obj svga.obj vesa_bytearray.obj bytearray.obj

TARGET=pfpsvga.exe

all: clean $(TARGET)

$(TARGET): $(OBJS) ../src/pos.obj ../src/bos.obj ../src/support.obj
  $(LD) $(LDFLAGS) -o $(TARGET) ../pdpclib/w32start.obj ../src/pos.obj ../src/bos.obj ../src/support.obj $(OBJS) ../pdpclib/msvcrt.lib

# Suffix different from .s is used so the .s.obj rule does not cause problems.
.c.obj:
  $(CC) $(COPTS) -o $*.ts $<
  $(AS) -o $@ $*.ts
  rm -f $*.ts

.s.obj:
  $(AS) -o $@ $<

clean:
  rm -f $(OBJS) $(TARGET)
