summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2024-03-08 01:50:37 +0700
committerShulhan <ms@kilabit.info>2024-03-09 01:10:24 +0700
commitd309b58f63cfc382e0003cff85ab057fd06d3d23 (patch)
treec28a0cdb663c699ea0c455d1463c26f9c51c6507
parent8007793b86bac3ca0bf937fe246deae5ac46a503 (diff)
downloadpakakeh.go-d309b58f63cfc382e0003cff85ab057fd06d3d23.tar.xz
Makefile: reorder default tasks and add flags for reproducible build
The lint and build should be the first tasks, so in case we have warnings or errors the tests are not running. The flags for reproducible build are taken from Arch Linux wiki [1]. [1]: https://wiki.archlinux.org/title/Go_package_guidelines#Flags_and_build_options
-rw-r--r--Makefile9
1 files changed, 7 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index c9b3f94c..41527d6c 100644
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,7 @@ VERSION := $(shell git describe --tags)
.PHONY: all install build docs docs-serve clean distclean
.PHONY: lint test test.prof
-all: test lint build
+all: lint build test
install:
go install ./cmd/...
@@ -21,7 +21,12 @@ install:
build: BUILD_FLAGS=-ldflags "-s -w -X 'git.sr.ht/~shulhan/pakakeh.go.Version=$(VERSION)'"
build:
mkdir -p _bin/
- go build $(BUILD_FLAGS) -o _bin/ ./cmd/...
+ go build \
+ -trimpath \
+ -buildmode=pie \
+ -mod=readonly \
+ -modcacherw \
+ $(BUILD_FLAGS) -o _bin/ ./cmd/...
test:
CGO_ENABLED=1 go test -failfast -timeout=1m -race -coverprofile=$(COVER_OUT) ./...