-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from peschmae/feature/merge-kully
Feature/merge kully
- Loading branch information
Showing
11 changed files
with
528 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,56 @@ | ||
.PHONY: clean run | ||
## | ||
# | ||
.DEFAULT_GOAL := help | ||
.PHONY: generate go-tools | ||
|
||
linux: | ||
GOOS=linux GOARCH=amd64 go build -o output/mystrom-exporter_linux-amd64 | ||
mac: | ||
GOOS=darwin GOARCH=amd64 go build -o output/mystrom-exporter_mac-amd64 | ||
arm64: | ||
GOOS=linux GOARCH=arm64 go build -o output/mystrom-exporter_linux-arm64 | ||
arm: | ||
GOOS=linux GOARCH=arm go build -o output/mystrom-exporter_linux-arm | ||
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 | ||
|
||
all: linux mac arm64 arm | ||
BINDIR := $(CURDIR)/output | ||
GO ?= go | ||
GOPATH ?= $(shell $(GO) env GOPATH) | ||
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 | ||
GOX_FLAGS := -mod=vendor | ||
GO_BUILD_FLAGS := -v | ||
export GO111MODULE := on | ||
|
||
build: go-tools generate ## builds the all platform binaries of the exporter | ||
$(GOPATH)/bin/gox \ | ||
-os="darwin linux" \ | ||
-arch="amd64 arm arm64" \ | ||
-osarch="!darwin/arm" \ | ||
-output "${BINDIR}/{{.Dir}}-{{.OS}}-{{.Arch}}" \ | ||
-gcflags "$(GO_BUILD_FLAGS)" \ | ||
-ldflags '$(LDFLAGS)' \ | ||
-tags '$(TAGS)' \ | ||
./... | ||
|
||
run: | ||
${BINDIR}/mystrom-exporter-$(shell $(GO) env GOOS)-$(shell $(GO) env GOARCH) | ||
|
||
|
||
generate: go-tools | ||
$(GO) generate ./... | ||
|
||
go-tools: $(GOPATH)/bin/stringer $(GOPATH)/bin/gox | ||
|
||
# -- see more info on https://pkg.go.dev/golang.org/x/tools/cmd/stringer | ||
$(GOPATH)/bin/stringer: | ||
$(GO) install golang.org/x/tools/cmd/stringer@latest | ||
|
||
$(GOPATH)/bin/gox: | ||
$(GO) install github.com/mitchellh/gox@latest | ||
# -- | ||
help: | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.