Skip to content

Commit

Permalink
ci: simplify build target
Browse files Browse the repository at this point in the history
Signed-off-by: Arjun Raja Yogidas <[email protected]>
  • Loading branch information
coderbirju committed Oct 30, 2024
1 parent f4c7019 commit 723e435
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
Expand Up @@ -27,16 +27,17 @@ LDFLAGS_BASE := -X $(PACKAGE)/version.Version=$(VERSION) -X $(PACKAGE)/version.G
build:
ifeq ($(STATIC),)
@echo "Building Dynamic Binary"
$(eval LDFLAGS := $(LDFLAGS_BASE))
CGO_ENABLED=1 GOOS=linux go build \
-ldflags "$(LDFLAGS_BASE)" \
-v -o $(BINARY) $(PACKAGE)/cmd/finch-daemon
else
@echo "Building Static Binary"
$(eval GO_BUILDTAGS := osusergo netgo)
$(eval LDFLAGS := $(LDFLAGS_BASE) -extldflags '-static')
endif
GOOS=linux go build \
$(if $(GO_BUILDTAGS),-tags "$(GO_BUILDTAGS)") \
-ldflags "$(LDFLAGS)" \
CGO_ENABLED=0 GOOS=linux go build \
-tags netgo \
-ldflags "$(LDFLAGS_BASE) -extldflags '-static'" \
-v -o $(BINARY) $(PACKAGE)/cmd/finch-daemon
endif

clean:
@rm -f $(BINARIES)
@rm -rf $(BIN)
Expand Down Expand Up @@ -125,4 +126,4 @@ coverage: linux
.PHONY: release
release: linux
@echo "$@"
@$(FINCH_DAEMON_PROJECT_ROOT)/scripts/create-releases.sh $(RELEASE_TAG)
@$(FINCH_DAEMON_PROJECT_ROOT)/scripts/create-releases.sh $(RELEASE_TAG)

0 comments on commit 723e435

Please sign in to comment.