64 lines
1.2 KiB
Makefile
64 lines
1.2 KiB
Makefile
.PHONY: all build test fmt lint clean install
|
|
|
|
all: fmt lint test build
|
|
|
|
build:
|
|
go build -o hdmistat ./cmd/hdmistat
|
|
|
|
test: fmt-check lint
|
|
go test -v ./...
|
|
|
|
fmt:
|
|
go fmt ./...
|
|
|
|
fmt-check:
|
|
@echo "Checking formatting..."
|
|
@test -z "$$(gofmt -l . | grep -v '^vendor/')" || (echo "Files need formatting. Run 'make fmt'" && gofmt -l . | grep -v '^vendor/' && exit 1)
|
|
|
|
lint:
|
|
golangci-lint run
|
|
|
|
clean:
|
|
rm -f hdmistat fbsimplestat fbhello
|
|
go clean
|
|
|
|
install: build
|
|
sudo cp hdmistat /usr/local/bin/
|
|
|
|
# Development helpers
|
|
.PHONY: run run-daemon
|
|
|
|
run: build
|
|
./hdmistat
|
|
|
|
run-daemon: build
|
|
sudo ./hdmistat daemon
|
|
|
|
# Dependencies
|
|
.PHONY: deps
|
|
|
|
deps:
|
|
go mod download
|
|
go mod tidy
|
|
|
|
# VM Testing
|
|
.PHONY: vmtest
|
|
|
|
vmtest:
|
|
cd test/qemu-ubuntu-test && ./run-qemu.sh
|
|
|
|
# Debug build
|
|
.PHONY: debug
|
|
|
|
debug:
|
|
go build -gcflags="all=-N -l" -o hdmistat-debug ./cmd/hdmistat
|
|
@echo "Debug build complete: hdmistat-debug"
|
|
@echo ""
|
|
@echo "Debug features:"
|
|
@echo " - SIGUSR1 dumps all goroutine stack traces"
|
|
@echo " - Built with debug symbols (-N -l)"
|
|
@echo ""
|
|
@echo "To debug a hang:"
|
|
@echo " kill -USR1 <pid> # Dump goroutines"
|
|
@echo " kill -QUIT <pid> # Also dumps goroutines (Go default)"
|