# Produce 64-bit EFI executables using mingw64 toolchain
# links with PDPCLIB created by makefile.eb6
# probably don't want to use the BIOS version, as this is
# supposed to be an app

CC=x86_64-w64-mingw32-gcc
LD=x86_64-w64-mingw32-ld
LDFLAGS=
AS=x86_64-w64-mingw32-as
AR=x86_64-w64-mingw32-ar

COPTS=-S -O2 -mno-red-zone -D__64BIT__ -D__EFI__ -D__EFIBIOS__ -U__WIN32__ -I. -I../../pdos/pdpclib -fno-builtin -fno-common -ansi -Wno-builtin-declaration-mismatch

all: clean scc.efi

scc.efi: cg.o decl.o error.o expr.o gen.o main.o misc.o \
    opt.o prep.o scan.o stmt.o sym.o tree.o \
    lib/strdup.o
  $(AR) s temp.a
  $(LD) $(LDFLAGS) -s -subsystem 10 -e efimain -o scc.efi ../../pdos/pdpclib/efistart.o main.o temp.a ../../pdos/pdpclib/pdpefi.a

.c.o:
  $(CC) $(COPTS) -o $*.s $<
  $(AS) -o $@ $*.s
  rm -f $*.s
  $(AR) r temp.a $@

clean:
  rm -f *.o
  rm -f scc.efi
  rm -f temp.a
