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	   sha_perf \
32	   aes_perf \
33	   socket \
34	   supp_plugin \
35	   large
36
37ifeq ($(CFG_SECURE_DATA_PATH),y)
38TA_DIRS += sdp_basic
39endif
40
41ifeq ($(CFG_TA_BTI),y)
42TA_DIRS += bti_test
43endif
44
45.PHONY: all
46all: ta
47
48.PHONY: ta
49ta:
50	$(q)$(foreach dir,$(TA_DIRS), $(MAKE) -C $(dir) O=$(out-dir)/ta/$(dir) &&) true
51
52# remove build directories including ta/<ta-name>/ directories.
53# Note: $(out-dir) may be a relative path.
54RMDIR := rmdir --ignore-fail-on-non-empty
55define rm-build-subdir
56echo `[ -d $1 ] && { cd $1; $(RMDIR) $(out-dir)/ta $(out-dir) 2> /dev/null; true; }` > /dev/null
57endef
58
59.PHONY: clean
60clean:
61	$(q)$(foreach dir,$(TA_DIRS), [ ! -d $(dir) ] || $(MAKE) -C $(dir) O=$(out-dir)/ta/$(dir) $@ &&) true
62	$(q)$(foreach dir,$(TA_DIRS), $(call rm-build-subdir,$(dir));)
63