# Simple makefile to use marst to translate the
# test file from Algol 60 to C. The prescribed C compiler
# is then used to compile the resultant code for execution.

CC = gcc
CCFLAGS = 

# Set path to marst
MARST = /usr/local/bin/marst
# and to where the algol.h header file and the libalgol library
# files are stored
MARSTINC = /usr/local/include/
MARSTLIB = /usr/local/lib/

# Translate from Algol to C
%.c: %.alg
	$(MARST) $< > $@

all: OrigSrcAndTest NewSrcAndTest

OrigSrcAndTest: OrigSrcAndTest.c
	$(CC) $(CCFLAGS) -o $@ -I $(MARSTINC) -L $(MARSTLIB) $^ -lalgol

NewSrcAndTest: NewSrcAndTest.c
	$(CC) $(CCFLAGS) -o $@ -I $(MARSTINC) -L $(MARSTLIB) $^ -lalgol

.PHONY: clean
clean: 
	# remove intermediate file
	rm -f *.o OrigSrcAndTest OrigSrcAndTest.c NewSrcAndTest NewSrcAndTest.c
