2018-12-13 16:33:37 +01:00
|
|
|
.POSIX:
|
|
|
|
|
2018-12-14 09:45:13 +01:00
|
|
|
MIFLORA_ADDR?=00:00:00:00:00:00
|
2018-12-23 12:35:33 +01:00
|
|
|
MIFLORAD_VERSION?=master
|
2018-12-14 09:45:13 +01:00
|
|
|
|
2018-12-16 23:33:13 +01:00
|
|
|
RUN_COMMAND=miflorad
|
|
|
|
RUN_OPTIONS=$(MIFLORA_ADDR)
|
|
|
|
|
2018-12-13 16:33:37 +01:00
|
|
|
.PHONY: all
|
|
|
|
all: clean build test
|
|
|
|
|
|
|
|
.PHONY: run
|
|
|
|
run: clean build test
|
2018-12-16 23:33:13 +01:00
|
|
|
sudo cmd/$(RUN_COMMAND)/$(RUN_COMMAND) $(RUN_OPTIONS)
|
2018-12-13 16:33:37 +01:00
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
2018-12-16 23:33:13 +01:00
|
|
|
rm -f cmd/munin-miflora/miflorad
|
2018-12-13 16:33:37 +01:00
|
|
|
rm -f cmd/munin-miflora/munin-miflora
|
2018-12-14 09:45:13 +01:00
|
|
|
rm -f cmd/munin-miflora/munin-miflora-gatt
|
2018-12-13 16:33:37 +01:00
|
|
|
|
|
|
|
.PHONY: build
|
2018-12-16 23:33:13 +01:00
|
|
|
build: cmd/munin-miflora/miflorad cmd/munin-miflora/munin-miflora cmd/munin-miflora/munin-miflora-gatt
|
2018-12-13 16:33:37 +01:00
|
|
|
|
|
|
|
.PHONY: test
|
|
|
|
test: build
|
2018-12-14 13:34:16 +01:00
|
|
|
cd common && go test -v -race && cd ..
|
2018-12-13 16:33:37 +01:00
|
|
|
|
2018-12-16 23:33:13 +01:00
|
|
|
.PHONY: remote-run
|
|
|
|
remote-run: clean
|
|
|
|
cd cmd/$(RUN_COMMAND) && CGO_ENABLED=0 GOOS=linux GOARCH=arm go build -ldflags="-s -w" && cd ../..
|
|
|
|
file cmd/$(RUN_COMMAND)/$(RUN_COMMAND)
|
|
|
|
scp cmd/$(RUN_COMMAND)/$(RUN_COMMAND) extzero:$(RUN_COMMAND)
|
|
|
|
ssh extzero "./$(RUN_COMMAND) $(RUN_OPTIONS)"
|
|
|
|
|
|
|
|
.PHONY: cmd/munin-miflora/miflorad
|
|
|
|
cmd/munin-miflora/miflorad:
|
2018-12-23 12:35:33 +01:00
|
|
|
cd cmd/miflorad && CGO_ENABLED=0 go build -ldflags "-X main.version=$(MIFLORAD_VERSION)" && cd ../..
|
2018-12-16 23:33:13 +01:00
|
|
|
|
2018-12-14 09:45:13 +01:00
|
|
|
.PHONY: cmd/munin-miflora/munin-miflora
|
2018-12-13 16:33:37 +01:00
|
|
|
cmd/munin-miflora/munin-miflora:
|
2018-12-15 20:44:52 +01:00
|
|
|
cd cmd/munin-miflora && CGO_ENABLED=0 go build && cd ../..
|
2018-12-14 09:45:13 +01:00
|
|
|
|
|
|
|
.PHONY: cmd/munin-miflora/munin-miflora-gatt
|
|
|
|
cmd/munin-miflora/munin-miflora-gatt:
|
2018-12-15 20:44:52 +01:00
|
|
|
cd cmd/munin-miflora-gatt && CGO_ENABLED=0 go build && cd ../..
|