1ifeq ($O,) 2out-dir := $(CURDIR)/out 3else 4include scripts/common.mk 5out-dir := $(call strip-trailing-slashes-and-dots,$(O)) 6ifeq ($(out-dir),) 7$(error invalid output directory (O=$(O))) 8endif 9endif 10 11-include $(TA_DEV_KIT_DIR)/host_include/conf.mk 12-include $(OPTEE_CLIENT_EXPORT)/include/optee_client_config.mk 13 14ifneq ($V,1) 15 q := @ 16 echo := @echo 17else 18 q := 19 echo := @: 20endif 21# export 'q', used by sub-makefiles. 22export q 23 24# If _HOST or _TA specific compilers are not specified, then use CROSS_COMPILE 25CROSS_COMPILE_HOST ?= $(CROSS_COMPILE) 26CROSS_COMPILE_TA ?= $(CROSS_COMPILE) 27 28.PHONY: all 29ifneq ($(wildcard $(TA_DEV_KIT_DIR)/host_include/conf.mk),) 30all: xtest ta test_plugin 31else 32all: 33 $(q)echo "TA_DEV_KIT_DIR is not correctly defined" && false 34endif 35 36.PHONY: xtest 37xtest: 38 $(q)$(MAKE) -C host/xtest CROSS_COMPILE="$(CROSS_COMPILE_HOST)" \ 39 --no-builtin-variables \ 40 O=$(out-dir) \ 41 $@ 42 43.PHONY: ta 44ta: 45 $(q)$(MAKE) -C ta CROSS_COMPILE="$(CROSS_COMPILE_TA)" \ 46 O=$(out-dir) \ 47 $@ 48 49.PHONY: test_plugin 50test_plugin: 51 $(q)$(MAKE) -C host/supp_plugin CROSS_COMPILE="$(CROSS_COMPILE_HOST)" \ 52 --no-builtin-variables \ 53 O=$(out-dir) 54 55.PHONY: clean 56ifneq ($(wildcard $(TA_DEV_KIT_DIR)/host_include/conf.mk),) 57clean: 58 $(q)$(MAKE) -C host/xtest O=$(out-dir) $@ 59 $(q)$(MAKE) -C ta O=$(out-dir) $@ 60 $(q)$(MAKE) -C host/supp_plugin O=$(out-dir) $@ 61else 62clean: 63 $(q)echo "TA_DEV_KIT_DIR is not correctly defined" 64 $(q)echo "You can remove manually $(out-dir)" 65endif 66 67.PHONY: checkpatch checkpatch-staging checkpatch-working 68checkpatch: checkpatch-staging checkpatch-working 69 70checkpatch-working: 71 @./scripts/checkpatch.sh 72 73checkpatch-staging: 74 @./scripts/checkpatch.sh --cached 75 76install: 77 $(echo) ' INSTALL ${DESTDIR}/lib/optee_armtz' 78 $(q)mkdir -p ${DESTDIR}/lib/optee_armtz 79 $(q)find $(out-dir) -name \*.ta -exec cp {} ${DESTDIR}/lib/optee_armtz \; 80 $(echo) ' INSTALL ${DESTDIR}/bin' 81 $(q)mkdir -p ${DESTDIR}/bin 82 $(q)cp $(out-dir)/xtest/xtest ${DESTDIR}/bin 83 $(echo) ' INSTALL ${DESTDIR}/$(CFG_TEE_PLUGIN_LOAD_PATH)' 84 $(q)mkdir -p ${DESTDIR}/$(CFG_TEE_PLUGIN_LOAD_PATH) 85 $(q)cp $(out-dir)/supp_plugin/*.plugin ${DESTDIR}/$(CFG_TEE_PLUGIN_LOAD_PATH) 86 87.PHONY: cscope 88cscope: 89 $(echo) ' CSCOPE .' 90 ${q}rm -f cscope.* 91 ${q}find $(PWD) -name "*.[ch]" -o -name "*.cpp" | grep -v /package/ > cscope.files 92 ${q}cscope -b -q -k 93