Files
mqtt2prometheus/Makefile
Christoph Petrausch 1de13bc192 Migrate to go modules
2020-04-21 22:17:42 +02:00

42 lines
671 B
Makefile

ifndef GOPATH
GOPATH:=$(shell go env GOPATH)
endif
ifndef GOBIN
GOBIN:=$(GOPATH)/bin
endif
ifndef GOARCH
GOARCH:=$(shell go env GOARCH)
endif
ifndef GOOS
GOOS:=$(shell go env GOOS)
endif
ifndef GOARM
GOARM:=$(shell go env GOARM)
endif
ifndef TARGET_FILE
TARGET_FILE:=bin/mqtt2prometheus.$(GOOS)_$(GOARCH)$(GOARM)
endif
all: build
GO111MODULE=on
test:
go test ./...
go vet ./...
build:
GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $(TARGET_FILE) ./cmd
static_build:
CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $(TARGET_FILE) -a -tags netgo -ldflags '-w -extldflags "-static"' ./cmd
container:
docker build -t mqtt2prometheus:latest .