# Produce 32-bit Linux ELF executables
# links with PDPCLIB created by makefile.slp

CC=sccwin
LD=pdld
LDFLAGS=-s --no-insert-timestamp -nostdlib --oformat elf --emit-relocs
AS=pdas
AR=xar

all: clean scc.exe

scc.exe: cg.obj decl.obj error.obj expr.obj gen.obj main.obj misc.obj \
    opt.obj prep.obj scan.obj stmt.obj sym.obj tree.obj \
    lib/strdup.obj
  $(AR) s temp.lib
  $(LD) $(LDFLAGS) -s -o scc.exe ../../pdos/pdpclib/linstart.o main.obj temp.lib ../../pdos/pdpclib/pdplinux.a

.c.obj:
  pdcc -E -D__SUBC__ -U__WIN32__ -D__OS2__ -D__32BIT__ -Dunsigned= -Dlong=int -Dshort=int -Dconst= -Ddouble=int -I ../../pdos/pdpclib -I . -o $*.i $<
  $(CC) -S $*.i
  rm -f $*.i
  $(AS) -o $@ --oformat coff $*.s
  rm -f $*.s
  $(AR) r temp.lib $*.obj

clean:
  rm -f *.obj
  rm -f scc.exe
  rm -f temp.lib
