# Produces Linux x64 executable
# You should have build pdpclib with makefile.l64 first

CC=gcc
CFLAGS=-O0 -mno-red-zone -fno-builtin -D__gnu_linux__ \
    -m64 -fno-stack-protector \
    -D__NOBIVA__ -DUSE_MEMMGR -DNEED_ELF \
    -DNO_DLLENTRY -DGENSHELL \
    -D__64BIT__ -DHAVE_DIR -DLINDIR
LD=ld
LDFLAGS=
AS=as
AR=ar
COPTS=-S $(CFLAGS) -ansi -I../bios -I../pdpclib -I../src

all: clean bios

bios: bios.o ../bios/exeload.o
  $(LD) -s -nostdlib -e __start -o bios.exe ../pdpclib/linstart.o bios.o ../bios/exeload.o ../pdpclib/pdplinux.a

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

clean:
	rm -f *.o bios
