36 lines
1.1 KiB
Makefile
36 lines
1.1 KiB
Makefile
BINARY_NAME=rpicontrol
|
|
GIT_COMMIT=$(shell git rev-list -1 HEAD --abbrev-commit)-$(shell date +%y%m%d_%H%M%S)
|
|
VERSION=1.0.1
|
|
|
|
get:
|
|
go get .
|
|
build_rpi: get
|
|
GOARCH=arm GOOS=linux go build -ldflags "-X main.GitCommit=${GIT_COMMIT} -X main.Version=${VERSION} -X main.Arch=${GOARCH}" -o ${BINARY_NAME} main.go
|
|
build_linux: get
|
|
GOARCH=amd64 GOOS=linux go build -ldflags "-X main.GitCommit=${GIT_COMMIT} -X main.Version=${VERSION} -X main.Arch=${GOARCH}" -o ${BINARY_NAME} main.go
|
|
|
|
run:
|
|
./${BINARY_NAME} -config rpicontrol.conf.example -log info
|
|
|
|
build_and_run: build run
|
|
|
|
clean:
|
|
go clean
|
|
-rm ${BINARY_NAME}
|
|
-rm -fr install
|
|
-rm -f rpicontrol-${VERSION}.tar.gz
|
|
pack:
|
|
mkdir -p install/etc/rpicontrol
|
|
mkdir -p install/usr/lib/systemd/system
|
|
mkdir -p install/usr/bin
|
|
cp rpicontrol.conf.example install/etc/rpicontrol/rpicontrol.conf.example
|
|
cp rpicontrol.service install/usr/lib/systemd/system/rpicontrol.service
|
|
cp rpicontrol install/usr/bin
|
|
tar cfvz rpicontrol-${VERSION}.tar.gz -C "install/" .
|
|
|
|
deploy:
|
|
tar xfvz rpicontrol-${VERSION}.tar.gz -C /
|
|
systemctl daemon-reload
|
|
systemctl start rpicontrol
|
|
|