Tools written in Go for interfacing with Xiaomi Flora sensors for IoT use cases.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

47 lines
1.4 KiB

.POSIX:
MIFLORA_ADDR?=00:00:00:00:00:00
MIFLORAD_VERSION?=master
RUN_COMMAND=miflorad
RUN_OPTIONS=$(MIFLORA_ADDR)
.PHONY: all
all: clean build test
.PHONY: run
run: clean build test
sudo cmd/$(RUN_COMMAND)/$(RUN_COMMAND) $(RUN_OPTIONS)
.PHONY: clean
clean:
rm -f cmd/miflorad/miflorad
rm -f cmd/munin-miflora/munin-miflora
rm -f cmd/munin-miflora-gatt/munin-miflora-gatt
.PHONY: build
build: cmd/miflorad/miflorad cmd/munin-miflora/munin-miflora cmd/munin-miflora-gatt/munin-miflora-gatt
.PHONY: test
test: build
cd cmd/miflorad && go test -v -race && cd ../..
cd common && go test -v -race && cd ..
.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/miflorad/miflorad
cmd/miflorad/miflorad:
cd cmd/miflorad && CGO_ENABLED=0 go build -buildmode=pie -ldflags "-X main.version=$(MIFLORAD_VERSION)" && cd ../..
.PHONY: cmd/munin-miflora/munin-miflora
cmd/munin-miflora/munin-miflora:
cd cmd/munin-miflora && CGO_ENABLED=0 go build -buildmode=pie && cd ../..
.PHONY: cmd/munin-miflora-gatt/munin-miflora-gatt
cmd/munin-miflora-gatt/munin-miflora-gatt:
cd cmd/munin-miflora-gatt && CGO_ENABLED=0 go build -buildmode=pie && cd ../..