forked from boynux/squid-exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
28 lines (20 loc) · 775 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
.PHONY: all clean
all: 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/boynux/squid-exporter/vendor/github.com/prometheus/common/version.Version=$(VERSION) \
-X github.com/boynux/squid-exporter/vendor/github.com/prometheus/common/version.Revision=$(REVISION) \
-X github.com/boynux/squid-exporter/vendor/github.com/prometheus/common/version.Branch=$(BRANCH)
$(EXE): $(SRC)
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '$(LDFLAGS)' -o $(EXE) .
test:
go test -v ./...
build: $(EXE)
docker:
docker build -t squid-exporter .
clean:
rm -f $(EXE)