# Produces EFI executable.
# We link with the library produced by makefile.efb
# And we still use makefile.w32 and makecomm.w32
# which are still a.out

CC=gccwin
CFLAGS=-O2
LD=ldwin
LDFLAGS=
AS=aswin
AR=arwin
COPTS=-D__NO_LONG_LONG__ -S $(CFLAGS) -fpack-struct -ansi \
    -I../pdpclib -I../src -U__WIN32__ -D__EFI__ -D__EFIBIOS__ \
    -D__STATIC__ -D__NOBIVA__ -DNEED_AOUT -DGENSHELL \
    -DNEED_MZ -DNO_DLLENTRY -DNEED_OS2 -DHAVE_DIR \
    -DW32EMUL -D__W32EMUL__ -D__32BIT__ -DNEED_ELF

all: clean bios.exe

bios.exe: bios.o ../bios/exeload.o ../src/doscalls.o
    $(LD) $(LDFLAGS) -s -o bios.exe -s -subsystem efi -e _efimain -nostdlib ../pdpclib/efistart.o bios.o ../bios/exeload.o ../src/doscalls.o ../pdpclib/pdpefi.a

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

clean:
    rm -f *.o bios.exe
