This is an automated email from the ASF dual-hosted git repository.

yuanz pushed a commit to branch no-std
in repository 
https://gitbox.apache.org/repos/asf/incubator-teaclave-trustzone-sdk.git

commit 0d5e28551d0c8a5d419539788485fc5170c2a889
Author: Sumit Garg <[email protected]>
AuthorDate: Mon Jan 8 18:16:19 2024 +0530

    Makefile: Standardize rust examples install target
    
    After this change, install directory looks like:
    
    out/
    ├── lib
    │   └── optee_armtz
    │       ├── 057f4b66-bdab-11eb-96cf-33d6e41cc849.ta
    │       ├── 0864c8ec-bdab-11eb-8926-c7fa47a8c92d.ta
    │       ├── 0a5a06b2-bdab-11eb-add0-77f29de31296.ta
    │       ├── 0bef16a2-bdab-11eb-94be-6f9815f37c21.ta
    │       ├── 0e6bf4fe-bdab-11eb-9bc5-3f4ecb50aee7.ta
    │       ├── 10de87e2-bdab-11eb-b73c-63fec73e597c.ta
    │       ├── 133af0ca-bdab-11eb-9130-43bf7873bf67.ta
    │       ├── 1585d412-bdab-11eb-ba91-3b085fd2601f.ta
    │       ├── 197c710c-bdab-11eb-8f3f-17a5f698d23b.ta
    │       ├── 1cd6d392-bdab-11eb-9082-abc902ac5cd4.ta
    │       ├── 21b1a1da-bdab-11eb-b614-275a7098826f.ta
    │       ├── 255fc838-de89-42d3-9a8e-d044c50fa57c.ta
    │       └── c7e478c2-89b3-46eb-ac19-571e66c3830d.ta
    └── usr
        ├── bin
        │   ├── acipher-rs
        │   ├── aes-rs
        │   ├── authentication-rs
        │   ├── big_int-rs
        │   ├── diffie_hellman-rs
        │   ├── digest-rs
        │   ├── hello_world-rs
        │   ├── hotp-rs
        │   ├── random-rs
        │   ├── secure_storage-rs
        │   ├── signature_verification-rs
        │   ├── supp_plugin-rs
        │   └── time-rs
        └── lib
            └── tee-supplicant
                └── plugins
                    └── ef620757-fa2b-4f19-a1c4-6e51cfe4c0f9.plugin.so
    
    Signed-off-by: Sumit Garg <[email protected]>
---
 Makefile | 33 +++++++++++++++++++++------------
 1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/Makefile b/Makefile
index 3654165..700cd26 100644
--- a/Makefile
+++ b/Makefile
@@ -15,6 +15,15 @@
 # specific language governing permissions and limitations
 # under the License.
 
+ifeq ($(O),)
+out-dir := $(CURDIR)/out
+else
+out-dir := $(O)
+endif
+
+bindir ?= /usr/bin
+libdir ?= /usr/lib
+
 ifneq ($V,1)
        q := @
        echo := @echo
@@ -26,7 +35,6 @@ endif
 export q
 
 EXAMPLES = $(wildcard examples/*)
-EXAMPLES_INSTALL = $(EXAMPLES:%=%-install)
 EXAMPLES_CLEAN  = $(EXAMPLES:%=%-clean)
 
 TARGET ?= aarch64-unknown-linux-gnu
@@ -39,9 +47,9 @@ CROSS_COMPILE_TA ?= $(CROSS_COMPILE)
 TARGET_HOST ?= $(TARGET)
 TARGET_TA ?= $(TARGET)
 
-.PHONY: all
+.PHONY: all examples $(EXAMPLES) install clean
 ifneq ($(wildcard $(TA_DEV_KIT_DIR)/host_include/conf.mk),)
-all: examples examples-install
+all: examples
 else
 all:
        $(q)echo "TA_DEV_KIT_DIR is not correctly defined" && false
@@ -56,13 +64,16 @@ $(EXAMPLES):
                TA_DEV_KIT_DIR=$(TA_DEV_KIT_DIR) \
                OPTEE_CLIENT_EXPORT=$(OPTEE_CLIENT_EXPORT)
 
-examples-install: $(EXAMPLES_INSTALL)
-$(EXAMPLES_INSTALL): examples
-       install -D 
$(@:%-install=%)/host/target/$(TARGET_HOST)/release/$(@:examples/%-install=%) 
-t out/host/
-       install -D $(@:%-install=%)/ta/target/$(TARGET_TA)/release/*.ta -t 
out/ta/
-       $(q)if [ -d "$(@:%-install=%)/plugin/target/" ]; then \
-               install -D 
$(@:%-install=%)/plugin/target/$(TARGET_HOST)/release/*.plugin.so -t 
out/plugin/; \
-       fi
+install: examples
+       $(echo) '  INSTALL ${out-dir}/lib/optee_armtz'
+       $(q)mkdir -p ${out-dir}/lib/optee_armtz
+       $(q)find examples/*/ta/target/$(TARGET_TA)/ -name *.ta -exec cp {} 
${out-dir}/lib/optee_armtz \;
+       $(echo) '  INSTALL ${out-dir}${bindir}'
+       $(q)mkdir -p ${out-dir}${bindir}
+       $(q)cp examples/*/host/target/$(TARGET_HOST)/release/*-rs 
${out-dir}${bindir}
+       $(echo) '  INSTALL ${out-dir}${libdir}/tee-supplicant/plugins/'
+       $(q)mkdir -p ${out-dir}${libdir}/tee-supplicant/plugins/
+       $(q)find examples/*/plugin/target/$(TARGET_HOST)/ -name *.plugin.so 
-exec cp {} ${out-dir}${libdir}/tee-supplicant/plugins/ \;
 
 examples-clean: $(EXAMPLES_CLEAN) out-clean
 $(EXAMPLES_CLEAN):
@@ -71,6 +82,4 @@ $(EXAMPLES_CLEAN):
 out-clean:
        rm -rf out
 
-.PHONY: clean $(EXAMPLES) $(EXAMPLES_CLEAN)
-
 clean: $(EXAMPLES_CLEAN) out-clean


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to