# Makefile de sysagent. Solo envuelve comandos estándar de Go: todo puede # hacerse también a mano (ver README.md). VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo 0.1.0) LDFLAGS := -s -w -X main.version=$(VERSION) BIN := sysagent .PHONY: all build test race vet fmt check cross install clean live all: check build build: go build -trimpath -ldflags "$(LDFLAGS)" -o $(BIN) ./cmd/sysagent test: go test ./... # Requiere gcc (CGO) para el detector de carreras. race: CGO_ENABLED=1 go test -race ./... vet: go vet ./... fmt: gofmt -w . # Lo que exige §99 antes de dar el proyecto por terminado. check: @test -z "$$(gofmt -l .)" || (echo "gofmt needed:"; gofmt -l .; exit 1) go vet ./... go test ./... cross: GOOS=linux GOARCH=amd64 go build -trimpath -ldflags "$(LDFLAGS)" -o $(BIN)-amd64 ./cmd/sysagent GOOS=linux GOARCH=arm64 go build -trimpath -ldflags "$(LDFLAGS)" -o $(BIN)-arm64 ./cmd/sysagent install: build install -m 0755 $(BIN) /usr/local/bin/$(BIN) # Pruebas contra servicios reales de Internet (NVD, Debian, buscador). live: go test -tags live -run Live -v ./internal/tools clean: rm -f $(BIN) $(BIN)-amd64 $(BIN)-arm64