blob: 3fee600d60cffa88c8144ff162e1ac23afb8b08e [file] [log] [blame]
export V ?= 0
-include conf.mk
OUTPUT_DIR := $(CURDIR)/out
EXAMPLE_DIR := $(CURDIR)/../../marvell/services/optee_app/out
EXAMPLE_LIST := $(subst /,,$(dir $(wildcard */Makefile)))
.PHONY: all
all: examples prepare-for-rootfs
.PHONY: clean
clean: examples-clean prepare-for-rootfs-clean
examples:
@for example in $(EXAMPLE_LIST); do \
$(MAKE) -C $$example CROSS_COMPILE="$(HOST_CROSS_COMPILE)" TA_CROSS_COMPILE=$(TA_CROSS_COMPILE) \
TEEC_EXPORT=$(TEEC_EXPORT) TA_DEV_KIT_DIR=$(TA_DEV_KIT_DIR) PLATFORM=asr|| exit 1; \
done
examples-clean:
@echo `pwd`
@for example in $(EXAMPLE_LIST); do \
$(MAKE) -C $$example TEEC_EXPORT=$(TEEC_EXPORT) TA_DEV_KIT_DIR=$(TA_DEV_KIT_DIR) clean || exit 1; \
done
prepare-for-rootfs: examples
@echo "Copying example CA and TA binaries to $(OUTPUT_DIR)..."
@mkdir -p $(OUTPUT_DIR)
@mkdir -p $(OUTPUT_DIR)/ta
@mkdir -p $(OUTPUT_DIR)/ca
@for example in $(EXAMPLE_LIST); do \
if [ -e $$example/host/optee_example_$$example ]; then \
cp -p $$example/host/optee_example_$$example $(OUTPUT_DIR)/ca/; \
fi; \
cp -pr $$example/ta/*.ta $(OUTPUT_DIR)/ta/; \
echo "Copying ca and ta files to marvell/services/optee_app/out..."; \
cp -pr $(OUTPUT_DIR)/ca/* $(ASR_OWRT_DIR)/marvell/services/optee_app/out/ca/; \
cp -pr $(OUTPUT_DIR)/ta/*.ta $(ASR_OWRT_DIR)/marvell/services/optee_app/out/ta/; \
done
prepare-for-rootfs-clean:
@rm -rf $(OUTPUT_DIR)/ta
@rm -rf $(OUTPUT_DIR)/ca
@rm -rf $(OUTPUT_DIR)/plugins
@rmdir --ignore-fail-on-non-empty $(OUTPUT_DIR) || test ! -e $(OUTPUT_DIR)