Support #1725: Improving pup_stl testing
[charm.git] / examples / charm++ / PUP / Makefile
index 9607b63dad5cf24f5ed4b9a0c7f601da7b44fca8..4979d45da0fea17580443841b61e10ce851a7778 100644 (file)
@@ -1,25 +1,44 @@
 -include ../../common.mk
 CHARMC=../../../bin/charmc $(OPTS)
 
-OBJS = SimplePUP.o
+DIRS = \
+  STLPUP \
 
-all: SimplePUP
+TESTDIRS = $(DIRS)
 
-SimplePUP: $(OBJS)
-       $(CHARMC) -language charm++ -o SimplePUP $(OBJS)
+all: SimplePUP $(foreach i,$(DIRS),build-$i)
 
-SimplePUP.decl.h: SimplePUP.ci
-       $(CHARMC)  SimplePUP.ci
+test: test-SimplePUP $(foreach i,$(TESTDIRS),test-$i)
+
+bgtest: bgtest-SimplePUP $(foreach i,$(TESTDIRS),bgtest-$i)
 
-clean:
+clean: $(foreach i,$(DIRS),clean-$i)
        rm -f *.decl.h *.def.h conv-host *.o SimplePUP charmrun
 
+$(foreach i,$(DIRS),build-$i):
+       $(MAKE) -C $(subst build-,,$@) all OPTS='$(OPTS)'
+
+$(foreach i,$(DIRS),test-$i):
+       $(MAKE) -C $(subst test-,,$@) test OPTS='$(OPTS)' TESTOPTS='$(TESTOPTS)'
+
+$(foreach i,$(DIRS),bgtest-$i):
+       $(MAKE) -C $(subst bgtest-,,$@) bgtest OPTS='$(OPTS)' TESTOPTS='$(TESTOPTS)'
+
+$(foreach i,$(DIRS),clean-$i):
+       $(MAKE) -C $(subst clean-,,$@) clean OPTS='$(OPTS)'
+
+SimplePUP: SimplePUP.o
+       $(CHARMC) -language charm++ -o $@ $^
+
+SimplePUP.decl.h: SimplePUP.ci
+       $(CHARMC) $<
+
 SimplePUP.o: SimplePUP.C SimplePUP.h SimpleObject.h SimplePUP.decl.h
-       $(CHARMC) -c SimplePUP.C
+       $(CHARMC) -c $<
 
-test: all
-       $(call run, ./SimplePUP +p4  )
-       $(call run, ./SimplePUP +p4  )
+test-SimplePUP: SimplePUP
+       $(call run, ./SimplePUP +p4)
+       $(call run, ./SimplePUP +p4)
 
-bgtest: all
+bgtest-SimplePUP: SimplePUP
        $(call run, ./SimplePUP +p4 +x2 +y2 +z1)