34 lines
866 B
Makefile
34 lines
866 B
Makefile
# Variables
|
|
BIN_NAME = rms-server
|
|
SERVICE_FILE = rms-server.service
|
|
BIN_DEST = /usr/local/bin/$(BIN_NAME)
|
|
SERVICE_DEST = /etc/systemd/system/$(SERVICE_FILE)
|
|
|
|
# Targets
|
|
all:
|
|
@echo "Usage:"
|
|
@echo ""
|
|
@echo "make compile: only compile"
|
|
@echo "make install_bin: only move the bin to /usr/local/bin"
|
|
@echo "make install_service: only install the service file to /etc/systemd/system"
|
|
@echo "make install: compile, then install both the service file and bin"
|
|
@echo "make uninstall: remove the bin and service file"
|
|
|
|
install: compile install_bin install_service
|
|
|
|
compile:
|
|
cargo build --release
|
|
|
|
install_bin:
|
|
sudo cp target/release/$(BIN_NAME) $(BIN_DEST)
|
|
|
|
install_service:
|
|
sudo cp $(SERVICE_FILE) $(SERVICE_DEST)
|
|
sudo systemctl daemon-reload
|
|
|
|
uninstall:
|
|
sudo systemctl stop rms-server
|
|
sudo rm -r $(SERVICE_DEST) $(BIN_DEST) target
|
|
sudo systemctl daemon-reload
|
|
|