#
# Makefile for Core War system & Scheme->C.
#
# 

.SUFFIXES: .c .o .sc
SCC= /usr/local/bin/scc
CC= /bin/cc
CC= gcc

# Change this for your machine type
CFLAGS=-I/usr/local/lib/schemetoc -DAPOLLO=1 -O -fstrength-reduce 

# It will run faster with these options...
SCCFLAGS= -Ob -Ot

SSRC = core.sc instr.sc mars.sc util.sc rcasm.sc print.sc cw.sc \
  redcode.sc program.sc 
CSRC = core.c instr.c mars.c util.c rcasm.c print.c cw.c redcode.c \
  program.c
OBJ = core.o instr.o mars.o util.o rcasm.o print.o cw.o redcode.o \
  program.o 

.sc.o:
	$(SCC) $(SCCFLAGS) -C $<
	$(CC) $(CFLAGS) -c $*.c
.c.o:
	$(CC) $(CFLAGS) -c $<
.sc.c:
	$(SCC) $(SCCFLAGS) -C $<

# and you'll have to fix this line too for your machine
cw: $(OBJ)
	$(CC) $(CFLAGS) -o cw $(OBJ) /usr/src/scheme-to-c/sun3/scrt/apollo.o -lm

clean:
	rm -f $(CSRC) $(OBJ) SC-TO-C*.c

wc:
	wc $(SSRC)
