From 2808ea189754ba52483501fe0fd9655675e6cc5c Mon Sep 17 00:00:00 2001 From: Terry Howe Date: Thu, 12 Sep 2024 11:01:36 -0600 Subject: [PATCH] feature: build binary for OS and arch by default (#1487) Signed-off-by: Terry Howe Co-authored-by: Billy Zha --- Makefile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Makefile b/Makefile index ca72c5b4b..355ab30a9 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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=./... ./...