Skip to content

Commit

Permalink
feature: build binary for OS and arch by default (#1487)
Browse files Browse the repository at this point in the history
Signed-off-by: Terry Howe <terrylhowe@gmail.com>
Co-authored-by: Billy Zha <qweeah@gmail.com>
  • Loading branch information
TerryHowe and qweeah authored Sep 12, 2024
1 parent a3b0601 commit 2808ea1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@ GIT_COMMIT = $(shell git rev-parse HEAD)
GIT_TAG = $(shell git describe --tags --abbrev=0 --exact-match 2>/dev/null)
GIT_DIRTY = $(shell test -n "`git status --porcelain`" && echo "dirty" || echo "clean")
GO_EXE = go
OSNAME = $(shell uname -o)
ARCHNAME = $(shell uname -m)

ifeq ($(OSNAME),Darwin)
OS = mac
else
OS = linux
endif
ifeq ($(ARCHNAME),arm64)
ARCH = arm64
else
ARCH = amd64
endif

TARGET_OBJS ?= checksums.txt darwin_amd64.tar.gz darwin_arm64.tar.gz linux_amd64.tar.gz linux_arm64.tar.gz linux_armv7.tar.gz linux_s390x.tar.gz linux_ppc64le.tar.gz linux_riscv64.tar.gz windows_amd64.zip freebsd_amd64.tar.gz

Expand All @@ -31,6 +44,10 @@ endif
LDFLAGS += -X $(PROJECT_PKG)/internal/version.GitCommit=${GIT_COMMIT}
LDFLAGS += -X $(PROJECT_PKG)/internal/version.GitTreeState=${GIT_DIRTY}

.PHONY: default
default: test build-$(OS)-$(ARCH)
@echo 'Done ' build-$(OS)-$(ARCH)

.PHONY: test
test: tidy vendor check-encoding ## tidy and run tests
$(GO_EXE) test -race -v -coverprofile=coverage.txt -covermode=atomic -coverpkg=./... ./...
Expand Down

0 comments on commit 2808ea1

Please sign in to comment.