Skip to content

Commit

Permalink
fix build failed on macos (#1067)
Browse files Browse the repository at this point in the history
Signed-off-by: Song Jian <songjian@yf-networks.com>
  • Loading branch information
supermario1990 authored and Song Jian committed Jan 19, 2025
1 parent 4ba930b commit 948447e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# init project path
WORKROOT := $(shell pwd)
OUTDIR := $(WORKROOT)/output
OS := $(shell go env GOOS)

# init environment variables
export PATH := $(shell go env GOPATH)/bin:$(PATH)
Expand Down Expand Up @@ -80,12 +81,20 @@ prepare-gen:
# make compile, go build
compile: test build
build:
ifeq ($(OS),darwin)
$(GOBUILD) -ldflags "-X main.version=$(BFE_VERSION) -X main.commit=$(GIT_COMMIT)"
else
$(GOBUILD) -ldflags "-X main.version=$(BFE_VERSION) -X main.commit=$(GIT_COMMIT) -extldflags=-static"
endif

# make compile-strip, go build without symbols and DWARFs
compile-strip: test build-strip
build-strip:
ifeq ($(OS),darwin)
$(GOBUILD) -ldflags "-X main.version=$(BFE_VERSION) -X main.commit=$(GIT_COMMIT) -s -w"
else
$(GOBUILD) -ldflags "-X main.version=$(BFE_VERSION) -X main.commit=$(GIT_COMMIT) -extldflags=-static -s -w"
endif

# make test, test your code
test: test-case vet-case
Expand Down

0 comments on commit 948447e

Please sign in to comment.