# Produce Windows executables
# links with PDPCLIB created by makefile.msv

CC=sccstrw
LD=pdld
LDFLAGS=--no-insert-timestamp
AS=pdas
AR=ar

OBJS=	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 lib/strdup.o unixio.eo

all: clean scc.exe

scc.exe: $(OBJS)
  $(AR) s temp.a
  $(LD) $(LDFLAGS) -s -o scc.exe ../../pdos/pdpclib/w32start.o main.o temp.a ../../subcstr/src/libscc.a unixio.eo ../../pdos/pdpclib/msvcrt.a ../../pdos/pdpclib/winsupc.obj


# Use the subcstr includes

.c.o:
  pdcc -N -D__SUBC__ -I ../../subcstr/src/include -I . -o $*.i $<
  rm -f $*.s
  $(CC) -S $*.i
  rm -f $*.i
  $(AS) -o $@ --oformat coff $*.s
  rm -f $*.s
  $(AR) r temp.a $@


# This "glue" routine is built with an old version of sccwin
# and if stepping stones were being used, this would need to
# be manually built (or keep the generated assembler)

.c.eo:
  pdcc -N -D__SUBC__ -D__WIN32__ -Dunsigned= -Dlong=int -Dshort=int -Dconst= -Ddouble=int -I ../../pdos/pdpclib -I . -o $*.i $<
  rm -f $*.s
  sccwinx -S $*.i
  $(AS) -o $@ --oformat coff $*.s
  rm -f $*.s

clean:
  rm -f *.o
  rm -f scc.exe
  rm -f temp.a
