bscreensaver/Makefile

67 lines
2.2 KiB
Makefile

.PHONY: all release dev install clean uninstall run run-dialog
DESTDIR ?= =
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
LIBEXECDIR ?= $(PREFIX)/libexec
SYSCONFDIR ?= $(PREFIX)/etc
DATADIR ?= $(PREFIX)/share
APPLICATIONS_DIR = $(DATADIR)/applications
CONFIG_DIR = $(SYSCONFDIR)/xdg/bscreensaver
HELPER_DIR = $(LIBEXECDIR)/bscreensaver
HELPERS = \
bscreensaver-dbus-service \
bscreensaver-systemd \
bscreensaver-dialog-gtk3 \
$(NULL)
INSTALL ?= install
RUST_RELEASE_CHANNEL = nightly
ifeq ($(RUST_RELEASE_CHANNEL),nightly)
RUST_RELEASE_CHANNEL_ARG = +nightly
else
FEATURES_ARGS = --no-default-features
endif
DEV_LOG_LEVEL = debug
all: release
release:
HELPER_DIR=$(HELPER_DIR) cargo $(RUST_RELEASE_CHANNEL_ARG) build $(FEATURES_ARGS) --release
dev:
HELPER_DIR=target/debug cargo $(RUST_RELEASE_CHANNEL_ARG) build $(FEATURES_ARGS)
install: release
$(INSTALL) -m 0755 -d $(addprefix $(DESTDIR),$(BINDIR) $(HELPER_DIR) $(CONFIG_DIR) $(APPLICATIONS_DIR))
$(INSTALL) -m 0755 target/release/bscreensaver target/release/bscreensaver-command target/release/bscreensaver-settings $(DESTDIR)$(BINDIR)
$(INSTALL) -m 0755 $(addprefix target/release/,$(HELPERS)) $(DESTDIR)$(HELPER_DIR)
$(INSTALL) -m 0644 bscreensaver.toml.example $(DESTDIR)$(CONFIG_DIR)
$(INSTALL) -m 0644 settings/bscreensaver-settings.desktop $(DESTDIR)$(APPLICATIONS_DIR)
clean:
cargo $(RUST_RELEASE_CHANNEL_ARG) clean
uninstall:
rm -f $(addprefix $(DESTDIR),$(BINDIR)/bscreensaver $(BINDIR)/bscreensaver-command $(BINDIR)/bscreensaver-settings $(addprefix $(HELPER_DIR)/,$(HELPERS))) || true
rmdir -p $(addprefix $(DESTDIR),$(BINDIR) $(HELPER_DIR) $(APPLICATIONS_DIR)) || true
run: 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 $(RUST_RELEASE_CHANNEL_ARG) run $(FEATURES_ARGS) --bin bscreensaver
run-dialog:
RUST_BACKTRACE=1 \
BSCREENSAVER_DIALOG_GTK3_LOG=$(DEV_LOG_LEVEL) \
BSCREENSAVER_DIALOG_STANDALONE=1 \
cargo $(RUST_RELEASE_CHANNEL_ARG) run $(FEATURES_ARGS) --bin bscreensaver-dialog-gtk3