-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
66 lines (57 loc) · 1.79 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
UNAME := $(shell uname -m)
VERSION := 0.1-7
ROOT := sqlsprinkler_$(VERSION)_$(ARCH)
default:
$(MAKE) build
check:
@echo "Checking for armv7l on" $(UNAME)
ifeq ($(UNAME), x86_64)
@cross clippy --target armv7-unknown-linux-gnueabihf
else
cargo clippy
endif
test:
@echo "Checking for armv7l on" $(UNAME)
ifeq ($(UNAME), x86_64)
@cross test --target armv7-unknown-linux-gnueabihf
else
cargo test
endif
fmt:
@echo "Formatting"
cargo fmt
build:
@echo "Building for arm on" $(UNAME)
ifeq ($(UNAME), x86_64)
$(MAKE) build-arm
else
@cargo build --release
endif
build-arm:
@cross build --target arm-unknown-linux-gnueabihf --release
install-service:
cp -v systemd/sqlsprinkler-daemon.service /etc/systemd/system
install: deb
dpkg -i $(ROOT).deb
clean:
-rm *.deb
-rm -rf ./$(ROOT)/
cargo clean
deb: build-arm
@install -dm755 $(ROOT)
@install -Dm755 target/arm-unknown-linux-gnueabihf/release/sqlsprinkler-cli $(ROOT)/usr/bin/sqlsprinkler
@install -Dm755 conf/sqlsprinkler.conf $(ROOT)/etc/sqlsprinkler/sqlsprinkler.conf
@install -Dm755 systemd/sqlsprinkler-daemon.service $(ROOT)/lib/systemd/system/sqlsprinkler-daemon.service
@install -Dm755 systemd/sqlsprinkler-mqtt-daemon.service $(ROOT)/lib/systemd/system/sqlsprinkler-mqtt-daemon.service
@install -dm755 $(ROOT)/DEBIAN
@touch $(ROOT)/DEBIAN/control
@install -Dm755 conf/preinst $(ROOT)/DEBIAN/preinst
@install -Dm755 conf/postinst $(ROOT)/DEBIAN/postinst
@install -Dm755 conf/conffiles $(ROOT)/DEBIAN/conffiles
@echo "Package: sqlsprinkler\n\
Version: $(VERSION)\n\
Architecture: armhf\n\
Maintainer: Gavin Pease <gavinpease@gmail.com>\n\
Description: The command line and daemon for sqlsprinkler" > $(ROOT)/DEBIAN/control
@chmod 755 -R $(ROOT)/DEBIAN
@dpkg-deb -Zxz --build --root-owner-group $(ROOT)