Added a help target that displays all available Makefile targets with descriptions. Set help as the default goal so running 'make' without arguments shows usage information.
39 lines
1.2 KiB
Makefile
39 lines
1.2 KiB
Makefile
BINARY_NAME=lambda.exe
|
|
|
|
.PHONY: help build run profile explain graph docs
|
|
|
|
.DEFAULT_GOAL := help
|
|
|
|
help:
|
|
@ echo "Available targets:"
|
|
@ echo " build - Build the lambda executable"
|
|
@ echo " run - Build and run the lambda interpreter (use TEST=<name> to specify sample)"
|
|
@ echo " profile - Build and run with CPU profiling enabled"
|
|
@ echo " explain - Build and run with explanation mode and profiling"
|
|
@ echo " graph - Generate and open CPU profile visualization"
|
|
@ echo " docs - Start local godoc server on port 6060"
|
|
|
|
build:
|
|
@ go build -o ${BINARY_NAME} ./cmd/lambda
|
|
@ chmod +x ${BINARY_NAME}
|
|
|
|
TEST=simple
|
|
|
|
run: build
|
|
@ ./lambda.exe - < ./samples/$(TEST).txt > program.out
|
|
|
|
profile: build
|
|
@ ./lambda.exe -p profile/cpu.prof - < ./samples/$(TEST).txt > program.out
|
|
|
|
explain: build
|
|
@ ./lambda.exe -x -p profile/cpu.prof - < ./samples/$(TEST).txt > program.out
|
|
|
|
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
|