PROJECTS := $(shell find samples -name Makefile)


%.ph_build : common/libUtilNPP.a
	make -C $(dir $*) $(MAKECMDGOALS)

%.ph_clean : 
	make -C $(dir $*) clean $(USE_DEVICE)

%.ph_clobber :
	make -C $(dir $*) clobber $(USE_DEVICE)

all:  $(addsuffix .ph_build,$(PROJECTS))
	@echo "Finished building all"

common/libUtilNPP.a:
	@make -C common/UtilNPP

tidy:
	@find * | egrep "#" | xargs rm -f
	@find * | egrep "\~" | xargs rm -f

clean: tidy $(addsuffix .ph_clean,$(PROJECTS))
	@make -C common/UtilNPP clean

clobber: clean $(addsuffix .ph_clobber,$(PROJECTS))
	@make -C common/UtilNPP clobber

