2022-08-16 07:09:40 +00:00
|
|
|
.PHONY: all release dev manpages install deb-pkg deb-pkg-broken clean uninstall run run-dialog
|
2022-05-04 00:05:06 +00:00
|
|
|
|
2022-05-14 03:19:25 +00:00
|
|
|
DESTDIR ?=
|
2022-05-04 00:05:06 +00:00
|
|
|
PREFIX ?= /usr/local
|
|
|
|
BINDIR ?= $(PREFIX)/bin
|
|
|
|
LIBEXECDIR ?= $(PREFIX)/libexec
|
2022-05-05 08:14:53 +00:00
|
|
|
DATADIR ?= $(PREFIX)/share
|
2022-05-12 05:37:04 +00:00
|
|
|
MANDIR ?= $(DATADIR)/man
|
2022-05-04 00:05:06 +00:00
|
|
|
|
2022-05-05 08:14:53 +00:00
|
|
|
APPLICATIONS_DIR = $(DATADIR)/applications
|
2022-05-12 05:37:38 +00:00
|
|
|
DOC_DIR = $(DATADIR)/doc/bscreensaver
|
2022-05-04 00:05:06 +00:00
|
|
|
HELPER_DIR = $(LIBEXECDIR)/bscreensaver
|
2022-05-12 05:37:04 +00:00
|
|
|
|
|
|
|
HELPERS := \
|
2022-05-04 00:05:06 +00:00
|
|
|
bscreensaver-dbus-service \
|
|
|
|
bscreensaver-systemd \
|
|
|
|
bscreensaver-dialog-gtk3 \
|
|
|
|
$(NULL)
|
|
|
|
|
2022-05-12 05:37:04 +00:00
|
|
|
BINARIES := \
|
|
|
|
bscreensaver \
|
|
|
|
bscreensaver-command \
|
|
|
|
bscreensaver-settings \
|
|
|
|
$(NULL)
|
|
|
|
|
|
|
|
TARGETS := \
|
|
|
|
$(BINARIES) \
|
|
|
|
$(HELPERS) \
|
|
|
|
$(NULL)
|
|
|
|
|
|
|
|
DEV_OUT = target/debug
|
|
|
|
RELEASE_OUT = target/release
|
|
|
|
|
|
|
|
SOURCES := $(find . -name '*.rs') $(find . -name Cargo.toml) Cargo.lock
|
|
|
|
DEV_TARGETS := $(addprefix $(DEV_OUT),$(TARGETS))
|
|
|
|
RELEASE_TARGETS := $(addprefix $(RELEASE_OUT),$(TARGETS))
|
|
|
|
|
|
|
|
MANPAGES := \
|
|
|
|
bscreensaver.1.gz \
|
|
|
|
bscreensaver-command.1.gz \
|
|
|
|
$(NULL)
|
|
|
|
RELEASE_MANPAGES := $(addprefix $(RELEASE_OUT)/,$(MANPAGES))
|
|
|
|
|
2022-05-04 00:05:06 +00:00
|
|
|
INSTALL ?= install
|
2022-05-12 05:37:04 +00:00
|
|
|
HELP2MAN ?= help2man
|
2022-05-04 00:05:06 +00:00
|
|
|
|
|
|
|
DEV_LOG_LEVEL = debug
|
|
|
|
|
2022-05-12 05:37:38 +00:00
|
|
|
all: release manpages $(RELEASE_OUT)/bscreensaver-settings.desktop
|
2022-05-04 00:05:06 +00:00
|
|
|
|
2022-05-12 05:37:04 +00:00
|
|
|
release: $(RELEASE_TARGETS)
|
2022-05-04 00:05:06 +00:00
|
|
|
|
2022-05-12 05:37:04 +00:00
|
|
|
dev: $(DEV_TARGETS)
|
|
|
|
|
|
|
|
manpages: $(RELEASE_MANPAGES)
|
2022-05-04 00:05:06 +00:00
|
|
|
|
2022-05-12 05:37:38 +00:00
|
|
|
install: all
|
|
|
|
$(INSTALL) -m 0755 -d $(addprefix $(DESTDIR),$(BINDIR) $(HELPER_DIR) $(DOC_DIR) $(APPLICATIONS_DIR) $(MANDIR)/man1)
|
2022-05-12 05:37:04 +00:00
|
|
|
$(INSTALL) -m 0755 $(addprefix $(RELEASE_OUT)/,$(BINARIES)) $(DESTDIR)$(BINDIR)
|
|
|
|
$(INSTALL) -m 0755 $(addprefix $(RELEASE_OUT)/,$(HELPERS)) $(DESTDIR)$(HELPER_DIR)
|
2022-05-12 05:37:38 +00:00
|
|
|
$(INSTALL) -m 0644 bscreensaver.toml.example $(DESTDIR)$(DOC_DIR)
|
|
|
|
$(INSTALL) -m 0644 $(RELEASE_OUT)/bscreensaver-settings.desktop $(DESTDIR)$(APPLICATIONS_DIR)
|
2022-05-12 05:37:04 +00:00
|
|
|
$(INSTALL) -m 0644 $(RELEASE_MANPAGES) $(DESTDIR)$(MANDIR)/man1
|
|
|
|
|
|
|
|
$(DEV_TARGETS): $(SOURCES)
|
2024-08-02 18:21:48 +00:00
|
|
|
HELPER_DIR=$(shell pwd)/target/debug cargo build
|
2022-05-12 05:37:04 +00:00
|
|
|
|
|
|
|
$(RELEASE_TARGETS): $(SOURCES)
|
2022-05-14 03:33:41 +00:00
|
|
|
HELPER_DIR=$(HELPER_DIR) cargo build --release
|
2022-05-12 05:37:04 +00:00
|
|
|
|
|
|
|
$(RELEASE_OUT)/%.1.gz: $(RELEASE_OUT)/%.1
|
2022-05-12 05:37:38 +00:00
|
|
|
mkdir -p $(dir $@)
|
2022-05-12 05:37:04 +00:00
|
|
|
gzip -c -k $< > $@
|
|
|
|
|
|
|
|
$(RELEASE_OUT)/%.1: $(RELEASE_TARGETS)
|
2022-05-12 05:37:38 +00:00
|
|
|
mkdir -p $(dir $@)
|
2022-05-12 05:37:04 +00:00
|
|
|
$(HELP2MAN) --no-info $(subst .1,,$@) > $@
|
2022-05-04 00:05:06 +00:00
|
|
|
|
2022-05-12 05:37:38 +00:00
|
|
|
$(RELEASE_OUT)/bscreensaver-settings.desktop: settings/bscreensaver-settings.desktop.in
|
|
|
|
mkdir -p $(dir $@)
|
|
|
|
sed -e 's:@BINDIR@:$(BINDIR):g' $< > $@
|
|
|
|
|
2022-08-16 07:09:40 +00:00
|
|
|
deb-pkg: manpages $(RELEASE_OUT)/bscreensaver-settings.desktop
|
|
|
|
HELPER_DIR=$(HELPER_DIR) cargo deb --manifest-path locker/Cargo.toml --deb-revision 1
|
|
|
|
|
|
|
|
# Recently this stopped working because bookworm only has rust 1.59, but recent versions
|
|
|
|
# of the zbus crate require rust 1.60.
|
|
|
|
deb-pkg-broken:
|
2022-05-14 03:36:37 +00:00
|
|
|
@[ "$(RELEASE_VERSION)" ] || { echo "RELEASE_VERSION not set" >&2; exit 1; }
|
2022-05-12 05:37:38 +00:00
|
|
|
sudo rm -rf docker-out
|
2022-05-14 07:15:03 +00:00
|
|
|
docker build -t bscreensaver-build:latest .
|
2022-05-12 05:37:38 +00:00
|
|
|
mkdir docker-out
|
2022-05-14 07:15:03 +00:00
|
|
|
docker run --rm -v $(shell pwd)/docker-out:/bscreensaver-build:rw bscreensaver-build:latest bash -c '\
|
|
|
|
cp -a /bscreensaver /bscreensaver-build/bscreensaver-$(RELEASE_VERSION) && \
|
|
|
|
cd /bscreensaver-build && \
|
2022-05-12 05:37:38 +00:00
|
|
|
tar cvzf bscreensaver_$(RELEASE_VERSION).orig.tar.gz bscreensaver-$(RELEASE_VERSION) && \
|
|
|
|
cd bscreensaver-$(RELEASE_VERSION) && \
|
2022-05-14 07:15:03 +00:00
|
|
|
debuild -uc -us && \
|
|
|
|
rm -rf /bscreensaver-build/bscreensaver'
|
2022-05-12 05:37:38 +00:00
|
|
|
|
2022-05-04 00:05:06 +00:00
|
|
|
clean:
|
2022-05-14 03:33:41 +00:00
|
|
|
cargo clean
|
2022-05-04 00:05:06 +00:00
|
|
|
|
|
|
|
uninstall:
|
2022-05-12 05:37:04 +00:00
|
|
|
rm -f $(addprefix $(DESTDIR)$(BINDIR),$(BINARIES)) $(addprefix $(HELPER_DIR)/,$(HELPERS))) || true
|
|
|
|
rm -f $(addprefix $(DESTDIR)$(MANDIR)/man1/,$(MANPAGES))
|
2022-05-12 05:37:38 +00:00
|
|
|
rm -f $(DESTDIR)$(APPLICATIONS_DIR)/bscreensaver-settings.desktop
|
|
|
|
rm -f $(DESTDIR)$(DOC_DIR)/bscreensaver.toml.example
|
|
|
|
rmdir -p $(addprefix $(DESTDIR),$(BINDIR) $(HELPER_DIR) $(APPLICATIONS_DIR) $(DOC_DIR) $(MANDIR)/man1) || true
|
2022-05-04 00:05:06 +00:00
|
|
|
|
2022-05-12 05:37:04 +00:00
|
|
|
run: $(DEV_TARGETS)
|
2022-05-04 00:05:06 +00:00
|
|
|
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 \
|
2022-05-14 03:33:41 +00:00
|
|
|
cargo run --bin bscreensaver
|
2022-05-04 06:47:06 +00:00
|
|
|
|
|
|
|
run-dialog:
|
|
|
|
RUST_BACKTRACE=1 \
|
|
|
|
BSCREENSAVER_DIALOG_GTK3_LOG=$(DEV_LOG_LEVEL) \
|
|
|
|
BSCREENSAVER_DIALOG_STANDALONE=1 \
|
2022-05-14 03:33:41 +00:00
|
|
|
cargo run --bin bscreensaver-dialog-gtk3
|