# This builds EFI executables for x86_64
# using Visual Studio
# Note that with Visual Studio it appears to be
# mandatory to use unsigned long long as size_t

CC=cl
AR=lib
LD=link
AS=ml64
COPTS=-c -nologo -O2 -Oi- -GS- -Za -Zl -u -X -D__MSC__ -D__64BIT__ \
    -D__EFI__ -D__EFIBIOS__ -U__WIN32__ -I. -D__W64SHELL__

TARGET=pdptest.efi
OBJS=efistart.o stdio.o string.o stdlib.o start.o time.o errno.o \
    assert.o signal.o locale.o ctype.o setjmp.o math.o x64supa.o

$(TARGET): clean pdptest.o $(OBJS)
  rm -f pdpefi.a
  $(AR) -out:pdpefi.a -nologo $(OBJS)
  $(LD) -nologo -fixed:no -nodefaultlib -entry:efimain -out:$(TARGET) -subsystem:EFI_APPLICATION pdptest.o $(OBJS)

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

.asm.o:
  $(AS) -c -nologo -Fo$@ $<

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