commit 1549b3ecd5527a122fd05e3ac5f6a001d5d65f8a parent fea6da8272de9d85a7b5caa977fd32c1837309a0 Author: David Eisinger <[email protected]> Date: Tue, 7 Oct 2025 01:14:40 -0400 Only rebuild on change Diffstat:
| M | Makefile | | | 12 | ++++++++++-- |
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile @@ -1,9 +1,17 @@ -.PHONY: build clean fmt test +.PHONY: build clean fmt test vendor BINARY := bin/marky SRC := cmd/marky.go -build: +# All Go sources in repo (used to decide when to rebuild the binary) +GO_SOURCES := $(shell find . -type f -name '*.go') +# Embedded assets (served via go:embed) +WEB_ASSETS := $(shell [ -d internal/web ] && find internal/web -type f -print || echo) +MIGRATIONS := $(shell [ -d internal/migrations ] && find internal/migrations -type f -name '*.sql' -print || echo) + +build: $(BINARY) + +$(BINARY): $(GO_SOURCES) $(WEB_ASSETS) $(MIGRATIONS) mkdir -p $(dir $(BINARY)) go build -o $(BINARY) $(SRC)