Etienne Carriere | 3ddc362 | 2017-03-13 15:31:15 +0100 | [diff] [blame] | 1 | ifeq ($O,) |
| 2 | out-dir := $(CURDIR)/out |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 3 | else |
Etienne Carriere | 3ddc362 | 2017-03-13 15:31:15 +0100 | [diff] [blame] | 4 | include scripts/common.mk |
| 5 | out-dir := $(call strip-trailing-slashes-and-dots,$(O)) |
| 6 | ifeq ($(out-dir),) |
| 7 | $(error invalid output directory (O=$(O))) |
| 8 | endif |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 9 | endif |
| 10 | |
Pascal Brand | e0d1841 | 2015-10-13 12:53:58 +0200 | [diff] [blame] | 11 | -include $(TA_DEV_KIT_DIR)/host_include/conf.mk |
Ricardo Salveti | afb915b | 2021-04-27 17:34:06 -0300 | [diff] [blame] | 12 | -include $(OPTEE_CLIENT_EXPORT)/include/optee_client_config.mk |
Cedric Chaumont | 1390f3a | 2015-08-31 13:55:16 +0200 | [diff] [blame] | 13 | |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 14 | ifneq ($V,1) |
| 15 | q := @ |
Jerome Forissier | 2a1ef2c | 2016-06-15 11:07:27 +0200 | [diff] [blame] | 16 | echo := @echo |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 17 | else |
| 18 | q := |
Jerome Forissier | 2a1ef2c | 2016-06-15 11:07:27 +0200 | [diff] [blame] | 19 | echo := @: |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 20 | endif |
Etienne Carriere | 3ddc362 | 2017-03-13 15:31:15 +0100 | [diff] [blame] | 21 | # export 'q', used by sub-makefiles. |
| 22 | export q |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 23 | |
Andrew F. Davis | 04b0359 | 2016-08-08 15:05:04 -0500 | [diff] [blame] | 24 | # If _HOST or _TA specific compilers are not specified, then use CROSS_COMPILE |
| 25 | CROSS_COMPILE_HOST ?= $(CROSS_COMPILE) |
| 26 | CROSS_COMPILE_TA ?= $(CROSS_COMPILE) |
| 27 | |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 28 | .PHONY: all |
Pascal Brand | e0d1841 | 2015-10-13 12:53:58 +0200 | [diff] [blame] | 29 | ifneq ($(wildcard $(TA_DEV_KIT_DIR)/host_include/conf.mk),) |
Aleksandr Anisimov | 01f6f06 | 2021-01-19 11:02:25 +0300 | [diff] [blame] | 30 | all: xtest ta test_plugin |
Pascal Brand | e0d1841 | 2015-10-13 12:53:58 +0200 | [diff] [blame] | 31 | else |
| 32 | all: |
| 33 | $(q)echo "TA_DEV_KIT_DIR is not correctly defined" && false |
| 34 | endif |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 35 | |
| 36 | .PHONY: xtest |
| 37 | xtest: |
| 38 | $(q)$(MAKE) -C host/xtest CROSS_COMPILE="$(CROSS_COMPILE_HOST)" \ |
Sumit Garg | 0e00914 | 2015-11-04 15:34:07 -0500 | [diff] [blame] | 39 | --no-builtin-variables \ |
Etienne Carriere | 3ddc362 | 2017-03-13 15:31:15 +0100 | [diff] [blame] | 40 | O=$(out-dir) \ |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 41 | $@ |
| 42 | |
| 43 | .PHONY: ta |
| 44 | ta: |
| 45 | $(q)$(MAKE) -C ta CROSS_COMPILE="$(CROSS_COMPILE_TA)" \ |
Etienne Carriere | 3ddc362 | 2017-03-13 15:31:15 +0100 | [diff] [blame] | 46 | O=$(out-dir) \ |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 47 | $@ |
| 48 | |
Aleksandr Anisimov | 01f6f06 | 2021-01-19 11:02:25 +0300 | [diff] [blame] | 49 | .PHONY: test_plugin |
| 50 | test_plugin: |
| 51 | $(q)$(MAKE) -C host/supp_plugin CROSS_COMPILE="$(CROSS_COMPILE_HOST)" \ |
| 52 | O=$(out-dir) |
| 53 | |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 54 | .PHONY: clean |
Pascal Brand | e0d1841 | 2015-10-13 12:53:58 +0200 | [diff] [blame] | 55 | ifneq ($(wildcard $(TA_DEV_KIT_DIR)/host_include/conf.mk),) |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 56 | clean: |
Etienne Carriere | 3ddc362 | 2017-03-13 15:31:15 +0100 | [diff] [blame] | 57 | $(q)$(MAKE) -C host/xtest O=$(out-dir) $@ |
| 58 | $(q)$(MAKE) -C ta O=$(out-dir) $@ |
Aleksandr Anisimov | 01f6f06 | 2021-01-19 11:02:25 +0300 | [diff] [blame] | 59 | $(q)$(MAKE) -C host/supp_plugin O=$(out-dir) $@ |
Pascal Brand | e0d1841 | 2015-10-13 12:53:58 +0200 | [diff] [blame] | 60 | else |
| 61 | clean: |
| 62 | $(q)echo "TA_DEV_KIT_DIR is not correctly defined" |
| 63 | $(q)echo "You can remove manually $(out-dir)" |
| 64 | endif |
Pascal Brand | c639ac8 | 2015-07-02 08:53:34 +0200 | [diff] [blame] | 65 | |
Markus S. Wamser | a00bfb8 | 2018-10-16 11:20:32 +0200 | [diff] [blame] | 66 | .PHONY: checkpatch checkpatch-staging checkpatch-working |
| 67 | checkpatch: checkpatch-staging checkpatch-working |
| 68 | |
| 69 | checkpatch-working: |
| 70 | @./scripts/checkpatch.sh |
| 71 | |
| 72 | checkpatch-staging: |
| 73 | @./scripts/checkpatch.sh --cached |
| 74 | |
Jerome Forissier | 2a1ef2c | 2016-06-15 11:07:27 +0200 | [diff] [blame] | 75 | install: |
| 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 |
Aleksandr Anisimov | 01f6f06 | 2021-01-19 11:02:25 +0300 | [diff] [blame] | 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) |
Jerome Forissier | 0756671 | 2020-06-17 17:55:00 +0200 | [diff] [blame] | 85 | |
| 86 | .PHONY: cscope |
| 87 | cscope: |
| 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 |