
TOP = ..
include $(TOP)/Makeconf

SUBMAKES = $(wildcard */Makefile)
MAKE_SUBDIRS = $(dir $(SUBMAKES))
INSTALL_SUBDIRS = $(filter-out Makefile, $(wildcard *))

.PHONY: all install clean $(MAKE_SUBDIRS) $(INSTALL_SUBDIRS)

all: $(MAKE_SUBDIRS)

$(MAKE_SUBDIRS):
	@cd $@ && $(MAKE) $(MAKECMDGOALS)

install: $(INSTALL_SUBDIRS)

$(INSTALL_SUBDIRS):
	@echo installing $@ to $(MPATH)/$@
	@$(INSTALLOCT) $@ $(MPATH)/$@ $(OPATH) $(XPATH)
	@$(INSTALLOCT) $@/ver$(ver) $(MPATH)/$@ $(OPATH) $(XPATH)

clean: $(MAKE_SUBDIRS)
