-
Notifications
You must be signed in to change notification settings - Fork 141
/
Makefile
43 lines (35 loc) · 1.14 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
export V ?= 0
OUTPUT_DIR := $(CURDIR)/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)" || exit 1; \
done
examples-clean:
@for example in $(EXAMPLE_LIST); do \
$(MAKE) -C $$example 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
@mkdir -p $(OUTPUT_DIR)/plugins
@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/; \
if [ $$example = plugins ]; then \
cp -p plugins/syslog/*.plugin $(OUTPUT_DIR)/plugins/; \
fi; \
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)