diff --git a/examples/acipher-rs/Makefile b/examples/acipher-rs/Makefile index c266055b..a7a3dec8 100644 --- a/examples/acipher-rs/Makefile +++ b/examples/acipher-rs/Makefile @@ -22,11 +22,17 @@ CROSS_COMPILE_TA ?= aarch64-linux-gnu- TARGET_HOST ?= aarch64-unknown-linux-gnu TARGET_TA ?= aarch64-unknown-linux-gnu -all: - $(q)make -C host TARGET_HOST=$(TARGET_HOST) \ - CROSS_COMPILE_HOST=$(CROSS_COMPILE_HOST) - $(q)make -C ta TARGET_TA=$(TARGET_TA) \ - CROSS_COMPILE_TA=$(CROSS_COMPILE_TA) +.PHONY: host ta all clean + +all: host ta + +host: + $(q)make -C host TARGET=$(TARGET_HOST) \ + CROSS_COMPILE=$(CROSS_COMPILE_HOST) + +ta: + $(q)make -C ta TARGET=$(TARGET_TA) \ + CROSS_COMPILE=$(CROSS_COMPILE_TA) clean: $(q)make -C host clean diff --git a/examples/acipher-rs/host/Makefile b/examples/acipher-rs/host/Makefile index 5c47225d..62166921 100644 --- a/examples/acipher-rs/host/Makefile +++ b/examples/acipher-rs/host/Makefile @@ -17,18 +17,18 @@ NAME := acipher-rs -TARGET_HOST ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_HOST ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_HOST)objcopy -LINKER_CFG := target.$(TARGET_HOST).linker=\"$(CROSS_COMPILE_HOST)gcc\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" -OUT_DIR := $(CURDIR)/target/$(TARGET_HOST)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release all: host strip host: - @cargo build --target $(TARGET_HOST) --release --config $(LINKER_CFG) + @cargo build --target $(TARGET) --release --config $(LINKER_CFG) strip: host @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/$(NAME) $(OUT_DIR)/$(NAME) diff --git a/examples/acipher-rs/ta/Makefile b/examples/acipher-rs/ta/Makefile index 5dab9d46..72a9cb3f 100644 --- a/examples/acipher-rs/ta/Makefile +++ b/examples/acipher-rs/ta/Makefile @@ -17,21 +17,21 @@ UUID ?= $(shell cat "../uuid.txt") -TARGET_TA ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_TA ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_TA)objcopy -LINKER_CFG := target.$(TARGET_TA).linker=\"$(CROSS_COMPILE_TA)ld.bfd\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)ld.bfd\" TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py -OUT_DIR := $(CURDIR)/target/$(TARGET_TA)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER = $(if $(STD),xargo,cargo) all: ta strip sign ta: - @$(BUILDER) build --target $(TARGET_TA) --release --config $(LINKER_CFG) + @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/aes-rs/Makefile b/examples/aes-rs/Makefile index c266055b..a7a3dec8 100644 --- a/examples/aes-rs/Makefile +++ b/examples/aes-rs/Makefile @@ -22,11 +22,17 @@ CROSS_COMPILE_TA ?= aarch64-linux-gnu- TARGET_HOST ?= aarch64-unknown-linux-gnu TARGET_TA ?= aarch64-unknown-linux-gnu -all: - $(q)make -C host TARGET_HOST=$(TARGET_HOST) \ - CROSS_COMPILE_HOST=$(CROSS_COMPILE_HOST) - $(q)make -C ta TARGET_TA=$(TARGET_TA) \ - CROSS_COMPILE_TA=$(CROSS_COMPILE_TA) +.PHONY: host ta all clean + +all: host ta + +host: + $(q)make -C host TARGET=$(TARGET_HOST) \ + CROSS_COMPILE=$(CROSS_COMPILE_HOST) + +ta: + $(q)make -C ta TARGET=$(TARGET_TA) \ + CROSS_COMPILE=$(CROSS_COMPILE_TA) clean: $(q)make -C host clean diff --git a/examples/aes-rs/host/Makefile b/examples/aes-rs/host/Makefile index 2d69124e..e1a29ce3 100644 --- a/examples/aes-rs/host/Makefile +++ b/examples/aes-rs/host/Makefile @@ -17,12 +17,12 @@ NAME := aes-rs -TARGET_HOST ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_HOST ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_HOST)objcopy -LINKER_CFG := target.$(TARGET_HOST).linker=\"$(CROSS_COMPILE_HOST)gcc\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" -OUT_DIR := $(CURDIR)/target/$(TARGET_HOST)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release all: host strip diff --git a/examples/aes-rs/ta/Makefile b/examples/aes-rs/ta/Makefile index 78ed7c86..72a9cb3f 100644 --- a/examples/aes-rs/ta/Makefile +++ b/examples/aes-rs/ta/Makefile @@ -17,22 +17,21 @@ UUID ?= $(shell cat "../uuid.txt") -CROSS_COMPILE_TA ?= aarch64-linux-gnu- -TARGET_TA ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_TA ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_TA)objcopy -LINKER_CFG := target.$(TARGET_TA).linker=\"$(CROSS_COMPILE_TA)ld.bfd\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)ld.bfd\" TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py -OUT_DIR := $(CURDIR)/target/$(TARGET_TA)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER = $(if $(STD),xargo,cargo) all: ta strip sign ta: - @$(BUILDER) build --target $(TARGET_TA) --release --config $(LINKER_CFG) + @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/authentication-rs/Makefile b/examples/authentication-rs/Makefile index c266055b..a7a3dec8 100644 --- a/examples/authentication-rs/Makefile +++ b/examples/authentication-rs/Makefile @@ -22,11 +22,17 @@ CROSS_COMPILE_TA ?= aarch64-linux-gnu- TARGET_HOST ?= aarch64-unknown-linux-gnu TARGET_TA ?= aarch64-unknown-linux-gnu -all: - $(q)make -C host TARGET_HOST=$(TARGET_HOST) \ - CROSS_COMPILE_HOST=$(CROSS_COMPILE_HOST) - $(q)make -C ta TARGET_TA=$(TARGET_TA) \ - CROSS_COMPILE_TA=$(CROSS_COMPILE_TA) +.PHONY: host ta all clean + +all: host ta + +host: + $(q)make -C host TARGET=$(TARGET_HOST) \ + CROSS_COMPILE=$(CROSS_COMPILE_HOST) + +ta: + $(q)make -C ta TARGET=$(TARGET_TA) \ + CROSS_COMPILE=$(CROSS_COMPILE_TA) clean: $(q)make -C host clean diff --git a/examples/authentication-rs/host/Makefile b/examples/authentication-rs/host/Makefile index ba4e9daa..635c835d 100644 --- a/examples/authentication-rs/host/Makefile +++ b/examples/authentication-rs/host/Makefile @@ -17,12 +17,12 @@ NAME := authentication-rs -TARGET_HOST ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_HOST ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_HOST)objcopy -LINKER_CFG := target.$(TARGET_HOST).linker=\"$(CROSS_COMPILE_HOST)gcc\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" -OUT_DIR := $(CURDIR)/target/$(TARGET_HOST)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release all: host strip diff --git a/examples/authentication-rs/ta/Makefile b/examples/authentication-rs/ta/Makefile index 78ed7c86..72a9cb3f 100644 --- a/examples/authentication-rs/ta/Makefile +++ b/examples/authentication-rs/ta/Makefile @@ -17,22 +17,21 @@ UUID ?= $(shell cat "../uuid.txt") -CROSS_COMPILE_TA ?= aarch64-linux-gnu- -TARGET_TA ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_TA ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_TA)objcopy -LINKER_CFG := target.$(TARGET_TA).linker=\"$(CROSS_COMPILE_TA)ld.bfd\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)ld.bfd\" TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py -OUT_DIR := $(CURDIR)/target/$(TARGET_TA)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER = $(if $(STD),xargo,cargo) all: ta strip sign ta: - @$(BUILDER) build --target $(TARGET_TA) --release --config $(LINKER_CFG) + @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/big_int-rs/Makefile b/examples/big_int-rs/Makefile index c266055b..a7a3dec8 100644 --- a/examples/big_int-rs/Makefile +++ b/examples/big_int-rs/Makefile @@ -22,11 +22,17 @@ CROSS_COMPILE_TA ?= aarch64-linux-gnu- TARGET_HOST ?= aarch64-unknown-linux-gnu TARGET_TA ?= aarch64-unknown-linux-gnu -all: - $(q)make -C host TARGET_HOST=$(TARGET_HOST) \ - CROSS_COMPILE_HOST=$(CROSS_COMPILE_HOST) - $(q)make -C ta TARGET_TA=$(TARGET_TA) \ - CROSS_COMPILE_TA=$(CROSS_COMPILE_TA) +.PHONY: host ta all clean + +all: host ta + +host: + $(q)make -C host TARGET=$(TARGET_HOST) \ + CROSS_COMPILE=$(CROSS_COMPILE_HOST) + +ta: + $(q)make -C ta TARGET=$(TARGET_TA) \ + CROSS_COMPILE=$(CROSS_COMPILE_TA) clean: $(q)make -C host clean diff --git a/examples/big_int-rs/host/Makefile b/examples/big_int-rs/host/Makefile index 8b29964b..0e19853b 100644 --- a/examples/big_int-rs/host/Makefile +++ b/examples/big_int-rs/host/Makefile @@ -17,12 +17,12 @@ NAME := big_int-rs -TARGET_HOST ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_HOST ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_HOST)objcopy -LINKER_CFG := target.$(TARGET_HOST).linker=\"$(CROSS_COMPILE_HOST)gcc\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" -OUT_DIR := $(CURDIR)/target/$(TARGET_HOST)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release all: host strip diff --git a/examples/big_int-rs/ta/Makefile b/examples/big_int-rs/ta/Makefile index 78ed7c86..72a9cb3f 100644 --- a/examples/big_int-rs/ta/Makefile +++ b/examples/big_int-rs/ta/Makefile @@ -17,22 +17,21 @@ UUID ?= $(shell cat "../uuid.txt") -CROSS_COMPILE_TA ?= aarch64-linux-gnu- -TARGET_TA ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_TA ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_TA)objcopy -LINKER_CFG := target.$(TARGET_TA).linker=\"$(CROSS_COMPILE_TA)ld.bfd\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)ld.bfd\" TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py -OUT_DIR := $(CURDIR)/target/$(TARGET_TA)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER = $(if $(STD),xargo,cargo) all: ta strip sign ta: - @$(BUILDER) build --target $(TARGET_TA) --release --config $(LINKER_CFG) + @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/diffie_hellman-rs/Makefile b/examples/diffie_hellman-rs/Makefile index c266055b..a7a3dec8 100644 --- a/examples/diffie_hellman-rs/Makefile +++ b/examples/diffie_hellman-rs/Makefile @@ -22,11 +22,17 @@ CROSS_COMPILE_TA ?= aarch64-linux-gnu- TARGET_HOST ?= aarch64-unknown-linux-gnu TARGET_TA ?= aarch64-unknown-linux-gnu -all: - $(q)make -C host TARGET_HOST=$(TARGET_HOST) \ - CROSS_COMPILE_HOST=$(CROSS_COMPILE_HOST) - $(q)make -C ta TARGET_TA=$(TARGET_TA) \ - CROSS_COMPILE_TA=$(CROSS_COMPILE_TA) +.PHONY: host ta all clean + +all: host ta + +host: + $(q)make -C host TARGET=$(TARGET_HOST) \ + CROSS_COMPILE=$(CROSS_COMPILE_HOST) + +ta: + $(q)make -C ta TARGET=$(TARGET_TA) \ + CROSS_COMPILE=$(CROSS_COMPILE_TA) clean: $(q)make -C host clean diff --git a/examples/diffie_hellman-rs/host/Makefile b/examples/diffie_hellman-rs/host/Makefile index 54b7c392..04cc3da6 100644 --- a/examples/diffie_hellman-rs/host/Makefile +++ b/examples/diffie_hellman-rs/host/Makefile @@ -17,12 +17,12 @@ NAME := diffie_hellman-rs -TARGET_HOST ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_HOST ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_HOST)objcopy -LINKER_CFG := target.$(TARGET_HOST).linker=\"$(CROSS_COMPILE_HOST)gcc\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" -OUT_DIR := $(CURDIR)/target/$(TARGET_HOST)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release all: host strip diff --git a/examples/diffie_hellman-rs/ta/Makefile b/examples/diffie_hellman-rs/ta/Makefile index 5dab9d46..72a9cb3f 100644 --- a/examples/diffie_hellman-rs/ta/Makefile +++ b/examples/diffie_hellman-rs/ta/Makefile @@ -17,21 +17,21 @@ UUID ?= $(shell cat "../uuid.txt") -TARGET_TA ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_TA ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_TA)objcopy -LINKER_CFG := target.$(TARGET_TA).linker=\"$(CROSS_COMPILE_TA)ld.bfd\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)ld.bfd\" TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py -OUT_DIR := $(CURDIR)/target/$(TARGET_TA)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER = $(if $(STD),xargo,cargo) all: ta strip sign ta: - @$(BUILDER) build --target $(TARGET_TA) --release --config $(LINKER_CFG) + @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/digest-rs/Makefile b/examples/digest-rs/Makefile index c266055b..a7a3dec8 100644 --- a/examples/digest-rs/Makefile +++ b/examples/digest-rs/Makefile @@ -22,11 +22,17 @@ CROSS_COMPILE_TA ?= aarch64-linux-gnu- TARGET_HOST ?= aarch64-unknown-linux-gnu TARGET_TA ?= aarch64-unknown-linux-gnu -all: - $(q)make -C host TARGET_HOST=$(TARGET_HOST) \ - CROSS_COMPILE_HOST=$(CROSS_COMPILE_HOST) - $(q)make -C ta TARGET_TA=$(TARGET_TA) \ - CROSS_COMPILE_TA=$(CROSS_COMPILE_TA) +.PHONY: host ta all clean + +all: host ta + +host: + $(q)make -C host TARGET=$(TARGET_HOST) \ + CROSS_COMPILE=$(CROSS_COMPILE_HOST) + +ta: + $(q)make -C ta TARGET=$(TARGET_TA) \ + CROSS_COMPILE=$(CROSS_COMPILE_TA) clean: $(q)make -C host clean diff --git a/examples/digest-rs/host/Makefile b/examples/digest-rs/host/Makefile index 2133e3cc..6a12c213 100644 --- a/examples/digest-rs/host/Makefile +++ b/examples/digest-rs/host/Makefile @@ -17,12 +17,12 @@ NAME := digest-rs -TARGET_HOST ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_HOST ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_HOST)objcopy -LINKER_CFG := target.$(TARGET_HOST).linker=\"$(CROSS_COMPILE_HOST)gcc\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" -OUT_DIR := $(CURDIR)/target/$(TARGET_HOST)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release all: host strip diff --git a/examples/digest-rs/ta/Makefile b/examples/digest-rs/ta/Makefile index 5dab9d46..72a9cb3f 100644 --- a/examples/digest-rs/ta/Makefile +++ b/examples/digest-rs/ta/Makefile @@ -17,21 +17,21 @@ UUID ?= $(shell cat "../uuid.txt") -TARGET_TA ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_TA ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_TA)objcopy -LINKER_CFG := target.$(TARGET_TA).linker=\"$(CROSS_COMPILE_TA)ld.bfd\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)ld.bfd\" TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py -OUT_DIR := $(CURDIR)/target/$(TARGET_TA)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER = $(if $(STD),xargo,cargo) all: ta strip sign ta: - @$(BUILDER) build --target $(TARGET_TA) --release --config $(LINKER_CFG) + @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/error_handling-rs/Makefile b/examples/error_handling-rs/Makefile index c266055b..a7a3dec8 100644 --- a/examples/error_handling-rs/Makefile +++ b/examples/error_handling-rs/Makefile @@ -22,11 +22,17 @@ CROSS_COMPILE_TA ?= aarch64-linux-gnu- TARGET_HOST ?= aarch64-unknown-linux-gnu TARGET_TA ?= aarch64-unknown-linux-gnu -all: - $(q)make -C host TARGET_HOST=$(TARGET_HOST) \ - CROSS_COMPILE_HOST=$(CROSS_COMPILE_HOST) - $(q)make -C ta TARGET_TA=$(TARGET_TA) \ - CROSS_COMPILE_TA=$(CROSS_COMPILE_TA) +.PHONY: host ta all clean + +all: host ta + +host: + $(q)make -C host TARGET=$(TARGET_HOST) \ + CROSS_COMPILE=$(CROSS_COMPILE_HOST) + +ta: + $(q)make -C ta TARGET=$(TARGET_TA) \ + CROSS_COMPILE=$(CROSS_COMPILE_TA) clean: $(q)make -C host clean diff --git a/examples/error_handling-rs/host/Makefile b/examples/error_handling-rs/host/Makefile index 0a24cdad..659d6fa0 100644 --- a/examples/error_handling-rs/host/Makefile +++ b/examples/error_handling-rs/host/Makefile @@ -17,12 +17,12 @@ NAME := error_handling-rs -TARGET_HOST ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_HOST ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_HOST)objcopy -LINKER_CFG := target.$(TARGET_HOST).linker=\"$(CROSS_COMPILE_HOST)gcc\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" -OUT_DIR := $(CURDIR)/target/$(TARGET_HOST)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release all: host strip diff --git a/examples/error_handling-rs/ta/Makefile b/examples/error_handling-rs/ta/Makefile index 78ed7c86..72a9cb3f 100644 --- a/examples/error_handling-rs/ta/Makefile +++ b/examples/error_handling-rs/ta/Makefile @@ -17,22 +17,21 @@ UUID ?= $(shell cat "../uuid.txt") -CROSS_COMPILE_TA ?= aarch64-linux-gnu- -TARGET_TA ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_TA ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_TA)objcopy -LINKER_CFG := target.$(TARGET_TA).linker=\"$(CROSS_COMPILE_TA)ld.bfd\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)ld.bfd\" TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py -OUT_DIR := $(CURDIR)/target/$(TARGET_TA)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER = $(if $(STD),xargo,cargo) all: ta strip sign ta: - @$(BUILDER) build --target $(TARGET_TA) --release --config $(LINKER_CFG) + @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/hello_world-rs/Makefile b/examples/hello_world-rs/Makefile index c266055b..a7a3dec8 100644 --- a/examples/hello_world-rs/Makefile +++ b/examples/hello_world-rs/Makefile @@ -22,11 +22,17 @@ CROSS_COMPILE_TA ?= aarch64-linux-gnu- TARGET_HOST ?= aarch64-unknown-linux-gnu TARGET_TA ?= aarch64-unknown-linux-gnu -all: - $(q)make -C host TARGET_HOST=$(TARGET_HOST) \ - CROSS_COMPILE_HOST=$(CROSS_COMPILE_HOST) - $(q)make -C ta TARGET_TA=$(TARGET_TA) \ - CROSS_COMPILE_TA=$(CROSS_COMPILE_TA) +.PHONY: host ta all clean + +all: host ta + +host: + $(q)make -C host TARGET=$(TARGET_HOST) \ + CROSS_COMPILE=$(CROSS_COMPILE_HOST) + +ta: + $(q)make -C ta TARGET=$(TARGET_TA) \ + CROSS_COMPILE=$(CROSS_COMPILE_TA) clean: $(q)make -C host clean diff --git a/examples/hello_world-rs/host/Makefile b/examples/hello_world-rs/host/Makefile index 1579bb78..039051f2 100644 --- a/examples/hello_world-rs/host/Makefile +++ b/examples/hello_world-rs/host/Makefile @@ -17,12 +17,12 @@ NAME := hello_world-rs -TARGET_HOST ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_HOST ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_HOST)objcopy -LINKER_CFG := target.$(TARGET_HOST).linker=\"$(CROSS_COMPILE_HOST)gcc\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" -OUT_DIR := $(CURDIR)/target/$(TARGET_HOST)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release all: host strip diff --git a/examples/hello_world-rs/ta/Makefile b/examples/hello_world-rs/ta/Makefile index 5dab9d46..72a9cb3f 100644 --- a/examples/hello_world-rs/ta/Makefile +++ b/examples/hello_world-rs/ta/Makefile @@ -17,21 +17,21 @@ UUID ?= $(shell cat "../uuid.txt") -TARGET_TA ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_TA ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_TA)objcopy -LINKER_CFG := target.$(TARGET_TA).linker=\"$(CROSS_COMPILE_TA)ld.bfd\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)ld.bfd\" TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py -OUT_DIR := $(CURDIR)/target/$(TARGET_TA)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER = $(if $(STD),xargo,cargo) all: ta strip sign ta: - @$(BUILDER) build --target $(TARGET_TA) --release --config $(LINKER_CFG) + @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/hotp-rs/Makefile b/examples/hotp-rs/Makefile index c266055b..a7a3dec8 100644 --- a/examples/hotp-rs/Makefile +++ b/examples/hotp-rs/Makefile @@ -22,11 +22,17 @@ CROSS_COMPILE_TA ?= aarch64-linux-gnu- TARGET_HOST ?= aarch64-unknown-linux-gnu TARGET_TA ?= aarch64-unknown-linux-gnu -all: - $(q)make -C host TARGET_HOST=$(TARGET_HOST) \ - CROSS_COMPILE_HOST=$(CROSS_COMPILE_HOST) - $(q)make -C ta TARGET_TA=$(TARGET_TA) \ - CROSS_COMPILE_TA=$(CROSS_COMPILE_TA) +.PHONY: host ta all clean + +all: host ta + +host: + $(q)make -C host TARGET=$(TARGET_HOST) \ + CROSS_COMPILE=$(CROSS_COMPILE_HOST) + +ta: + $(q)make -C ta TARGET=$(TARGET_TA) \ + CROSS_COMPILE=$(CROSS_COMPILE_TA) clean: $(q)make -C host clean diff --git a/examples/hotp-rs/host/Makefile b/examples/hotp-rs/host/Makefile index 5c38d4d7..8d5a36f1 100644 --- a/examples/hotp-rs/host/Makefile +++ b/examples/hotp-rs/host/Makefile @@ -17,12 +17,12 @@ NAME := hotp-rs -TARGET_HOST ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_HOST ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_HOST)objcopy -LINKER_CFG := target.$(TARGET_HOST).linker=\"$(CROSS_COMPILE_HOST)gcc\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" -OUT_DIR := $(CURDIR)/target/$(TARGET_HOST)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release all: host strip diff --git a/examples/hotp-rs/ta/Makefile b/examples/hotp-rs/ta/Makefile index 5dab9d46..72a9cb3f 100644 --- a/examples/hotp-rs/ta/Makefile +++ b/examples/hotp-rs/ta/Makefile @@ -17,21 +17,21 @@ UUID ?= $(shell cat "../uuid.txt") -TARGET_TA ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_TA ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_TA)objcopy -LINKER_CFG := target.$(TARGET_TA).linker=\"$(CROSS_COMPILE_TA)ld.bfd\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)ld.bfd\" TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py -OUT_DIR := $(CURDIR)/target/$(TARGET_TA)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER = $(if $(STD),xargo,cargo) all: ta strip sign ta: - @$(BUILDER) build --target $(TARGET_TA) --release --config $(LINKER_CFG) + @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/message_passing_interface-rs/Makefile b/examples/message_passing_interface-rs/Makefile index c266055b..a7a3dec8 100644 --- a/examples/message_passing_interface-rs/Makefile +++ b/examples/message_passing_interface-rs/Makefile @@ -22,11 +22,17 @@ CROSS_COMPILE_TA ?= aarch64-linux-gnu- TARGET_HOST ?= aarch64-unknown-linux-gnu TARGET_TA ?= aarch64-unknown-linux-gnu -all: - $(q)make -C host TARGET_HOST=$(TARGET_HOST) \ - CROSS_COMPILE_HOST=$(CROSS_COMPILE_HOST) - $(q)make -C ta TARGET_TA=$(TARGET_TA) \ - CROSS_COMPILE_TA=$(CROSS_COMPILE_TA) +.PHONY: host ta all clean + +all: host ta + +host: + $(q)make -C host TARGET=$(TARGET_HOST) \ + CROSS_COMPILE=$(CROSS_COMPILE_HOST) + +ta: + $(q)make -C ta TARGET=$(TARGET_TA) \ + CROSS_COMPILE=$(CROSS_COMPILE_TA) clean: $(q)make -C host clean diff --git a/examples/message_passing_interface-rs/host/Makefile b/examples/message_passing_interface-rs/host/Makefile index 94617ea0..0a6d5bce 100644 --- a/examples/message_passing_interface-rs/host/Makefile +++ b/examples/message_passing_interface-rs/host/Makefile @@ -17,15 +17,19 @@ NAME := message_passing_interface-rs -TARGET_HOST ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_HOST ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_HOST)objcopy -LINKER_CFG := target.$(TARGET_HOST).linker=\"$(CROSS_COMPILE_HOST)gcc\" - -OUT_DIR := $(CURDIR)/target/$(TARGET_HOST)/release +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" +OUT_DIR := $(CURDIR)/target/$(TARGET)/release +ifeq ($(STD),) +all: + @echo "Please export STD=y to build the STD version" +else all: host strip +endif host: @cargo build --target $(TARGET_HOST) --release --config $(LINKER_CFG) diff --git a/examples/message_passing_interface-rs/ta/Makefile b/examples/message_passing_interface-rs/ta/Makefile index 17d6e730..c01b9fd6 100644 --- a/examples/message_passing_interface-rs/ta/Makefile +++ b/examples/message_passing_interface-rs/ta/Makefile @@ -19,14 +19,14 @@ UUID ?= $(shell cat "../uuid.txt") -TARGET_TA ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_TA ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_TA)objcopy -LINKER_CFG := target.$(TARGET_TA).linker=\"$(CROSS_COMPILE_TA)ld.bfd\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)ld.bfd\" TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py -OUT_DIR := $(CURDIR)/target/$(TARGET_TA)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release ifeq ($(STD),) all: @@ -36,7 +36,7 @@ all: ta strip sign endif ta: - @xargo build --target $(TARGET_TA) --release --config $(LINKER_CFG) + @xargo build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/random-rs/Makefile b/examples/random-rs/Makefile index c266055b..a7a3dec8 100644 --- a/examples/random-rs/Makefile +++ b/examples/random-rs/Makefile @@ -22,11 +22,17 @@ CROSS_COMPILE_TA ?= aarch64-linux-gnu- TARGET_HOST ?= aarch64-unknown-linux-gnu TARGET_TA ?= aarch64-unknown-linux-gnu -all: - $(q)make -C host TARGET_HOST=$(TARGET_HOST) \ - CROSS_COMPILE_HOST=$(CROSS_COMPILE_HOST) - $(q)make -C ta TARGET_TA=$(TARGET_TA) \ - CROSS_COMPILE_TA=$(CROSS_COMPILE_TA) +.PHONY: host ta all clean + +all: host ta + +host: + $(q)make -C host TARGET=$(TARGET_HOST) \ + CROSS_COMPILE=$(CROSS_COMPILE_HOST) + +ta: + $(q)make -C ta TARGET=$(TARGET_TA) \ + CROSS_COMPILE=$(CROSS_COMPILE_TA) clean: $(q)make -C host clean diff --git a/examples/random-rs/host/Makefile b/examples/random-rs/host/Makefile index 50176bb8..56089179 100644 --- a/examples/random-rs/host/Makefile +++ b/examples/random-rs/host/Makefile @@ -17,12 +17,12 @@ NAME := random-rs -TARGET_HOST ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_HOST ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_HOST)objcopy -LINKER_CFG := target.$(TARGET_HOST).linker=\"$(CROSS_COMPILE_HOST)gcc\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" -OUT_DIR := $(CURDIR)/target/$(TARGET_HOST)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release all: host strip diff --git a/examples/random-rs/ta/Makefile b/examples/random-rs/ta/Makefile index 5dab9d46..72a9cb3f 100644 --- a/examples/random-rs/ta/Makefile +++ b/examples/random-rs/ta/Makefile @@ -17,21 +17,21 @@ UUID ?= $(shell cat "../uuid.txt") -TARGET_TA ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_TA ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_TA)objcopy -LINKER_CFG := target.$(TARGET_TA).linker=\"$(CROSS_COMPILE_TA)ld.bfd\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)ld.bfd\" TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py -OUT_DIR := $(CURDIR)/target/$(TARGET_TA)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER = $(if $(STD),xargo,cargo) all: ta strip sign ta: - @$(BUILDER) build --target $(TARGET_TA) --release --config $(LINKER_CFG) + @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/secure_storage-rs/Makefile b/examples/secure_storage-rs/Makefile index c266055b..a7a3dec8 100644 --- a/examples/secure_storage-rs/Makefile +++ b/examples/secure_storage-rs/Makefile @@ -22,11 +22,17 @@ CROSS_COMPILE_TA ?= aarch64-linux-gnu- TARGET_HOST ?= aarch64-unknown-linux-gnu TARGET_TA ?= aarch64-unknown-linux-gnu -all: - $(q)make -C host TARGET_HOST=$(TARGET_HOST) \ - CROSS_COMPILE_HOST=$(CROSS_COMPILE_HOST) - $(q)make -C ta TARGET_TA=$(TARGET_TA) \ - CROSS_COMPILE_TA=$(CROSS_COMPILE_TA) +.PHONY: host ta all clean + +all: host ta + +host: + $(q)make -C host TARGET=$(TARGET_HOST) \ + CROSS_COMPILE=$(CROSS_COMPILE_HOST) + +ta: + $(q)make -C ta TARGET=$(TARGET_TA) \ + CROSS_COMPILE=$(CROSS_COMPILE_TA) clean: $(q)make -C host clean diff --git a/examples/secure_storage-rs/host/Makefile b/examples/secure_storage-rs/host/Makefile index 40dadad3..4c28455d 100644 --- a/examples/secure_storage-rs/host/Makefile +++ b/examples/secure_storage-rs/host/Makefile @@ -17,12 +17,12 @@ NAME := secure_storage-rs -TARGET_HOST ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_HOST ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_HOST)objcopy -LINKER_CFG := target.$(TARGET_HOST).linker=\"$(CROSS_COMPILE_HOST)gcc\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" -OUT_DIR := $(CURDIR)/target/$(TARGET_HOST)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release all: host strip diff --git a/examples/secure_storage-rs/ta/Makefile b/examples/secure_storage-rs/ta/Makefile index 5dab9d46..72a9cb3f 100644 --- a/examples/secure_storage-rs/ta/Makefile +++ b/examples/secure_storage-rs/ta/Makefile @@ -17,21 +17,21 @@ UUID ?= $(shell cat "../uuid.txt") -TARGET_TA ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_TA ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_TA)objcopy -LINKER_CFG := target.$(TARGET_TA).linker=\"$(CROSS_COMPILE_TA)ld.bfd\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)ld.bfd\" TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py -OUT_DIR := $(CURDIR)/target/$(TARGET_TA)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER = $(if $(STD),xargo,cargo) all: ta strip sign ta: - @$(BUILDER) build --target $(TARGET_TA) --release --config $(LINKER_CFG) + @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/serde-rs/Makefile b/examples/serde-rs/Makefile index c266055b..a7a3dec8 100644 --- a/examples/serde-rs/Makefile +++ b/examples/serde-rs/Makefile @@ -22,11 +22,17 @@ CROSS_COMPILE_TA ?= aarch64-linux-gnu- TARGET_HOST ?= aarch64-unknown-linux-gnu TARGET_TA ?= aarch64-unknown-linux-gnu -all: - $(q)make -C host TARGET_HOST=$(TARGET_HOST) \ - CROSS_COMPILE_HOST=$(CROSS_COMPILE_HOST) - $(q)make -C ta TARGET_TA=$(TARGET_TA) \ - CROSS_COMPILE_TA=$(CROSS_COMPILE_TA) +.PHONY: host ta all clean + +all: host ta + +host: + $(q)make -C host TARGET=$(TARGET_HOST) \ + CROSS_COMPILE=$(CROSS_COMPILE_HOST) + +ta: + $(q)make -C ta TARGET=$(TARGET_TA) \ + CROSS_COMPILE=$(CROSS_COMPILE_TA) clean: $(q)make -C host clean diff --git a/examples/serde-rs/host/Makefile b/examples/serde-rs/host/Makefile index 046200c2..6e7e6acd 100644 --- a/examples/serde-rs/host/Makefile +++ b/examples/serde-rs/host/Makefile @@ -17,15 +17,19 @@ NAME := serde-rs -TARGET_HOST ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_HOST ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_HOST)objcopy -LINKER_CFG := target.$(TARGET_HOST).linker=\"$(CROSS_COMPILE_HOST)gcc\" - -OUT_DIR := $(CURDIR)/target/$(TARGET_HOST)/release +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" +OUT_DIR := $(CURDIR)/target/$(TARGET)/release +ifeq ($(STD),) +all: + @echo "Please export STD=y to build the STD version" +else all: host strip +endif host: @cargo build --target $(TARGET_HOST) --release --config $(LINKER_CFG) diff --git a/examples/serde-rs/ta/Makefile b/examples/serde-rs/ta/Makefile index 17d6e730..c01b9fd6 100644 --- a/examples/serde-rs/ta/Makefile +++ b/examples/serde-rs/ta/Makefile @@ -19,14 +19,14 @@ UUID ?= $(shell cat "../uuid.txt") -TARGET_TA ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_TA ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_TA)objcopy -LINKER_CFG := target.$(TARGET_TA).linker=\"$(CROSS_COMPILE_TA)ld.bfd\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)ld.bfd\" TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py -OUT_DIR := $(CURDIR)/target/$(TARGET_TA)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release ifeq ($(STD),) all: @@ -36,7 +36,7 @@ all: ta strip sign endif ta: - @xargo build --target $(TARGET_TA) --release --config $(LINKER_CFG) + @xargo build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/serde-rs/ta/src/main.rs b/examples/serde-rs/ta/src/main.rs index 7f239c01..19ed02ee 100644 --- a/examples/serde-rs/ta/src/main.rs +++ b/examples/serde-rs/ta/src/main.rs @@ -16,8 +16,6 @@ // under the License. #![no_main] -// this is the workaround for the error: -// error[E0658]: use of unstable library feature 'c_size_t' use optee_utee::{ ta_close_session, ta_create, ta_destroy, ta_invoke_command, ta_open_session, trace_println, diff --git a/examples/signature_verification-rs/Makefile b/examples/signature_verification-rs/Makefile index c266055b..a7a3dec8 100644 --- a/examples/signature_verification-rs/Makefile +++ b/examples/signature_verification-rs/Makefile @@ -22,11 +22,17 @@ CROSS_COMPILE_TA ?= aarch64-linux-gnu- TARGET_HOST ?= aarch64-unknown-linux-gnu TARGET_TA ?= aarch64-unknown-linux-gnu -all: - $(q)make -C host TARGET_HOST=$(TARGET_HOST) \ - CROSS_COMPILE_HOST=$(CROSS_COMPILE_HOST) - $(q)make -C ta TARGET_TA=$(TARGET_TA) \ - CROSS_COMPILE_TA=$(CROSS_COMPILE_TA) +.PHONY: host ta all clean + +all: host ta + +host: + $(q)make -C host TARGET=$(TARGET_HOST) \ + CROSS_COMPILE=$(CROSS_COMPILE_HOST) + +ta: + $(q)make -C ta TARGET=$(TARGET_TA) \ + CROSS_COMPILE=$(CROSS_COMPILE_TA) clean: $(q)make -C host clean diff --git a/examples/signature_verification-rs/host/Makefile b/examples/signature_verification-rs/host/Makefile index ef5203c0..60bf00af 100644 --- a/examples/signature_verification-rs/host/Makefile +++ b/examples/signature_verification-rs/host/Makefile @@ -17,12 +17,12 @@ NAME := signature_verification-rs -TARGET_HOST ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_HOST ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_HOST)objcopy -LINKER_CFG := target.$(TARGET_HOST).linker=\"$(CROSS_COMPILE_HOST)gcc\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" -OUT_DIR := $(CURDIR)/target/$(TARGET_HOST)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release all: host strip diff --git a/examples/signature_verification-rs/ta/Makefile b/examples/signature_verification-rs/ta/Makefile index 78ed7c86..72a9cb3f 100644 --- a/examples/signature_verification-rs/ta/Makefile +++ b/examples/signature_verification-rs/ta/Makefile @@ -17,22 +17,21 @@ UUID ?= $(shell cat "../uuid.txt") -CROSS_COMPILE_TA ?= aarch64-linux-gnu- -TARGET_TA ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_TA ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_TA)objcopy -LINKER_CFG := target.$(TARGET_TA).linker=\"$(CROSS_COMPILE_TA)ld.bfd\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)ld.bfd\" TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py -OUT_DIR := $(CURDIR)/target/$(TARGET_TA)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER = $(if $(STD),xargo,cargo) all: ta strip sign ta: - @$(BUILDER) build --target $(TARGET_TA) --release --config $(LINKER_CFG) + @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/supp_plugin-rs/Makefile b/examples/supp_plugin-rs/Makefile index d63d08e0..d18a9e99 100644 --- a/examples/supp_plugin-rs/Makefile +++ b/examples/supp_plugin-rs/Makefile @@ -22,14 +22,22 @@ CROSS_COMPILE_TA ?= aarch64-linux-gnu- TARGET_HOST ?= aarch64-unknown-linux-gnu TARGET_TA ?= aarch64-unknown-linux-gnu -all: +.PHONY: host ta plugin all clean + +all: host ta plugin + +host: $(q)make -C host TARGET=$(TARGET_HOST) \ CROSS_COMPILE=$(CROSS_COMPILE_HOST) - $(q)make -C plugin TARGET=$(TARGET_HOST) \ - CROSS_COMPILE=$(CROSS_COMPILE_HOST) + +ta: $(q)make -C ta TARGET=$(TARGET_TA) \ CROSS_COMPILE=$(CROSS_COMPILE_TA) +plugin: + $(q)make -C plugin TARGET=$(TARGET_HOST) \ + CROSS_COMPILE=$(CROSS_COMPILE_HOST) + clean: $(q)make -C host clean $(q)make -C plugin clean diff --git a/examples/supp_plugin-rs/host/Makefile b/examples/supp_plugin-rs/host/Makefile index 70436596..2cbf3b1f 100644 --- a/examples/supp_plugin-rs/host/Makefile +++ b/examples/supp_plugin-rs/host/Makefile @@ -17,12 +17,12 @@ NAME := supp_plugin-rs -TARGET_HOST ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_HOST ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_HOST)objcopy -LINKER_CFG := target.$(TARGET_HOST).linker=\"$(CROSS_COMPILE_HOST)gcc\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" -OUT_DIR := $(CURDIR)/target/$(TARGET_HOST)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release all: host strip diff --git a/examples/supp_plugin-rs/ta/Makefile b/examples/supp_plugin-rs/ta/Makefile index b006c009..640450db 100644 --- a/examples/supp_plugin-rs/ta/Makefile +++ b/examples/supp_plugin-rs/ta/Makefile @@ -17,21 +17,21 @@ UUID ?= $(shell cat "../ta_uuid.txt") -TARGET_TA ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_TA ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_TA)objcopy -LINKER_CFG := target.$(TARGET_TA).linker=\"$(CROSS_COMPILE_TA)ld.bfd\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)ld.bfd\" TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py -OUT_DIR := $(CURDIR)/target/$(TARGET_TA)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER = $(if $(STD),xargo,cargo) all: ta strip sign ta: - @$(BUILDER) build --target $(TARGET_TA) --release --config $(LINKER_CFG) + @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/tcp_client-rs/Makefile b/examples/tcp_client-rs/Makefile index c266055b..a7a3dec8 100644 --- a/examples/tcp_client-rs/Makefile +++ b/examples/tcp_client-rs/Makefile @@ -22,11 +22,17 @@ CROSS_COMPILE_TA ?= aarch64-linux-gnu- TARGET_HOST ?= aarch64-unknown-linux-gnu TARGET_TA ?= aarch64-unknown-linux-gnu -all: - $(q)make -C host TARGET_HOST=$(TARGET_HOST) \ - CROSS_COMPILE_HOST=$(CROSS_COMPILE_HOST) - $(q)make -C ta TARGET_TA=$(TARGET_TA) \ - CROSS_COMPILE_TA=$(CROSS_COMPILE_TA) +.PHONY: host ta all clean + +all: host ta + +host: + $(q)make -C host TARGET=$(TARGET_HOST) \ + CROSS_COMPILE=$(CROSS_COMPILE_HOST) + +ta: + $(q)make -C ta TARGET=$(TARGET_TA) \ + CROSS_COMPILE=$(CROSS_COMPILE_TA) clean: $(q)make -C host clean diff --git a/examples/tcp_client-rs/host/Makefile b/examples/tcp_client-rs/host/Makefile index 392aa901..418c5459 100644 --- a/examples/tcp_client-rs/host/Makefile +++ b/examples/tcp_client-rs/host/Makefile @@ -17,15 +17,19 @@ NAME := tcp_client-rs -TARGET_HOST ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_HOST ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_HOST)objcopy -LINKER_CFG := target.$(TARGET_HOST).linker=\"$(CROSS_COMPILE_HOST)gcc\" - -OUT_DIR := $(CURDIR)/target/$(TARGET_HOST)/release +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" +OUT_DIR := $(CURDIR)/target/$(TARGET)/release +ifeq ($(STD),) +all: + @echo "Please export STD=y to build the STD version" +else all: host strip +endif host: @cargo build --target $(TARGET_HOST) --release --config $(LINKER_CFG) diff --git a/examples/tcp_client-rs/ta/Makefile b/examples/tcp_client-rs/ta/Makefile index 17d6e730..c01b9fd6 100644 --- a/examples/tcp_client-rs/ta/Makefile +++ b/examples/tcp_client-rs/ta/Makefile @@ -19,14 +19,14 @@ UUID ?= $(shell cat "../uuid.txt") -TARGET_TA ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_TA ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_TA)objcopy -LINKER_CFG := target.$(TARGET_TA).linker=\"$(CROSS_COMPILE_TA)ld.bfd\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)ld.bfd\" TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py -OUT_DIR := $(CURDIR)/target/$(TARGET_TA)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release ifeq ($(STD),) all: @@ -36,7 +36,7 @@ all: ta strip sign endif ta: - @xargo build --target $(TARGET_TA) --release --config $(LINKER_CFG) + @xargo build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/time-rs/Makefile b/examples/time-rs/Makefile index c266055b..a7a3dec8 100644 --- a/examples/time-rs/Makefile +++ b/examples/time-rs/Makefile @@ -22,11 +22,17 @@ CROSS_COMPILE_TA ?= aarch64-linux-gnu- TARGET_HOST ?= aarch64-unknown-linux-gnu TARGET_TA ?= aarch64-unknown-linux-gnu -all: - $(q)make -C host TARGET_HOST=$(TARGET_HOST) \ - CROSS_COMPILE_HOST=$(CROSS_COMPILE_HOST) - $(q)make -C ta TARGET_TA=$(TARGET_TA) \ - CROSS_COMPILE_TA=$(CROSS_COMPILE_TA) +.PHONY: host ta all clean + +all: host ta + +host: + $(q)make -C host TARGET=$(TARGET_HOST) \ + CROSS_COMPILE=$(CROSS_COMPILE_HOST) + +ta: + $(q)make -C ta TARGET=$(TARGET_TA) \ + CROSS_COMPILE=$(CROSS_COMPILE_TA) clean: $(q)make -C host clean diff --git a/examples/time-rs/host/Makefile b/examples/time-rs/host/Makefile index 1b91df8c..d0ccff2e 100644 --- a/examples/time-rs/host/Makefile +++ b/examples/time-rs/host/Makefile @@ -17,12 +17,12 @@ NAME := time-rs -TARGET_HOST ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_HOST ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_HOST)objcopy -LINKER_CFG := target.$(TARGET_HOST).linker=\"$(CROSS_COMPILE_HOST)gcc\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" -OUT_DIR := $(CURDIR)/target/$(TARGET_HOST)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release all: host strip diff --git a/examples/time-rs/ta/Makefile b/examples/time-rs/ta/Makefile index 5dab9d46..72a9cb3f 100644 --- a/examples/time-rs/ta/Makefile +++ b/examples/time-rs/ta/Makefile @@ -17,21 +17,21 @@ UUID ?= $(shell cat "../uuid.txt") -TARGET_TA ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_TA ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_TA)objcopy -LINKER_CFG := target.$(TARGET_TA).linker=\"$(CROSS_COMPILE_TA)ld.bfd\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)ld.bfd\" TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py -OUT_DIR := $(CURDIR)/target/$(TARGET_TA)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER = $(if $(STD),xargo,cargo) all: ta strip sign ta: - @$(BUILDER) build --target $(TARGET_TA) --release --config $(LINKER_CFG) + @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/tls_client-rs/Makefile b/examples/tls_client-rs/Makefile index c266055b..a7a3dec8 100644 --- a/examples/tls_client-rs/Makefile +++ b/examples/tls_client-rs/Makefile @@ -22,11 +22,17 @@ CROSS_COMPILE_TA ?= aarch64-linux-gnu- TARGET_HOST ?= aarch64-unknown-linux-gnu TARGET_TA ?= aarch64-unknown-linux-gnu -all: - $(q)make -C host TARGET_HOST=$(TARGET_HOST) \ - CROSS_COMPILE_HOST=$(CROSS_COMPILE_HOST) - $(q)make -C ta TARGET_TA=$(TARGET_TA) \ - CROSS_COMPILE_TA=$(CROSS_COMPILE_TA) +.PHONY: host ta all clean + +all: host ta + +host: + $(q)make -C host TARGET=$(TARGET_HOST) \ + CROSS_COMPILE=$(CROSS_COMPILE_HOST) + +ta: + $(q)make -C ta TARGET=$(TARGET_TA) \ + CROSS_COMPILE=$(CROSS_COMPILE_TA) clean: $(q)make -C host clean diff --git a/examples/tls_client-rs/host/Makefile b/examples/tls_client-rs/host/Makefile index 79208656..0e2f15be 100644 --- a/examples/tls_client-rs/host/Makefile +++ b/examples/tls_client-rs/host/Makefile @@ -17,15 +17,19 @@ NAME := tls_client-rs -TARGET_HOST ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_HOST ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_HOST)objcopy -LINKER_CFG := target.$(TARGET_HOST).linker=\"$(CROSS_COMPILE_HOST)gcc\" - -OUT_DIR := $(CURDIR)/target/$(TARGET_HOST)/release +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" +OUT_DIR := $(CURDIR)/target/$(TARGET)/release +ifeq ($(STD),) +all: + @echo "Please export STD=y to build the STD version" +else all: host strip +endif host: @cargo build --target $(TARGET_HOST) --release --config $(LINKER_CFG) diff --git a/examples/tls_client-rs/ta/Makefile b/examples/tls_client-rs/ta/Makefile index 74aeb336..c01b9fd6 100644 --- a/examples/tls_client-rs/ta/Makefile +++ b/examples/tls_client-rs/ta/Makefile @@ -19,14 +19,14 @@ UUID ?= $(shell cat "../uuid.txt") -TARGET_TA ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_TA ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_TA)objcopy -LINKER_CFG := target.$(TARGET_TA).linker=\"$(CROSS_COMPILE_TA)ld.bfd\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)ld.bfd\" TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py -OUT_DIR := $(CURDIR)/target/$(TARGET_TA)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release ifeq ($(STD),) all: @@ -35,9 +35,8 @@ else all: ta strip sign endif -# set the cross compile for building inner libraries, such as C libraries in ring ta: - @CROSS_COMPILE=$(CROSS_COMPILE_TA) xargo build --target $(TARGET_TA) --release --config $(LINKER_CFG) + @xargo build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/tls_server-rs/Makefile b/examples/tls_server-rs/Makefile index c266055b..a7a3dec8 100644 --- a/examples/tls_server-rs/Makefile +++ b/examples/tls_server-rs/Makefile @@ -22,11 +22,17 @@ CROSS_COMPILE_TA ?= aarch64-linux-gnu- TARGET_HOST ?= aarch64-unknown-linux-gnu TARGET_TA ?= aarch64-unknown-linux-gnu -all: - $(q)make -C host TARGET_HOST=$(TARGET_HOST) \ - CROSS_COMPILE_HOST=$(CROSS_COMPILE_HOST) - $(q)make -C ta TARGET_TA=$(TARGET_TA) \ - CROSS_COMPILE_TA=$(CROSS_COMPILE_TA) +.PHONY: host ta all clean + +all: host ta + +host: + $(q)make -C host TARGET=$(TARGET_HOST) \ + CROSS_COMPILE=$(CROSS_COMPILE_HOST) + +ta: + $(q)make -C ta TARGET=$(TARGET_TA) \ + CROSS_COMPILE=$(CROSS_COMPILE_TA) clean: $(q)make -C host clean diff --git a/examples/tls_server-rs/host/Makefile b/examples/tls_server-rs/host/Makefile index 92dac4b1..37718cc3 100644 --- a/examples/tls_server-rs/host/Makefile +++ b/examples/tls_server-rs/host/Makefile @@ -17,15 +17,19 @@ NAME := tls_server-rs -TARGET_HOST ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_HOST ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_HOST)objcopy -LINKER_CFG := target.$(TARGET_HOST).linker=\"$(CROSS_COMPILE_HOST)gcc\" - -OUT_DIR := $(CURDIR)/target/$(TARGET_HOST)/release +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" +OUT_DIR := $(CURDIR)/target/$(TARGET)/release +ifeq ($(STD),) +all: + @echo "Please export STD=y to build the STD version" +else all: host strip +endif host: @cargo build --target $(TARGET_HOST) --release --config $(LINKER_CFG) diff --git a/examples/tls_server-rs/ta/Makefile b/examples/tls_server-rs/ta/Makefile index 74aeb336..c01b9fd6 100644 --- a/examples/tls_server-rs/ta/Makefile +++ b/examples/tls_server-rs/ta/Makefile @@ -19,14 +19,14 @@ UUID ?= $(shell cat "../uuid.txt") -TARGET_TA ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_TA ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_TA)objcopy -LINKER_CFG := target.$(TARGET_TA).linker=\"$(CROSS_COMPILE_TA)ld.bfd\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)ld.bfd\" TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py -OUT_DIR := $(CURDIR)/target/$(TARGET_TA)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release ifeq ($(STD),) all: @@ -35,9 +35,8 @@ else all: ta strip sign endif -# set the cross compile for building inner libraries, such as C libraries in ring ta: - @CROSS_COMPILE=$(CROSS_COMPILE_TA) xargo build --target $(TARGET_TA) --release --config $(LINKER_CFG) + @xargo build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/udp_socket-rs/Makefile b/examples/udp_socket-rs/Makefile index c266055b..a7a3dec8 100644 --- a/examples/udp_socket-rs/Makefile +++ b/examples/udp_socket-rs/Makefile @@ -22,11 +22,17 @@ CROSS_COMPILE_TA ?= aarch64-linux-gnu- TARGET_HOST ?= aarch64-unknown-linux-gnu TARGET_TA ?= aarch64-unknown-linux-gnu -all: - $(q)make -C host TARGET_HOST=$(TARGET_HOST) \ - CROSS_COMPILE_HOST=$(CROSS_COMPILE_HOST) - $(q)make -C ta TARGET_TA=$(TARGET_TA) \ - CROSS_COMPILE_TA=$(CROSS_COMPILE_TA) +.PHONY: host ta all clean + +all: host ta + +host: + $(q)make -C host TARGET=$(TARGET_HOST) \ + CROSS_COMPILE=$(CROSS_COMPILE_HOST) + +ta: + $(q)make -C ta TARGET=$(TARGET_TA) \ + CROSS_COMPILE=$(CROSS_COMPILE_TA) clean: $(q)make -C host clean diff --git a/examples/udp_socket-rs/host/Makefile b/examples/udp_socket-rs/host/Makefile index 145a5ceb..95e09c51 100644 --- a/examples/udp_socket-rs/host/Makefile +++ b/examples/udp_socket-rs/host/Makefile @@ -17,15 +17,19 @@ NAME := udp_socket-rs -TARGET_HOST ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_HOST ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_HOST)objcopy -LINKER_CFG := target.$(TARGET_HOST).linker=\"$(CROSS_COMPILE_HOST)gcc\" - -OUT_DIR := $(CURDIR)/target/$(TARGET_HOST)/release +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" +OUT_DIR := $(CURDIR)/target/$(TARGET)/release +ifeq ($(STD),) +all: + @echo "Please export STD=y to build the STD version" +else all: host strip +endif host: @cargo build --target $(TARGET_HOST) --release --config $(LINKER_CFG) diff --git a/examples/udp_socket-rs/ta/Makefile b/examples/udp_socket-rs/ta/Makefile index 17d6e730..c01b9fd6 100644 --- a/examples/udp_socket-rs/ta/Makefile +++ b/examples/udp_socket-rs/ta/Makefile @@ -19,14 +19,14 @@ UUID ?= $(shell cat "../uuid.txt") -TARGET_TA ?= aarch64-unknown-linux-gnu -CROSS_COMPILE_TA ?= aarch64-linux-gnu- -OBJCOPY := $(CROSS_COMPILE_TA)objcopy -LINKER_CFG := target.$(TARGET_TA).linker=\"$(CROSS_COMPILE_TA)ld.bfd\" +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)ld.bfd\" TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py -OUT_DIR := $(CURDIR)/target/$(TARGET_TA)/release +OUT_DIR := $(CURDIR)/target/$(TARGET)/release ifeq ($(STD),) all: @@ -36,7 +36,7 @@ all: ta strip sign endif ta: - @xargo build --target $(TARGET_TA) --release --config $(LINKER_CFG) + @xargo build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta