include $(SRCTOP)/Makefile.vars

.PHONY: all clean depend headers install subdirs

all:
	if [ "$(PROJECT.TESTDIRS)" != "" ]; then sh -c 'for lib in $(PROJECT.TESTDIRS); do $(MAKE) -C $$lib all || exit; done;'; fi
     
depend:
	if [ "$(PROJECT.TESTDIRS)" != "" ]; then sh -c 'for lib in $(PROJECT.TESTDIRS); do $(MAKE) -C $$lib depend || exit; done;'; fi

install:
	if [ "$(PROJECT.TESTDIRS)" != "" ]; then sh -c 'for lib in $(PROJECT.TESTDIRS); do $(MAKE) -C $$lib install || exit; done;'; fi

reset:
	@pwd | grep -v MASTER > /dev/null || (echo "make: can't make reset in source directory" && exit 1)
	$(RM) -r *
	ln -s $(SRCTOP)/test/Makefile.src Makefile
	$(MAKE) subdirs

subdirs:
	if [ "$(PROJECT.TESTDIRS)" != "" ]; then sh -c 'for lib in $(PROJECT.TESTDIRS); do mkdir $$lib; ln -s $(SRCTOP)/test/$$lib/Makefile.src $$lib/Makefile; touch $$lib/Makefile.deps; done;'; fi
