1export V ?= 0 2 3OUTPUT_DIR := $(CURDIR)/out 4 5EXAMPLE_LIST := $(subst /,,$(dir $(wildcard */Makefile))) 6 7.PHONY: all 8all: examples prepare-for-rootfs 9 10.PHONY: clean 11clean: examples-clean prepare-for-rootfs-clean 12 13examples: 14 @for example in $(EXAMPLE_LIST); do \ 15 $(MAKE) -C $$example CROSS_COMPILE="$(HOST_CROSS_COMPILE)" || exit 1; \ 16 done 17 18examples-clean: 19 @for example in $(EXAMPLE_LIST); do \ 20 $(MAKE) -C $$example clean || exit 1; \ 21 done 22 23prepare-for-rootfs: examples 24 @echo "Copying example CA and TA binaries to $(OUTPUT_DIR)..." 25 @mkdir -p $(OUTPUT_DIR) 26 @mkdir -p $(OUTPUT_DIR)/ta 27 @mkdir -p $(OUTPUT_DIR)/ca 28 @mkdir -p $(OUTPUT_DIR)/plugins 29 @for example in $(EXAMPLE_LIST); do \ 30 if [ -e $$example/host/optee_example_$$example ]; then \ 31 cp -p $$example/host/optee_example_$$example $(OUTPUT_DIR)/ca/; \ 32 fi; \ 33 cp -pr $$example/ta/*.ta $(OUTPUT_DIR)/ta/; \ 34 if [ $$example == plugins ]; then \ 35 cp -p plugins/syslog/*.plugin $(OUTPUT_DIR)/plugins/; \ 36 fi; \ 37 done 38 39prepare-for-rootfs-clean: 40 @rm -rf $(OUTPUT_DIR)/ta 41 @rm -rf $(OUTPUT_DIR)/ca 42 @rm -rf $(OUTPUT_DIR)/plugins 43 @rmdir --ignore-fail-on-non-empty $(OUTPUT_DIR) || test ! -e $(OUTPUT_DIR) 44