diff options
| author | Shulhan <ms@kilabit.info> | 2024-03-08 01:50:37 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2024-03-09 01:10:24 +0700 |
| commit | d309b58f63cfc382e0003cff85ab057fd06d3d23 (patch) | |
| tree | c28a0cdb663c699ea0c455d1463c26f9c51c6507 | |
| parent | 8007793b86bac3ca0bf937fe246deae5ac46a503 (diff) | |
| download | pakakeh.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-- | Makefile | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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) ./... |
