@ -16,6 +16,7 @@ GOPATH := $(firstword $(subst :, ,$(shell $(GO) env GOPATH)))
GOARCH := $( shell $( GO) env GOARCH)
GOHOSTARCH := $( shell $( GO) env GOHOSTARCH)
PROMTOOL ?= $( GOPATH) /bin/promtool
PROMU ?= $( GOPATH) /bin/promu
STATICCHECK ?= $( GOPATH) /bin/staticcheck
pkgs = $( shell $( GO) list ./... | grep -v /vendor/)
@ -48,6 +49,12 @@ else
test-e2e := skip-test-e2e
e n d i f
i f e q ( $( MACH ) , p p c 6 4 l e )
e2e-out = collector/fixtures/e2e-ppc64le-output.txt
e l s e
e2e-out = collector/fixtures/e2e-output.txt
e n d i f
# 64bit -> 32bit mapping for cross-checking. At least for amd64/386, the 64bit CPU can execute 32bit code but not the other way around, so we don't support cross-testing upwards.
cross-test = skip-test-32bit
d e f i n e g o a r c h _ p a i r
@ -65,7 +72,7 @@ $(eval $(call goarch_pair,arm64,arm))
$( eval $ ( call goarch_pair ,mips 64,mips ) )
$( eval $ ( call goarch_pair ,mips 64el ,mipsel ) )
all : format vet staticcheck build test $( cross -test ) $( test -e 2e )
all : format vet staticcheck checkmetrics build test $( cross -test ) $( test -e 2e )
style :
@echo ">> checking code style"
@ -93,6 +100,10 @@ test-e2e: build collector/fixtures/sys/.unpacked
skip-test-e2e :
@echo " >> SKIP running end-to-end tests on $( OS_detected) "
checkmetrics : $( PROMTOOL )
@echo ">> checking metrics for correctness"
./checkmetrics.sh $( PROMTOOL) $( e2e-out)
format :
@echo ">> formatting code"
@$( GO) fmt $( pkgs)
@ -124,6 +135,9 @@ test-docker:
@echo ">> testing docker image"
./test_image.sh " $( DOCKER_IMAGE_NAME) : $( DOCKER_IMAGE_TAG) " 9100
$(GOPATH)/bin/promtool promtool :
@GOOS= GOARCH = $( GO) get -u github.com/prometheus/prometheus/cmd/promtool
$(GOPATH)/bin/promu promu :
@GOOS= GOARCH = $( GO) get -u github.com/prometheus/promu
@ -131,10 +145,10 @@ $(GOPATH)/bin/staticcheck:
@GOOS= GOARCH = $( GO) get -u honnef.co/go/tools/cmd/staticcheck
.PHONY : all style format build test test -e 2e vet tarball docker promu staticcheck
.PHONY : all style format build test test -e 2e vet tarball docker promtool prom u staticcheck checkmetrics
# Declaring the binaries at their default locations as PHONY targets is a hack
# to ensure the latest version is downloaded on every make execution.
# If this is not desired, copy/symlink these binaries to a different path and
# set the respective environment variables.
.PHONY : $( GOPATH ) /bin /promu $( GOPATH ) /bin /staticcheck
.PHONY : $( GOPATH ) /bin /promtool $( GOPATH ) /bin /prom u $( GOPATH ) /bin /staticcheck