Files
lambda/Makefile
M.V. Hutz 0260a065cb refactor: move TEST variable to top of Makefile
Moved TEST variable declaration to the top with other configuration variables for better organization.
2026-01-11 16:04:11 -05:00

38 lines
1.2 KiB
Makefile

BINARY_NAME=lambda.exe
TEST=simple
.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}
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