#
ifndef ESP_ROOT
$(error ESP_ROOT must be set -- Please fix the environment...)
endif
#
#
LDIR  = $(ESP_ROOT)/lib

export AIM_UTILSDIR = $(realpath ./utils)

# Some versions of make leave the '/' on utils others remove it...
DIRS = $(filter-out utils/, $(filter-out utils, $(sort $(dir $(wildcard */Makefile)))))

TESTS = $(sort $(dir $(wildcard */test/Makefile)))

.PHONY:		utils $(DIRS) $(TESTS)

default:	$(DIRS)

test: $(TESTS)

lint:		$(DIRS)
	$(MAKE) -C utils $@

dox:		$(DIRS)

doxclean:	$(DIRS)

clean:		$(DIRS) $(TESTS)
	$(MAKE) -C utils $@

cleanall:	$(DIRS) $(TESTS)
	$(MAKE) -C utils $@

utils:
	$(MAKE) -C utils


ifeq ("$(MAKECMDGOALS)","")
$(DIRS): utils
else
$(DIRS):
endif
	$(MAKE) -C $@ $(MAKECMDGOALS)

$(TESTS):
	$(MAKE) -C $@ $(MAKECMDGOALS)
	
