1# Normally this makefile shouldn't be called directly and we expect the output
2# path to be on a certain location to fit together with the other OP-TEE
3# gits and helper scripts.
4
5include ../scripts/common.mk
6out-dir := $(call strip-trailing-slashes-and-dots,$(O))
7ifeq ($(out-dir),)
8$(error invalid output directory (O=$(O)))
9endif
10
11include $(TA_DEV_KIT_DIR)/mk/conf.mk
12
13# Prevent use of LDFLAGS from the environment. For example, yocto exports
14# LDFLAGS that are suitable for the client applications, not for TAs
15LDFLAGS=
16
17TA_DIRS := create_fail_test \
18	   crypt \
19	   os_test_lib \
20	   os_test_lib_dl \
21	   os_test \
22	   rpc_test \
23	   sims \
24	   miss \
25	   sims_keepalive \
26	   storage \
27	   storage2 \
28	   concurrent \
29	   concurrent_large \
30	   storage_benchmark \
31	   hash_perf \
32	   aes_perf \
33	   socket \
34	   supp_plugin \
35	   large \
36	   subkey1 \
37	   subkey2
38
39ifeq ($(CFG_SECURE_DATA_PATH),y)
40TA_DIRS += sdp_basic
41endif
42
43ifeq ($(CFG_TA_BTI),y)
44TA_DIRS += bti_test
45endif
46
47.PHONY: all
48all: ta
49
50.PHONY: ta
51ta:
52	$(q)$(foreach dir,$(TA_DIRS), $(MAKE) -C $(dir) O=$(out-dir)/ta/$(dir) &&) true
53
54# remove build directories including ta/<ta-name>/ directories.
55# Note: $(out-dir) may be a relative path.
56RMDIR := rmdir --ignore-fail-on-non-empty
57define rm-build-subdir
58echo `[ -d $1 ] && { cd $1; $(RMDIR) $(out-dir)/ta $(out-dir) 2> /dev/null; true; }` > /dev/null
59endef
60
61.PHONY: clean
62clean:
63	$(q)$(foreach dir,$(TA_DIRS), [ ! -d $(dir) ] || $(MAKE) -C $(dir) O=$(out-dir)/ta/$(dir) $@ &&) true
64	$(q)$(foreach dir,$(TA_DIRS), $(call rm-build-subdir,$(dir));)
65