bscreensaver/Makefile

57 lines
1.4 KiB
Makefile

.PHONY: all build build-dev install clean uninstall run
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
LIBEXECDIR ?= $(PREFIX)/libexec
SYSCONFDIR ?= $(PREFIX)/etc
CONFIG_DIR = $(SYSCONFDIR)/xdg/bscreensaver
HELPER_DIR = $(LIBEXECDIR)/bscreensaver
HELPERS = \
bscreensaver-dbus-service \
bscreensaver-systemd \
bscreensaver-dialog-gtk3 \
$(NULL)
INSTALL ?= install
DEV_LOG_LEVEL = debug
all: build
build:
HELPER_DIR=$(HELPER_DIR) cargo build --release
build-dev:
HELPER_DIR=target/debug cargo build
install: build
$(INSTALL) -m 0755 -d $(BINDIR) $(HELPER_DIR) $(CONFIG_DIR)
$(INSTALL) -m 0755 target/release/bscreensaver $(BINDIR)
$(INSTALL) -m 0755 $(addprefix target/release/,$(HELPERS)) $(HELPER_DIR)
$(INSTALL) -m 0644 bscreensaver.toml.example $(CONFIG_DIR)
clean:
cargo clean
uninstall:
rm -f $(BINDIR)/bscreensaver $(addprefix $(HELPER_DIR)/,$(HELPERS)) || true
rmdir -p $(BINDIR) $(HELPER_DIR) || true
rmdir -p $(PREFIX) || true
run: build-dev
BSCREENSAVER_LOCAL_DEV=1 \
RUST_BACKTRACE=1 \
BSCREENSAVER_LOG=$(DEV_LOG_LEVEL) \
BSCREENSAVER_DBUS_SERVICE_LOG=$(DEV_LOG_LEVEL) \
BSCREENSAVER_SYSTEMD_LOG=$(DEV_LOG_LEVEL) \
BSCREENSAVER_DIALOG_GTK3_LOG=$(DEV_LOG_LEVEL) \
HELPER_DIR=target/debug \
cargo run --bin bscreensaver
run-dialog:
RUST_BACKTRACE=1 \
BSCREENSAVER_DIALOG_GTK3_LOG=$(DEV_LOG_LEVEL) \
BSCREENSAVER_DIALOG_STANDALONE=1 \
cargo run --bin bscreensaver-dialog-gtk3