mirror of
https://github.com/steinhobelgruen/netatmo-exporter.git
synced 2024-11-24 10:13:56 +00:00
Extend Makefile for selecting architecture
This commit is contained in:
parent
99cf36faed
commit
380405edfe
4
Makefile
4
Makefile
|
@ -1,6 +1,8 @@
|
||||||
.PHONY: all test build-binary install clean
|
.PHONY: all test build-binary install clean
|
||||||
|
|
||||||
GO ?= go
|
GO ?= go
|
||||||
|
GO_OS ?= linux
|
||||||
|
GO_ARCH ?= amd64
|
||||||
GO_CMD := CGO_ENABLED=0 $(GO)
|
GO_CMD := CGO_ENABLED=0 $(GO)
|
||||||
GIT_VERSION := $(shell git describe --tags --dirty)
|
GIT_VERSION := $(shell git describe --tags --dirty)
|
||||||
VERSION := $(GIT_VERSION:v%=%)
|
VERSION := $(GIT_VERSION:v%=%)
|
||||||
|
@ -12,7 +14,7 @@ test:
|
||||||
$(GO_CMD) test -cover ./...
|
$(GO_CMD) test -cover ./...
|
||||||
|
|
||||||
build-binary:
|
build-binary:
|
||||||
$(GO_CMD) build -tags netgo -ldflags "-w -X main.Version=$(VERSION) -X main.GitCommit=$(GIT_COMMIT)" -o netatmo-exporter .
|
GOOS=$(GO_OS) GOARCH=$(GO_ARCH) $(GO_CMD) build -tags netgo -ldflags "-w -X main.Version=$(VERSION) -X main.GitCommit=$(GIT_COMMIT)" -o netatmo-exporter .
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f netatmo-exporter
|
rm -f netatmo-exporter
|
||||||
|
|
13
README.md
13
README.md
|
@ -19,14 +19,21 @@ If you have a working Go installation, getting the binary should be as simple as
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/xperimental/netatmo-exporter
|
git clone https://github.com/xperimental/netatmo-exporter
|
||||||
cd netatmo-exporter
|
cd netatmo-exporter
|
||||||
go build .
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
There is also a `build-arm.sh` script if you want to run the exporter on an ARMv7 device.
|
If you want to build the exporter for a different OS or architecture, you can specify arguments to the Makefile:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# For 32-bit ARM on Linux
|
||||||
|
make GO_ARCH=arm
|
||||||
|
# For 64-bit ARM on Linux
|
||||||
|
make GO_ARCH=arm64
|
||||||
|
```
|
||||||
|
|
||||||
## NetAtmo client credentials
|
## NetAtmo client credentials
|
||||||
|
|
||||||
This application tries to get data from the NetAtmo API. For that to work you will need to create an application in the [NetAtmo developer console](https://dev.netatmo.com/dev/myaccount), so that you can get a Client ID and secret.
|
This application tries to get data from the NetAtmo API. For that to work you will need to create an application in the [NetAtmo developer console](https://dev.netatmo.com/apps/), so that you can get a Client ID and secret.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
#!/bin/bash -e
|
|
||||||
|
|
||||||
echo "Build binary..."
|
|
||||||
GOOS=linux GOARCH=arm go build -v -ldflags="-s -w" .
|
|
||||||
|
|
||||||
type upx && {
|
|
||||||
echo "Packing using upx..."
|
|
||||||
upx -9 netatmo-exporter
|
|
||||||
} || echo "upx not available"
|
|
Loading…
Reference in a new issue