1
0
mirror of https://github.com/cmur2/miflorad.git synced 2024-10-31 14:56:18 +01:00
miflorad/Makefile

56 lines
2.1 KiB
Makefile
Raw Normal View History

2018-12-13 16:33:37 +01:00
.POSIX:
MIFLORA_ADDR?=00:00:00:00:00:00
2018-12-23 12:35:33 +01:00
MIFLORAD_VERSION?=master
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
sudo cmd/$(RUN_COMMAND)/$(RUN_COMMAND) $(RUN_OPTIONS)
2018-12-13 16:33:37 +01:00
.PHONY: clean
clean:
2018-12-25 22:16:46 +01:00
rm -f cmd/miflorad/miflorad
2018-12-13 16:33:37 +01:00
rm -f cmd/munin-miflora/munin-miflora
2018-12-25 22:16:46 +01:00
rm -f cmd/munin-miflora-gatt/munin-miflora-gatt
2018-12-13 16:33:37 +01:00
.PHONY: build
2018-12-25 22:16:46 +01:00
build: cmd/miflorad/miflorad cmd/munin-miflora/munin-miflora cmd/munin-miflora-gatt/munin-miflora-gatt
2018-12-13 16:33:37 +01:00
.PHONY: test
test: build
cd cmd/miflorad && go test -v -race && cd ../..
2018-12-14 13:34:16 +01:00
cd common && go test -v -race && cd ..
2018-12-13 16:33:37 +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: release
release:
mkdir -p pkg
cd cmd/miflorad && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o "../../pkg/miflorad-$(MIFLORAD_VERSION)-linux-amd64" -ldflags="-s -w -X main.version=$(MIFLORAD_VERSION)" && cd ../..
cd cmd/miflorad && CGO_ENABLED=0 GOOS=linux GOARCH=arm go build -o "../../pkg/miflorad-$(MIFLORAD_VERSION)-linux-arm" -ldflags="-s -w -X main.version=$(MIFLORAD_VERSION)" && cd ../..
# github-release "v$(MIFLORAD_VERSION)" pkg/miflorad-$(MIFLORAD_VERSION)-* --commit "master" --tag "v$(MIFLORAD_VERSION)" --prerelease --github-repository "cmur2/miflorad"
github-release "v$(MIFLORAD_VERSION)" pkg/miflorad-$(MIFLORAD_VERSION)-* --commit "master" --tag "v$(MIFLORAD_VERSION)" --github-repository "cmur2/miflorad"
2018-12-25 22:16:46 +01:00
.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
2018-12-13 16:33:37 +01:00
cmd/munin-miflora/munin-miflora:
cd cmd/munin-miflora && CGO_ENABLED=0 go build -buildmode=pie && cd ../..
2018-12-25 22:16:46 +01:00
.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 ../..