-
-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathMakefile
34 lines (24 loc) · 728 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
.PHONY: all fmt vet test build docker clean
all: fmt vet test build
EXE = ./bin/squid-exporter
SRC = $(shell find . -type f -name '*.go')
VERSION ?= $(shell cat VERSION)
REVISION = $(shell git rev-parse HEAD)
BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
LDFLAGS = -extldflags "-s -w -static" \
-X github.com/prometheus/common/version.Version=$(VERSION) \
-X github.com/prometheus/common/version.Revision=$(REVISION) \
-X github.com/prometheus/common/version.Branch=$(BRANCH)
$(EXE): $(SRC)
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '$(LDFLAGS)' -o $(EXE) .
fmt:
go fmt ./...
vet:
go vet ./...
test:
go test -v ./...
build: $(EXE)
docker:
docker build -t squid-exporter .
clean:
rm -f $(EXE)