2021-12-23 15:17:58 +01:00
|
|
|
##
|
|
|
|
#
|
|
|
|
.DEFAULT_GOAL := help
|
2021-11-12 12:03:22 +01:00
|
|
|
|
2021-12-23 15:17:58 +01:00
|
|
|
version := $(shell git describe --tags --always)
|
|
|
|
revision := $(shell git rev-parse HEAD)
|
|
|
|
branch := $(shell git rev-parse --abbrev-ref HEAD)
|
|
|
|
builduser := $(shell whoami)
|
|
|
|
builddate := $(shell date '+%FT%T_%Z')
|
|
|
|
|
|
|
|
versionPkgPrefix := mystrom-exporter/pkg/version
|
|
|
|
|
|
|
|
LDFLAGS := -w -s \
|
|
|
|
-X $(versionPkgPrefix).Version=${version} \
|
|
|
|
-X $(versionPkgPrefix).Revision=${revision} \
|
|
|
|
-X $(versionPkgPrefix).Branch=${branch} \
|
|
|
|
-X $(versionPkgPrefix).BuildUser=${builduser} \
|
|
|
|
-X $(versionPkgPrefix).BuildDate=${builddate}
|
|
|
|
GOFLAGS := -v
|
|
|
|
|
|
|
|
linux: ## builds the linux version of the exporter
|
|
|
|
GOOS=linux GOARCH=amd64 go build $(GOFLAGS) -ldflags '$(LDFLAGS)'
|
|
|
|
mac: ## builds the macos version of the exporter
|
|
|
|
GOOS=darwin GOARCH=amd64 go build $(GOFLAGS) -ldflags '$(LDFLAGS)'
|
2021-12-23 16:36:04 +01:00
|
|
|
mac-arm: ## builds the macos (m1) version of the exporter
|
|
|
|
GOOS=darwin GOARCH=arm64 go build $(GOFLAGS) -ldflags '$(LDFLAGS)'
|
2021-11-12 12:03:22 +01:00
|
|
|
arm64:
|
2021-12-23 15:17:58 +01:00
|
|
|
GOOS=linux GOARCH=arm64 go build $(GOFLAGS) -ldflags '$(LDFLAGS)'
|
2021-11-12 12:03:22 +01:00
|
|
|
arm:
|
2021-12-23 15:17:58 +01:00
|
|
|
GOOS=linux GOARCH=arm go build $(GOFLAGS) -ldflags '$(LDFLAGS)'
|
2021-11-12 12:03:22 +01:00
|
|
|
|
2021-12-23 15:17:58 +01:00
|
|
|
# --
|
|
|
|
help:
|
|
|
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|