Skip to content

Commit f4c7019

Browse files
committed
fix: update makefile
Signed-off-by: Arjun Raja Yogidas <[email protected]>
1 parent 1795ca9 commit f4c7019

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Makefile

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,22 @@ ifndef GODEBUG
2121
EXTRA_LDFLAGS += -s -w
2222
endif
2323

24-
LDFLAGS := -X $(PACKAGE)/version.Version=$(VERSION) -X $(PACKAGE)/version.GitCommit=$(GITCOMMIT)
25-
26-
# LDFLAGS += $(EXTRA_LDFLAGS)
24+
LDFLAGS_BASE := -X $(PACKAGE)/version.Version=$(VERSION) -X $(PACKAGE)/version.GitCommit=$(GITCOMMIT) $(EXTRA_LDFLAGS)
2725

26+
.PHONY: build
27+
build:
2828
ifeq ($(STATIC),)
29-
GO_BUILDTAGS := osusergo netgo
30-
LDFLAGS += -extldflags '-static'
31-
$(info Building Static Binary)
29+
@echo "Building Dynamic Binary"
30+
$(eval LDFLAGS := $(LDFLAGS_BASE))
3231
else
33-
$(info Building Dynamic Binary)
32+
@echo "Building Static Binary"
33+
$(eval GO_BUILDTAGS := osusergo netgo)
34+
$(eval LDFLAGS := $(LDFLAGS_BASE) -extldflags '-static')
3435
endif
35-
36-
.PHONY: build
37-
build:
38-
GOOS=linux go build $(if $(GO_BUILDTAGS), -tags "$(GO_BUILDTAGS)") -ldflags "$(LDFLAGS)" -v -o $(BINARY) $(PACKAGE)/cmd/finch-daemon
39-
36+
GOOS=linux go build \
37+
$(if $(GO_BUILDTAGS),-tags "$(GO_BUILDTAGS)") \
38+
-ldflags "$(LDFLAGS)" \
39+
-v -o $(BINARY) $(PACKAGE)/cmd/finch-daemon
4040
clean:
4141
@rm -f $(BINARIES)
4242
@rm -rf $(BIN)

0 commit comments

Comments
 (0)