GO ?= go TAGS ?= vmembed LDFLAGS := -s -w BIN := nmon PG_DSN ?= postgres://nmon:nmon@localhost:55432/nmon?sslmode=disable .PHONY: all lint lint-go lint-web build importer build-arm64 build-noembed fetch-vm web test test-integration test-pg test-v6only vet gate-m1 gate-m2 gate-m3 gate-m4 gate-m5 gate-m6 clean all: build fetch-vm: ./scripts/fetch-vm.sh # The UI is built first when web/ exists so embed.FS picks it up. web: @if [ -f web/package.json ]; then cd web && npm ci --no-audit --no-fund && npm run build; fi build: fetch-vm CGO_ENABLED=0 $(GO) build -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o $(BIN) ./cmd/nmon build-arm64: fetch-vm CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $(GO) build -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o $(BIN)-arm64 ./cmd/nmon importer: CGO_ENABLED=0 $(GO) build -ldflags '$(LDFLAGS)' -o nmon-librenms-import ./cmd/nmon-librenms-import build-noembed: CGO_ENABLED=0 $(GO) build -ldflags '$(LDFLAGS)' -o $(BIN) ./cmd/nmon GOLANGCI := go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.14.0 # Hard rule (docs/MAINTAINABILITY.md): every gate runs this first and it must be clean. lint: lint-go lint-web lint-go: $(GOLANGCI) run ./... ./scripts/lint-filesize.sh lint-web: @if [ -f web/package.json ]; then cd web && npm run lint; fi vet: $(GO) vet ./... test: $(GO) test -race ./... # Integration tests use fixtures and a real VictoriaMetrics binary extracted by fetch-vm. test-integration: fetch-vm $(GO) test -race -tags 'integration $(TAGS)' ./... test-pg: ./scripts/test-pg.sh test-v6only: NMON_TEST_V6ONLY=1 $(GO) test -race -tags 'integration $(TAGS)' ./... gate-m1 gate-m2 gate-m3 gate-m4 gate-m5 gate-m6: gate-m%: ./scripts/gate-m$*.sh clean: rm -f $(BIN) $(BIN)-arm64 nmon-librenms-import