# This builds a PDOS-generic ELF executable for 32-bit ARM

CC=gccprm
COPTS=-S -O0 -fno-common -fno-builtin -mapcs-32 -DHAVE_DIR -D__UNOPT__ -D__PDOS386__ -D__PDOSGEN__ -D__ARMGEN__ -D__NOBIVA__ -I . -I../pdpclib -I../src

all: clean pcomm.exe

pcomm.exe: ../pdpclib/pgastart.o pcomm.o ../pdpclib/armsupa.o
  rm -f pcomm.exe
  pdld --oformat elf -s -e ___crt0 --emit-relocs -o pcomm.exe ../pdpclib/pgastart.o pcomm.o ../pdpclib/armsupa.o
#  lderm -s -e ___crt0 --emit-relocs -o pcomm.exe ../pdpclib/pgastart.o pcomm.o ../pdpclib/armsupa.o

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

.asm.o:
  aserm --defsym LINUX=0 --defsym ELF=1 --defsym STACKPARM=0 -o $@ $<

clean:
  rm -f pcomm.exe
