# Compile a 32-bit version of cc64

CC=gccwin
CFLAGS=-O2
LD=pdld
LDFLAGS=-s
AS=as86 -f coff
COPTS=$(CFLAGS) -S -fno-common -DBLDGENERIC -D__WIN32__ -I . -I ../pdpclib

all: cc64.exe

cc64.exe: cc32n.obj ../pdpclib/winsupa.obj
  $(LD) --stack 0,0x5f000 -s -nostdlib --no-insert-timestamp --image-base 0x400000 -o $@ ../pdpclib/w32start.obj cc32n.obj ../pdpclib/msvcrt.lib ../pdpclib/winsupa.obj

.c.obj:
  $(CC) $(COPTS) -o $*.s $<
  pdas --oformat coff -o $@ $*.s
  rm -f $*.s

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

clean:
  rm -f *.obj
  rm -f cc64.exe
