Skip to content

Commit

Permalink
Merge pull request #326 from jackchenjc/edgex-go-issue-4916-2
Browse files Browse the repository at this point in the history
fix: Only one ldflags flag is allowed
  • Loading branch information
cloudxxx8 authored Nov 8, 2024
2 parents 1f9af3d + a724e28 commit e826f5d
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.PHONY: build test unittest lint clean prepare update docker

# 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)

Expand All @@ -18,16 +18,17 @@ SDKVERSION=$(shell sed -En 's|.*github.com/edgexfoundry/device-sdk-go/v4 (v[\.0-
# this pulls the version from local VERSION file that is created by the Jenkins Pipeline.
VERSION=$(shell cat ./VERSION 2>/dev/null || echo 0.0.0)

ifeq ($(ENABLE_FULL_RELRO), true)
ENABLE_FULL_RELRO_GOFLAGS = -bindnow
endif

GIT_SHA=$(shell git rev-parse HEAD)
GOFLAGS=-ldflags "-X github.com/edgexfoundry/device-rfid-llrp-go.Version=$(VERSION) \
-X github.com/edgexfoundry/device-sdk-go/v4/internal/common.SDKVersion=$(SDKVERSION)" \
-X github.com/edgexfoundry/device-sdk-go/v4/internal/common.SDKVersion=$(SDKVERSION) \
$(ENABLE_FULL_RELRO_GOFLAGS)" \
-trimpath -mod=readonly

ifeq ($(ENABLE_FULL_RELRO), "true")
GOFLAGS += -ldflags "-bindnow"
endif

ifeq ($(ENABLE_PIE), "true")
ifeq ($(ENABLE_PIE), true)
GOFLAGS += -buildmode=pie
endif

Expand Down

0 comments on commit e826f5d

Please sign in to comment.