-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile
46 lines (33 loc) · 1.56 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
VERSIONFILE=version.txt
VERSION=`cat $(VERSIONFILE)`
build:
go build .
release: build-rpi build-linux build-macos build-windows
build-rpi:
mkdir -p build/release-$(VERSION)
env GOOS=linux GOARCH=arm GOARM=7 go build -o build/release-$(VERSION)/prometheus-klipper-exporter-rpi-armv7-$(VERSION) .
env GOOS=linux GOARCH=arm64 go build -o build/release-$(VERSION)/prometheus-klipper-exporter-rpi-arm64-$(VERSION) .
build-linux:
mkdir -p build/release-$(VERSION)
env GOOS=linux GOARCH=amd64 go build -o build/release-$(VERSION)/prometheus-klipper-exporter-linux-amd64-$(VERSION) .
build-macos:
mkdir -p build/release-$(VERSION)
env GOOS=darwin GOARCH=amd64 go build -o build/release-$(VERSION)/prometheus-klipper-exporter-macos-amd64-$(VERSION) .
env GOOS=darwin GOARCH=arm64 go build -o build/release-$(VERSION)/prometheus-klipper-exporter-macos-arm64-$(VERSION) .
build-windows:
mkdir -p build/release-$(VERSION)
env GOOS=windows GOARCH=amd64 go build -o build/release-$(VERSION)/prometheus-klipper-exporter-windows-amd64-$(VERSION).exe .
build-docker:
docker build -t klipper-exporter .
clean:
rm -rf build/release-$(VERSION)/*
fmt:
(cd collector && go fmt)
go fmt
run:
go run .
install:
scp build/release-$(VERSION)/prometheus-klipper-exporter-rpi-armv7-$(VERSION) [email protected]:klipper-exporter/
ssh [email protected] "rm klipper-exporter/prometheus-klipper-exporter && ln -s prometheus-klipper-exporter-rpi-armv7-$(VERSION) klipper-exporter/prometheus-klipper-exporter"
ssh [email protected] "sudo systemctl restart klipper-exporter.service"
.PHONY: build