From 4e50deff255ba4d142e48638a6f98e5681727bcf Mon Sep 17 00:00:00 2001 From: Jack Chen Date: Fri, 8 Nov 2024 11:03:49 +0800 Subject: [PATCH] fix: Only one ldflags flag is allowed Signed-off-by: Jack Chen --- Makefile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index eb52de8..a89de47 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,9 @@ .PHONY: build test unittest lint clean update fmt docker run # change the following boolean flag to enable or disable the Full RELRO (RELocation Read Only) for linux ELF (Executable and Linkable Format) binaries -ENABLE_FULL_RELRO:="true" +ENABLE_FULL_RELRO=true # change the following boolean flag to enable or disable PIE for linux binaries which is needed for ASLR (Address Space Layout Randomization) on Linux, the ASLR support on Windows is enabled by default -ENABLE_PIE:="true" +ENABLE_PIE=true ARCH=$(shell uname -m) @@ -18,16 +18,16 @@ GIT_SHA=$(shell git rev-parse HEAD) # with the SDK and printing just the version number that comes after it. SDKVERSION=$(shell sed -En 's|.*github.com/edgexfoundry/app-functions-sdk-go/v3 (v[\.0-9a-zA-Z-]+).*|\1|p' go.mod) +ifeq ($(ENABLE_FULL_RELRO), true) + ENABLE_FULL_RELRO_GOFLAGS = -bindnow +endif + GOFLAGS=-ldflags "-s -w -X github.com/edgexfoundry/app-functions-sdk-go/v3/internal.SDKVersion=$(SDKVERSION) \ -X github.com/edgexfoundry/app-functions-sdk-go/v3/internal.ApplicationVersion=$(APPVERSION) \ - -X edgexfoundry/app-rfid-llrp-inventory.Version=$(APPVERSION)" -trimpath -mod=readonly + -X edgexfoundry/app-rfid-llrp-inventory.Version=$(APPVERSION) $(ENABLE_FULL_RELRO_GOFLAGS)" -trimpath -mod=readonly GOTESTFLAGS?=-race -ifeq ($(ENABLE_FULL_RELRO), "true") - GOFLAGS += -ldflags "-bindnow" -endif - -ifeq ($(ENABLE_PIE), "true") +ifeq ($(ENABLE_PIE), true) GOFLAGS += -buildmode=pie endif