# This builds EFI executables for the 80386

# We need to disable the use of the non-C90 "long long"
# I think because the infrastructure (PDPCLIB) doesn't
# support it, but I haven't investigated

CC=gccwin
AR=arwin
LD=ldwin
AS=aswin
COPTS=-D__NO_LONG_LONG__ -S -O2 -D__EFI__ -U__WIN32__ -I. -fno-common -ansi

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 winsupc.o

$(TARGET): clean pdptest.o $(OBJS)
  rm -f pdpefi.a
  $(AR) r pdpefi.a $(OBJS)
  $(LD) -s -subsystem efi -e _efimain -nostdlib -o $(TARGET) pdptest.o $(OBJS)

.c.o:
  $(CC) $(COPTS) -o $*.s $<
  $(AS) -o $*.o $*.s
  rm -f $*.s

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

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