1# 2# Reference http://www.gnu.org/software/make/manual/make.html 3# 4CONFIG_USE_LOGCAT = true 5 6MAKE = make -j32 7 8exclude_dirs := include bin 9 10ifneq ($(CONFIG_USE_LOGCAT), true) 11exclude_dirs += ./liblog% ./logcat% 12else 13DEFINES += -DUSE_LOGCAT 14LOGCAT = logcat 15endif 16 17dirs := $(shell find . -maxdepth 1 -type d) 18dirs := $(basename $(patsubst ./%,%,$(dirs))) 19dirs := $(filter-out $(exclude_dirs),$(dirs)) 20SUBDIRS := $(dirs) 21 22all: 23 for dir in $(SUBDIRS); do \ 24 $(MAKE) -C $$dir ;\ 25 if [ "$$?" != "0" ]; then\ 26 echo "compile $$dir fail"; \ 27 exit 1 ; \ 28 fi;\ 29 done 30 31.PHONY: clean distclean cleanall 32$(SUBDIRS):ECHO 33 +$(MAKE) -C $@ 34ECHO: 35 @echo begin compile $(SUBDIRS) 36 37clean: $(clean_dirs) 38 for dir in $(SUBDIRS);\ 39 do $(MAKE) -C $$dir clean;\ 40 done 41 rm -rf bin 42 43install: 44 for dir in $(SUBDIRS);\ 45 do $(MAKE) -C $$dir install;\ 46 done 47 48distclean: 49 for dir in $(SUBDIRS);\ 50 do $(MAKE) -C $$dir distclean;\ 51 done 52 53cleanall: 54 for dir in $(SUBDIRS);\ 55 do $(MAKE) -C $$dir cleanall;\ 56 done 57