Makefile: thin shims only, add make build (closes #73)
check / check (push) Failing after 2s
check / check (push) Failing after 2s
The Makefile is now one shim per script/ entrypoint, in the order of the canonical model Makefile, plus build, generate and fuzz. The new script/build writes bin/mfer with the urfave_cli_no_docs tag and the git describe revision that script/docker stamps. script/generate now adds the Go bin directory to PATH itself, and the Docker lint stage calls script/gofumpt --check directly. Removed: the tarball-caching rules and their ignore entries, godoc, ci, fixme, clean, run, default, fmt-check-go, fmt-check-md, and bin/gitrev.sh, which only the Makefile called. Model: opus-5-5
This commit was merged in pull request #152.
This commit is contained in:
@@ -1,20 +1,8 @@
|
||||
export DOCKER_BUILDKIT := 1
|
||||
export PROGRESS_NO_TRUNC := 1
|
||||
GOPATH := $(shell go env GOPATH)
|
||||
export PATH := $(PATH):$(GOPATH)/bin
|
||||
SOURCEFILES := mfer/*.go mfer/*.proto internal/*/*.go cmd/*/*.go go.mod go.sum
|
||||
ARCH := $(shell uname -m)
|
||||
GITREV_BUILD := $(shell bash $(PWD)/bin/gitrev.sh 2>/dev/null || echo unknown)
|
||||
APPNAME := mfer
|
||||
VERSION := 0.1.0
|
||||
export DOCKER_IMAGE_CACHE_DIR := $(HOME)/Library/Caches/Docker/$(APPNAME)-$(ARCH)
|
||||
GOLDFLAGS += -X main.Version=$(VERSION)
|
||||
GOLDFLAGS += -X main.Gitrev=$(GITREV_BUILD)
|
||||
GOFLAGS := -ldflags "$(GOLDFLAGS)"
|
||||
.PHONY: bootstrap setup test lint fmt fmt-check check docker hooks build generate fuzz
|
||||
|
||||
.PHONY: bootstrap setup docker default run ci test fuzz check lint fmt fmt-check fmt-check-go fmt-check-md hooks fixme generate
|
||||
|
||||
default: fmt test
|
||||
# Makefile targets are thin shims; the implementations live in script/
|
||||
# per the scripts-to-rule-them-all pattern (see the Entrypoints section
|
||||
# of README.md).
|
||||
|
||||
bootstrap:
|
||||
@script/bootstrap
|
||||
@@ -22,75 +10,32 @@ bootstrap:
|
||||
setup:
|
||||
@script/setup
|
||||
|
||||
run: ./bin/mfer
|
||||
./$<
|
||||
./$< gen
|
||||
|
||||
ci: test
|
||||
|
||||
test:
|
||||
@script/test
|
||||
|
||||
fuzz:
|
||||
@script/fuzz
|
||||
|
||||
fixme:
|
||||
@grep -nir fixme . | grep -v Makefile
|
||||
|
||||
check:
|
||||
@script/check
|
||||
|
||||
fmt-check:
|
||||
@script/fmt-check
|
||||
|
||||
# Halves of fmt-check, for environments that have only one toolchain:
|
||||
# the Docker lint stage has Go but no node, the markdown stage the reverse.
|
||||
fmt-check-go:
|
||||
@script/gofumpt --check
|
||||
|
||||
fmt-check-md:
|
||||
@script/prettier --check
|
||||
|
||||
hooks:
|
||||
@script/install-precommit
|
||||
|
||||
generate:
|
||||
@script/generate
|
||||
|
||||
bin/mfer: $(SOURCEFILES)
|
||||
cd cmd/mfer && go build -tags urfave_cli_no_docs -o ../../bin/mfer $(GOFLAGS) .
|
||||
|
||||
clean:
|
||||
rm -rfv bin/mfer cmd/mfer/mfer *.dockerimage
|
||||
|
||||
fmt:
|
||||
@script/fmt
|
||||
|
||||
lint:
|
||||
@script/lint
|
||||
|
||||
fmt:
|
||||
@script/fmt
|
||||
|
||||
fmt-check:
|
||||
@script/fmt-check
|
||||
|
||||
check:
|
||||
@script/check
|
||||
|
||||
docker:
|
||||
@script/docker
|
||||
|
||||
sneak-mfer.$(ARCH).tzst.dockerimage: $(SOURCEFILES) vendor.tzst modcache.tzst
|
||||
docker build --progress plain --build-arg GITREV=$(GITREV_BUILD) -t sneak/mfer .
|
||||
docker save sneak/mfer | pv | zstdmt -19 > $@
|
||||
du -sh $@
|
||||
hooks:
|
||||
@script/install-precommit
|
||||
|
||||
godoc:
|
||||
open http://127.0.0.1:6060
|
||||
godoc -http=:6060
|
||||
build:
|
||||
@script/build
|
||||
|
||||
vendor.tzst: go.mod go.sum
|
||||
go mod tidy
|
||||
go mod vendor
|
||||
cd vendor && tar -c . | pv | zstdmt -19 > $(PWD)/$@.tmp
|
||||
rm -rf vendor
|
||||
mv $@.tmp $@
|
||||
generate:
|
||||
@script/generate
|
||||
|
||||
modcache.tzst: go.mod go.sum
|
||||
go mod tidy
|
||||
cd $(HOME)/go/pkg && chmod -R u+rw . && rm -rf mod sumdb
|
||||
go mod download -x
|
||||
cd $(shell go env GOMODCACHE) && tar -c . | pv | zstdmt -19 > $(PWD)/$@.tmp
|
||||
mv $@.tmp $@
|
||||
fuzz:
|
||||
@script/fuzz
|
||||
|
||||
Reference in New Issue
Block a user