diff --git a/Makefile b/Makefile index 6eb7310..74860f8 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ .PHONY: all release dev install clean uninstall run run-dialog +DESTDIR ?= = PREFIX ?= /usr/local BINDIR ?= $(PREFIX)/bin LIBEXECDIR ?= $(PREFIX)/libexec @@ -35,19 +36,18 @@ dev: HELPER_DIR=target/debug cargo $(RUST_RELEASE_CHANNEL_ARG) build $(FEATURES_ARGS) install: release - $(INSTALL) -m 0755 -d $(BINDIR) $(HELPER_DIR) $(CONFIG_DIR) $(APPLICATIONS_DIR) - $(INSTALL) -m 0755 target/release/bscreensaver target/release/bscreensaver-command target/release/bscreensaver-settings $(BINDIR) - $(INSTALL) -m 0755 $(addprefix target/release/,$(HELPERS)) $(HELPER_DIR) - $(INSTALL) -m 0644 bscreensaver.toml.example $(CONFIG_DIR) - $(INSTALL) -m 0644 settings/bscreensaver-settings.desktop $(APPLICATIONS_DIR) + $(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 $(BINDIR)/bscreensaver $(BINDIR)/bscreensaver-command $(BINDIR)/bscreensaver-settings $(addprefix $(HELPER_DIR)/,$(HELPERS)) || true - rmdir -p $(BINDIR) $(HELPER_DIR) || true - rmdir -p $(PREFIX) || true + 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 \