# This is the new new standard (using cc64) for PDOS/x64
# It builds cc64 itself - you need to choose whether you
# want a version that is "generic" in nature or the
# standalone version that can produce an executable all
# by itself. At the moment the standalone version can't
# be built with this procedure.

# You need to have built pdpclib with makefile.n64 first

# define LONG64 if you want 64-bit longs

CC=cc64
AR=ar
AS=pdas --oformat coff --64
LD=pdld
COPTS=-DBLDGENERIC -DXLONG64 -D__WIN32__ -D__64BIT__ -D__CC64__ -I . -I ../pdpclib

all: cc64.exe

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

.c.obj:
  pdcc -E $(COPTS) -o $*.i $<
  $(CC) -q -c -out:$@ $*.i
  rm -f $*.i
#  $(CC) -c -out:$@ $<

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

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