Creates profile directory in profile and explain targets to prevent errors on first run. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
40 lines
1.1 KiB
Makefile
40 lines
1.1 KiB
Makefile
BINARY_NAME=lambda
|
|
|
|
.PHONY: help it run profile explain graph clean
|
|
|
|
help:
|
|
@ echo "Available targets:"
|
|
@ echo " it - Build the lambda binary"
|
|
@ echo " run - Build and run with sample input (default: simple.txt)"
|
|
@ echo " profile - Build and run with CPU profiling enabled"
|
|
@ echo " explain - Run with explanation mode and profiling"
|
|
@ echo " graph - Generate CPU profile visualization"
|
|
@ echo " clean - Remove build artifacts"
|
|
@ echo ""
|
|
@ echo "Usage: make run TEST=<sample-name>"
|
|
|
|
it:
|
|
@ go build -o ${BINARY_NAME} ./cmd/lambda
|
|
|
|
TEST=simple
|
|
|
|
run: it
|
|
@ ./lambda - < ./samples/$(TEST).txt > program.out
|
|
|
|
profile: it
|
|
@ mkdir -p profile
|
|
@ ./lambda -p profile/cpu.prof - < ./samples/$(TEST).txt > program.out
|
|
|
|
explain: it
|
|
@ mkdir -p profile
|
|
@ ./lambda -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
|
|
@ echo "Profile graph saved to 'file://profile/cpu.svg'"
|
|
|
|
clean:
|
|
rm -f ${BINARY_NAME} program.out
|
|
rm -rf profile/
|