# common switch make

all:	${MDIRS}
${MDIRS}: FORCE
	@cd $@; pwd; make

install:	FORCE
		@r=0; set -e; for d in ${MDIRS}; do \
			(cd $$d; \
			if [ $$? -ne 0 ]; then \
				echo "Bad element of MDIRS: <$$d>"; \
			else \
				pwd; \
				if ($(MAKE) install); then \
					:; \
				else \
					r=1; \
					false; \
				fi; \
			fi); \
		if [ $$r -ne 0 ]; then \
			exit $r; \
		fi; \
		>&2 echo "---- Compiled test package: [$$d]"; \
		done

clean:	FORCE
		@for d in ${MDIRS}; do \
			(cd $$d; \
			if [ $$? -ne 0 ]; then \
				echo "Bad element of MDIRS: <$$d>"; \
			else \
				pwd; make clean; \
			fi); \
		done

clobber:	FORCE
		@for d in ${MDIRS}; do \
			(cd $$d; \
			if [ $$? -ne 0 ]; then \
				echo "Bad element of MDIRS: <$$d>"; \
			else \
				pwd; make clobber; \
			fi); \
		done

FORCE:
