# Set up the path to the "mops" script
MOPS_HOME = ..
MOPS_BIN = $(MOPS_HOME)/bin/mops

# Let MAKE use "mops" instead of gcc
TEMP_DIR = temp
OUTPUT_DIR = output
RUN_LEVEL = trace
VERBOSITY = warn
CC = $(MOPS_BIN) -m $(MFSA) -r $(RUN_LEVEL) -o $(OUTPUT_DIR) -t $(TEMP_DIR) -v $(VERBOSITY) \
      -- gcc

# Specify which property to use for each program
hello hello2 : MFSA = setuidunsafe.mfsa

open1 open2 : MFSA = open.mfsa

merge : MFSA = setuidunsafe.mfsa

commit : MFSA = commit.mfsa

# Now specify how to build the executables, the same way as when not
# running MOPS.  Note that we don't need to specify how to build hello,
# hello2, open1, and open2 because we can rely on implicit rules for
# building them.

TARGETS = hello hello2 open1 open2 merge commit

all : $(TARGETS)

merge : merge1.o merge2.o
	$(CC) -o $@ $^

commit : commit1.o commit2.o
	$(CC) -o $@ $^

# Clean up
.PHONY : clean distclean

clean:
	-rm -f $(TARGETS) *.o
	-rm -rf $(TEMP_DIR)
	-rm -rf $(OUTPUT_DIR)

distclean: clean
