
OPTS= -g
CHARMC= ../../../bin/charmc $(OPTS)

all: pgm

pgm: module1/module1.o module2/module2.o
	$(CHARMC) -o pgm module1/module1.o module2/module2.o -language charm++

module1/module1.o: module1/module1.top.h module1/module1.bot.h \
		module2/module2.top.h module1/module1.C module1/module1.h
	$(CHARMC) -c module1/module1.C

module1/module1.top.h module1/module1.bot.h: module1/module1.ci
	$(CHARMC) module1/module1.ci

module2/module2.o: module2/module2.top.h module2/module2.bot.h \
		module2/module2.C
	$(CHARMC) -c module2/module2.C

module2/module2.top.h module2/module2.bot.h: module2/module2.ci
	$(CHARMC) module2/module2.ci

clean:
	\rm -f *.o conv-host hello *.top.h *.bot.h *.out
	cd module1; \rm -f *.o conv-host hello *.top.h *.bot.h *.out
	cd module2; \rm -f *.o conv-host hello *.top.h *.bot.h *.out
	rm -f pgm *.TMP.* *.headers gmon.out
	cd module1; rm -f pgm *.TMP.* *.headers gmon.out
	cd module2; rm -f pgm *.TMP.* *.headers gmon.out

vclean: clean
	rm -f TAGS  *~
	cd module1; rm -f TAGS  *~
	cd module2; rm -f TAGS  *~

projections:
	make all OPTS='$(OPTS) -execmode projections'

summary:
	make all OPTS='$(OPTS) -execmode summary'

replay:
	make all OPTS='$(OPTS) -execmode replay'

tests: all test1

test1:
	pgm +p2 > test.1.out
	diff test.1.std test.1.out
