build: add a make build target, drop README's raw go build (closes #19)
The executable builds to build/rogue. All generated artifacts go under build/, which .gitignore covers as a whole; a target writing outside it can commit its output. build is in neither check nor test: check stays fmt-check lint test and still writes nothing into the working tree. README's "Building and running" block and the run examples use ./build/rogue, and no raw go invocation is left in the file. Verified: make build writes build/rogue and git status stays clean; GOFLAGS=-count=1 make check green in 34s with the lint layer executing (21.9s, "0 issues.", not CACHED) and the suite running for real (cmd/rogue 1.027s, game 3.450s), git status clean afterwards.
This commit is contained in:
22
Makefile
22
Makefile
@@ -6,15 +6,27 @@
|
||||
# around the Go toolchain and prettier so `make fmt` / `make check` behave
|
||||
# the same as in sneak's other repos.
|
||||
|
||||
GO_PKGS := ./...
|
||||
MD_FILES := $(shell git ls-files '*.md')
|
||||
PRETTIER := prettier --tab-width 4 --prose-wrap always
|
||||
GO_PKGS := ./...
|
||||
MD_FILES := $(shell git ls-files '*.md')
|
||||
PRETTIER := prettier --tab-width 4 --prose-wrap always
|
||||
|
||||
.PHONY: check fmt fmt-check lint test
|
||||
# Every generated artifact goes here, and the whole directory is
|
||||
# git-ignored. Targets that write outside it can commit their output.
|
||||
BUILD_DIR := build
|
||||
BIN := $(BUILD_DIR)/rogue
|
||||
|
||||
# Format, lint, and test — the full local pre-commit gate.
|
||||
.PHONY: build check fmt fmt-check lint test
|
||||
|
||||
# Format, lint, and test — the full local pre-commit gate. Keep this list
|
||||
# to targets that write nothing into the working tree.
|
||||
check: fmt-check lint test
|
||||
|
||||
# Build the executable into $(BUILD_DIR). `go build -o` does not create the
|
||||
# parent directory.
|
||||
build:
|
||||
@mkdir -p $(BUILD_DIR)
|
||||
go build -o $(BIN) ./cmd/rogue
|
||||
|
||||
# Format Go and Markdown in place.
|
||||
fmt:
|
||||
gofmt -w .
|
||||
|
||||
Reference in New Issue
Block a user