# Produce ARM executables
# links with PDPCLIB created by makefile.aga

# If using gccarm also remove the SUBC define I think

CC=sccarm
#CC=gccarm -fno-common -fno-builtin -O0 -mapcs-32
LD=ldarm
LDFLAGS=
AS=asarm
AR=ararm

all: clean scc.exe

scc.exe: cg.o decl.o error.o expr.o gen.o main.o misc.o \
    opt.o prep.o scan.o stmt.o sym.o tree.o \
    strdup.o \
    ../../pdos/pdpclib/pgastart.o ../../pdos/pdpclib/armsupa.o
  $(AR) s temp.a
  $(LD) $(LDFLAGS) -N -s -nostdlib -o scc.exe ../../pdos/pdpclib/pgastart.o main.o temp.a ../../pdos/pdpclib/armsupa.o
  rm -f strdup.c

.c.o:
  pdcc -N -D__SUBC__ -D__UNOPT__ -D__PDOS386__ -D__PDOSGEN__ -D__ARMGEN__ -D__NOBIVA__ -Dunsigned= -Dlong=int -Dshort=int -Dconst= -Ddouble=int -I ../../pdos/pdpclib -I . -I ../../pdos/generic -o $*.i $<
  $(CC) -S -o $*.s $*.i
  rm -f $*.i
  $(AS) -o $@ $*.s
  rm -f $*.s
  $(AR) r temp.a $*.o

clean:
  rm -f *.o
  rm -f scc.exe
  rm -f temp.a
  copy lib\strdup.c strdup.c
