blob: 9fb6b46a86a6c7207d674830881227c7f73fc1e9 [file] [log] [blame]
Etienne Carriered3cb2762017-11-09 15:45:53 +01001export V ?= 0
Igor Opaniuk06fe31c2017-08-07 02:37:51 +03002
3OUTPUT_DIR := $(CURDIR)/out
Etienne Carriered3cb2762017-11-09 15:45:53 +01004
5EXAMPLE_LIST := hello_world
6EXAMPLE_LIST += random
Igor Opaniuk06fe31c2017-08-07 02:37:51 +03007
8.PHONY: all
9all: examples prepare-for-rootfs
10
11.PHONY: clean
12clean: examples-clean prepare-for-rootfs-clean
13
14examples:
Etienne Carriered3cb2762017-11-09 15:45:53 +010015 @for example in $(EXAMPLE_LIST); do \
Igor Opaniuk06fe31c2017-08-07 02:37:51 +030016 $(MAKE) -C $$example CROSS_COMPILE="$(HOST_CROSS_COMPILE)"; \
17 done
18
19examples-clean:
Etienne Carriered3cb2762017-11-09 15:45:53 +010020 @for example in $(EXAMPLE_LIST); do \
Igor Opaniuk06fe31c2017-08-07 02:37:51 +030021 $(MAKE) -C $$example clean; \
22 done
23
24prepare-for-rootfs: examples
Etienne Carriered3cb2762017-11-09 15:45:53 +010025 @echo "Copying example CA and TA binaries to $(OUTPUT_DIR)..."
Igor Opaniuk06fe31c2017-08-07 02:37:51 +030026 @mkdir -p $(OUTPUT_DIR)
27 @mkdir -p $(OUTPUT_DIR)/ta
28 @mkdir -p $(OUTPUT_DIR)/ca
29 @for example in $(EXAMPLE_LIST); do \
Etienne Carriered3cb2762017-11-09 15:45:53 +010030 if [ -e $$example/host/optee_example_$$example ]; then \
31 cp -p $$example/host/optee_example_$$example $(OUTPUT_DIR)/ca/; \
Igor Opaniuk06fe31c2017-08-07 02:37:51 +030032 fi; \
33 cp -pr $$example/ta/*.ta $(OUTPUT_DIR)/ta/; \
34 done
35
36prepare-for-rootfs-clean:
Etienne Carriered3cb2762017-11-09 15:45:53 +010037 @rm -rf $(OUTPUT_DIR)/ta
38 @rm -rf $(OUTPUT_DIR)/ca
39 @rmdir --ignore-fail-on-non-empty $(OUTPUT_DIR) || test ! -e $(OUTPUT_DIR)