# This builds a PDOS-generic executable for ARM

CC=gccarm
COPTS=-msoft-float -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 ../pdpclib/string.o
  rm -f pcomm.exe
  ldarm -s -N -e ___crt0 -o pcomm.exe ../pdpclib/pgastart.o pcomm.o ../pdpclib/armsupa.o ../pdpclib/string.o

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

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

clean:
  rm -f pcomm.exe
