Improve makefile, add autogenerated manpages
This commit is contained in:
parent
050bf5cbac
commit
712467f433
69
Makefile
69
Makefile
@ -1,4 +1,4 @@
|
||||
.PHONY: all release dev install clean uninstall run run-dialog
|
||||
.PHONY: all release dev manpages install clean uninstall run run-dialog
|
||||
|
||||
DESTDIR ?= =
|
||||
PREFIX ?= /usr/local
|
||||
@ -6,17 +6,44 @@ BINDIR ?= $(PREFIX)/bin
|
||||
LIBEXECDIR ?= $(PREFIX)/libexec
|
||||
SYSCONFDIR ?= $(PREFIX)/etc
|
||||
DATADIR ?= $(PREFIX)/share
|
||||
MANDIR ?= $(DATADIR)/man
|
||||
|
||||
APPLICATIONS_DIR = $(DATADIR)/applications
|
||||
CONFIG_DIR = $(SYSCONFDIR)/xdg/bscreensaver
|
||||
HELPER_DIR = $(LIBEXECDIR)/bscreensaver
|
||||
HELPERS = \
|
||||
|
||||
HELPERS := \
|
||||
bscreensaver-dbus-service \
|
||||
bscreensaver-systemd \
|
||||
bscreensaver-dialog-gtk3 \
|
||||
$(NULL)
|
||||
|
||||
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))
|
||||
|
||||
INSTALL ?= install
|
||||
HELP2MAN ?= help2man
|
||||
|
||||
RUST_RELEASE_CHANNEL = nightly
|
||||
ifeq ($(RUST_RELEASE_CHANNEL),nightly)
|
||||
@ -27,29 +54,43 @@ endif
|
||||
|
||||
DEV_LOG_LEVEL = debug
|
||||
|
||||
all: release
|
||||
all: release manpages
|
||||
|
||||
release:
|
||||
HELPER_DIR=$(HELPER_DIR) cargo $(RUST_RELEASE_CHANNEL_ARG) build $(FEATURES_ARGS) --release
|
||||
release: $(RELEASE_TARGETS)
|
||||
|
||||
dev:
|
||||
HELPER_DIR=target/debug cargo $(RUST_RELEASE_CHANNEL_ARG) build $(FEATURES_ARGS)
|
||||
dev: $(DEV_TARGETS)
|
||||
|
||||
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)
|
||||
manpages: $(RELEASE_MANPAGES)
|
||||
|
||||
install: release manpages
|
||||
$(INSTALL) -m 0755 -d $(addprefix $(DESTDIR),$(BINDIR) $(HELPER_DIR) $(CONFIG_DIR) $(APPLICATIONS_DIR) $(MANDIR)/man1)
|
||||
$(INSTALL) -m 0755 $(addprefix $(RELEASE_OUT)/,$(BINARIES)) $(DESTDIR)$(BINDIR)
|
||||
$(INSTALL) -m 0755 $(addprefix $(RELEASE_OUT)/,$(HELPERS)) $(DESTDIR)$(HELPER_DIR)
|
||||
$(INSTALL) -m 0644 bscreensaver.toml.example $(DESTDIR)$(CONFIG_DIR)
|
||||
$(INSTALL) -m 0644 settings/bscreensaver-settings.desktop $(DESTDIR)$(APPLICATIONS_DIR)
|
||||
$(INSTALL) -m 0644 $(RELEASE_MANPAGES) $(DESTDIR)$(MANDIR)/man1
|
||||
|
||||
$(DEV_TARGETS): $(SOURCES)
|
||||
HELPER_DIR=target/debug cargo $(RUST_RELEASE_CHANNEL_ARG) build $(FEATURES_ARGS)
|
||||
|
||||
$(RELEASE_TARGETS): $(SOURCES)
|
||||
HELPER_DIR=$(HELPER_DIR) cargo $(RUST_RELEASE_CHANNEL_ARG) build $(FEATURES_ARGS) --release
|
||||
|
||||
$(RELEASE_OUT)/%.1.gz: $(RELEASE_OUT)/%.1
|
||||
gzip -c -k $< > $@
|
||||
|
||||
$(RELEASE_OUT)/%.1: $(RELEASE_TARGETS)
|
||||
$(HELP2MAN) --no-info $(subst .1,,$@) > $@
|
||||
|
||||
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
|
||||
rm -f $(addprefix $(DESTDIR)$(BINDIR),$(BINARIES)) $(addprefix $(HELPER_DIR)/,$(HELPERS))) || true
|
||||
rm -f $(addprefix $(DESTDIR)$(MANDIR)/man1/,$(MANPAGES))
|
||||
rmdir -p $(addprefix $(DESTDIR),$(BINDIR) $(HELPER_DIR) $(APPLICATIONS_DIR) $(MANDIR)/man1) || true
|
||||
|
||||
run: dev
|
||||
run: $(DEV_TARGETS)
|
||||
BSCREENSAVER_LOCAL_DEV=1 \
|
||||
RUST_BACKTRACE=1 \
|
||||
BSCREENSAVER_LOG=$(DEV_LOG_LEVEL) \
|
||||
|
@ -2,7 +2,7 @@
|
||||
Version=1.0
|
||||
Name=Screensaver Settings
|
||||
Comment=Customize screensaver settings
|
||||
Exec=bscreensaver-settings
|
||||
Exec=@BINDIR@/bscreensaver-settings
|
||||
Icon=screensaver
|
||||
Terminal=false
|
||||
StartupNotify=true
|
Loading…
Reference in New Issue
Block a user