# Produces ARM64 EFI executable.
# We link with the library produced by makefile.va6
# And we use executables produced by pdpclib makefile.var
# which are PE

CC=cl
#LD=link
LD=pdld --no-insert-timestamp --emit-relocs -s
COPTS=-c -nologo -O2 -Oi- -GS- -Za -Zl -u -X -D__MSC__ -D__64BIT__ -D__EFI__ \
    -D__EFIBIOS__ -U__WIN32__ -I../pdpclib -I../bios -I../src -DTARGET_64BIT \
    -DNEED_MZ -DNEED_ELF -DNO_DLLENTRY -D__ARM__ \
    -DGENSHELL -D__W64SHELL__ -DW64EMUL

TARGET=bios.exe
OBJS=../bios/exeload.obj

$(TARGET): clean bios.obj $(OBJS)
#  $(LD) -nologo -fixed:no -nodefaultlib -entry:efimain -out:$(TARGET) -subsystem:EFI_APPLICATION bios.obj $(OBJS) ../pdpclib/pdpefi.lib
  $(LD) --oformat coff -subsystem 10 --image-base 0x400000 -e efimain -o $(TARGET) bios.obj $(OBJS) ../pdpclib/pdpefi.lib

.c.obj:
  $(CC) $(COPTS) -Fo$*.obj $<

clean:
  rm -f *.obj
  rm -f $(TARGET)
