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 O=$(out-dir) 53 54.PHONY: clean 55ifneq ($(wildcard $(TA_DEV_KIT_DIR)/host_include/conf.mk),) 56clean: 57 $(q)$(MAKE) -C host/xtest O=$(out-dir) $@ 58 $(q)$(MAKE) -C ta O=$(out-dir) $@ 59 $(q)$(MAKE) -C host/supp_plugin O=$(out-dir) $@ 60else 61clean: 62 $(q)echo "TA_DEV_KIT_DIR is not correctly defined" 63 $(q)echo "You can remove manually $(out-dir)" 64endif 65 66.PHONY: checkpatch checkpatch-staging checkpatch-working 67checkpatch: checkpatch-staging checkpatch-working 68 69checkpatch-working: 70 @./scripts/checkpatch.sh 71 72checkpatch-staging: 73 @./scripts/checkpatch.sh --cached 74 75install: 76 $(echo) ' INSTALL ${DESTDIR}/lib/optee_armtz' 77 $(q)mkdir -p ${DESTDIR}/lib/optee_armtz 78 $(q)find $(out-dir) -name \*.ta -exec cp -a {} ${DESTDIR}/lib/optee_armtz \; 79 $(echo) ' INSTALL ${DESTDIR}/bin' 80 $(q)mkdir -p ${DESTDIR}/bin 81 $(q)cp -a $(out-dir)/xtest/xtest ${DESTDIR}/bin 82 $(echo) ' INSTALL ${DESTDIR}/$(CFG_TEE_PLUGIN_LOAD_PATH)' 83 $(q)mkdir -p ${DESTDIR}/$(CFG_TEE_PLUGIN_LOAD_PATH) 84 $(q)cp $(out-dir)/supp_plugin/*.plugin ${DESTDIR}/$(CFG_TEE_PLUGIN_LOAD_PATH) 85 86.PHONY: cscope 87cscope: 88 $(echo) ' CSCOPE .' 89 ${q}rm -f cscope.* 90 ${q}find $(PWD) -name "*.[ch]" -o -name "*.cpp" | grep -v /package/ > cscope.files 91 ${q}cscope -b -q -k 92