# This builds 32-bit UEFI ARM executables
# You must have built PDPCLIB with makefile.prm first

CC=gccprm
CFLAGS=-O0
#LD=ldprm -subsystem efi
LD=pdld --oformat coff --no-insert-timestamp --subsystem 10
LDFLAGS=
AS=asprm
AR=arprm
COPTS=-S $(CFLAGS) -ansi -I . -I../pdpclib -I../bios -I../src \
  -D__ARM__ -fno-common -mapcs-32 -DNEED_MZ -DNEED_ELF \
  -DGENSHELL -D__GENSHELL__ -DNO_DLLENTRY \
  -msoft-float -D__EFI__ -D__EFIBIOS__ \
  -fno-leading-underscore

all: clean bios.exe

bios.exe: bios.o list.o ../bios/exeload.o
    $(LD) $(LDFLAGS) -s -e efimain -nostdlib -o bios.exe bios.o list.o ../bios/exeload.o ../pdpclib/pdpefi.a

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

clean:
    rm -f *.o bios.exe
