b.liu | d440f9f | 2025-04-18 10:44:31 +0800 | [diff] [blame] | 1 | export V ?= 0 |
| 2 | |
| 3 | -include conf.mk |
| 4 | |
| 5 | OUTPUT_DIR := $(CURDIR)/out |
| 6 | |
| 7 | EXAMPLE_DIR := $(CURDIR)/../../marvell/services/optee_app/out |
| 8 | |
| 9 | EXAMPLE_LIST := $(subst /,,$(dir $(wildcard */Makefile))) |
| 10 | |
| 11 | .PHONY: all |
| 12 | all: examples prepare-for-rootfs |
| 13 | |
| 14 | .PHONY: clean |
| 15 | clean: examples-clean prepare-for-rootfs-clean |
| 16 | |
| 17 | examples: |
| 18 | @for example in $(EXAMPLE_LIST); do \ |
| 19 | $(MAKE) -C $$example CROSS_COMPILE="$(HOST_CROSS_COMPILE)" TA_CROSS_COMPILE=$(TA_CROSS_COMPILE) \ |
| 20 | TEEC_EXPORT=$(TEEC_EXPORT) TA_DEV_KIT_DIR=$(TA_DEV_KIT_DIR) PLATFORM=asr|| exit 1; \ |
| 21 | done |
| 22 | |
| 23 | examples-clean: |
| 24 | @echo `pwd` |
| 25 | @for example in $(EXAMPLE_LIST); do \ |
| 26 | $(MAKE) -C $$example TEEC_EXPORT=$(TEEC_EXPORT) TA_DEV_KIT_DIR=$(TA_DEV_KIT_DIR) clean || exit 1; \ |
| 27 | done |
| 28 | |
| 29 | prepare-for-rootfs: examples |
| 30 | @echo "Copying example CA and TA binaries to $(OUTPUT_DIR)..." |
| 31 | @mkdir -p $(OUTPUT_DIR) |
| 32 | @mkdir -p $(OUTPUT_DIR)/ta |
| 33 | @mkdir -p $(OUTPUT_DIR)/ca |
| 34 | @for example in $(EXAMPLE_LIST); do \ |
| 35 | if [ -e $$example/host/optee_example_$$example ]; then \ |
| 36 | cp -p $$example/host/optee_example_$$example $(OUTPUT_DIR)/ca/; \ |
| 37 | fi; \ |
| 38 | cp -pr $$example/ta/*.ta $(OUTPUT_DIR)/ta/; \ |
| 39 | echo "Copying ca and ta files to marvell/services/optee_app/out..."; \ |
| 40 | cp -pr $(OUTPUT_DIR)/ca/* $(ASR_OWRT_DIR)/marvell/services/optee_app/out/ca/; \ |
| 41 | cp -pr $(OUTPUT_DIR)/ta/*.ta $(ASR_OWRT_DIR)/marvell/services/optee_app/out/ta/; \ |
| 42 | done |
| 43 | |
| 44 | prepare-for-rootfs-clean: |
| 45 | @rm -rf $(OUTPUT_DIR)/ta |
| 46 | @rm -rf $(OUTPUT_DIR)/ca |
| 47 | @rm -rf $(OUTPUT_DIR)/plugins |
| 48 | @rmdir --ignore-fail-on-non-empty $(OUTPUT_DIR) || test ! -e $(OUTPUT_DIR) |