TESTS=$(wildcard ??-*.sh)
TESTLOGS=$(sort $(patsubst %.sh,%.testlog,$(TESTS)))

CONTIKI=../..

tests: $(TESTLOGS)

summary: clean tests
ifeq ($(TESTS),)
	@echo No tests > $@
else
	@cat $(TESTLOGS) > $@
endif

all: cooja clean tests

%.testlog: %.sh cooja
	@bash "$(basename $@).sh" "$(CONTIKI)"

clean:
	@rm -f *.*log report summary

cooja: $(CONTIKI)/tools/cooja/dist/cooja.jar
$(CONTIKI)/tools/cooja/dist/cooja.jar:
	(cd $(CONTIKI)/tools/cooja; ant jar)