From 22019acbb13ba983bbd6221cde29b0ff925cdbca Mon Sep 17 00:00:00 2001 From: "M.V. Hutz" Date: Sat, 10 Jan 2026 23:29:30 +0000 Subject: [PATCH] feat: add PHONY declarations and docs target to Makefile (#9) --- name: "Default Template" about: "The default template for `lambda`." title: "feat: add PHONY declarations and docs target to Makefile" ref: "main" assignees: [] labels: [] --- ## Description This PR improves the Makefile by adding proper `.PHONY` declarations and a new `docs` target. The `.PHONY` declarations ensure make properly handles targets that don't create files. The `docs` target provides an easy way to view Go package documentation locally using godoc. Changes: - Add `.PHONY` declaration for all non-file targets (`it`, `run`, `profile`, `explain`, `graph`, `docs`). - Add `docs` target that runs godoc server on port 6060 with helpful usage message. ### Decisions None. ## Benefits - Prevents make from getting confused if files with target names exist. - Provides convenient documentation viewing with `make docs`. - Improves Makefile maintainability following best practices. ## Checklist - [x] Code follows conventional commit format. - [x] Branch follows naming convention (`/`). Always use underscores. - [ ] Tests pass (if applicable). - [x] Documentation updated (if applicable). Reviewed-on: https://git.maximhutz.com/mvhutz/lambda/pulls/9 Co-authored-by: M.V. Hutz Co-committed-by: M.V. Hutz --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile b/Makefile index 42c6777..fa74ef9 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ BINARY_NAME=lambda.exe +.PHONY: it run profile explain graph docs + it: @ go build -o ${BINARY_NAME} ./cmd/lambda @ chmod +x ${BINARY_NAME} @@ -19,3 +21,7 @@ graph: @ go tool pprof -raw -output=profile/cpu.raw profile/cpu.prof @ go tool pprof -svg profile/cpu.prof > profile/cpu.svg @ open profile/cpu.svg + +docs: + @ echo ">>> View at 'http://localhost:6060/pkg/git.maximhutz.com/max/lambda/'" + @ go run golang.org/x/tools/cmd/godoc@latest -http=:6060