-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
66 lines (55 loc) · 1.35 KB
/
Makefile
File metadata and controls
66 lines (55 loc) · 1.35 KB
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
# #
# Development tasks
# #
# Remote machine configuration
# You can override this settings via .env file
SSH_HOST=raspberrypi.local
SSH_USER=raspberrypi
SSH_PORT=22
include .env
export
INSTALL_DIR=/opt/rc.machine
SERVER_TARGET=armv7-unknown-linux-musleabihf
# #
# Client tasks
# #
#
# Run GUI client on the local machine
#
default: run_optimized
run_optimized:
cargo fmt
RUST_BACKTRACE=full RUST_LOG=client=debug cargo run --release
run:
cargo fmt
RUST_BACKTRACE=full RUST_LOG=client=debug cargo run
# #
# Server tasks (via SSH)
# #
#
# Build and upload armv7 binary to the remote Raspberry PI machine
#
sync:
@echo "Build and upload rc.machine files to $(SSH_HOST):$(INSTALL_DIR)..."
cargo build --release --workspace=server --bin=server --target=$(SERVER_TARGET)
rsync -e "ssh -p $(SSH_PORT)" Settings.toml "$(SSH_USER)@$(SSH_HOST):$(INSTALL_DIR)"
rsync -e "ssh -p $(SSH_PORT)" ./target/$(SERVER_TARGET)/release/server "$(SSH_USER)@$(SSH_HOST):$(INSTALL_DIR)"
ssh -t -p $(SSH_PORT) $(SSH_USER)@$(SSH_HOST) "sudo systemctl restart rc.server"
@echo "Done"
#
# Listen logs
#
# To setup:
# > sudo usermod -a -G systemd-journal %username%
tail:
@echo "Starring rc.server server on $(SSH_HOST)..."
ssh -t -p $(SSH_PORT) $(SSH_USER)@$(SSH_HOST) "tail -f /var/log/rc.server.log -n 120"
@echo "Done"
# #
# Common tasks
# #
#
# Remove cache
#
clean:
rm -rf target