Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lx9FNLG2CqeBbVGGd9bFsP
51 lines
1.4 KiB
Makefile
51 lines
1.4 KiB
Makefile
GO ?= go
|
|
TAGS ?= vmembed
|
|
LDFLAGS := -s -w
|
|
BIN := nmon
|
|
PG_DSN ?= postgres://nmon:nmon@localhost:55432/nmon?sslmode=disable
|
|
|
|
.PHONY: all 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
|
|
|
|
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
|