# InternetPressure.io probe agent — build / test / lint # # make build → dist/ip-probe-darwin-arm64, dist/ip-probe-linux-amd64 (static, stripped, version-stamped) # make test → go test ./... # make lint → gofmt check + go vet # make run-dev → build for the host and run with probe.dev.yaml (create it from probe.example.yaml) # make once T=www.cloudflare.com → one-shot checks against a target VERSION ?= $(shell cat VERSION) MODULE := internetpressure.io/probe-agent LDFLAGS := -s -w -X main.version=$(VERSION) GOFLAGS := -trimpath DIST := dist HOST_OS := $(shell go env GOOS) HOST_ARCH := $(shell go env GOARCH) T ?= www.cloudflare.com .PHONY: all build build-host test lint vet fmt run-dev once clean checksums all: lint test build build: $(DIST)/ip-probe-darwin-arm64 $(DIST)/ip-probe-linux-amd64 checksums $(DIST)/ip-probe-darwin-arm64: $(shell find . -name '*.go' -not -path './dist/*') go.mod go.sum VERSION @mkdir -p $(DIST) CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o $@ . $(DIST)/ip-probe-linux-amd64: $(shell find . -name '*.go' -not -path './dist/*') go.mod go.sum VERSION @mkdir -p $(DIST) CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o $@ . # Convenience: a binary for the machine running make (used by run-dev / once). build-host: @mkdir -p $(DIST) CGO_ENABLED=0 go build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o $(DIST)/ip-probe . checksums: @cd $(DIST) && shasum -a 256 ip-probe-darwin-arm64 ip-probe-linux-amd64 > SHA256SUMS && cat SHA256SUMS test: go test ./... vet: go vet ./... fmt: @test -z "$$(gofmt -l . | grep -v '^dist/')" || (echo "gofmt needed on:" && gofmt -l . && exit 1) lint: fmt vet run-dev: build-host ./$(DIST)/ip-probe run --config probe.dev.yaml once: build-host ./$(DIST)/ip-probe once --target $(T) clean: rm -rf $(DIST)