summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2014-04-24 22:38:38 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2014-04-24 22:38:38 +0200
commitf4e068268ca15e1623d038acc33abd04a24a2f5f (patch)
tree310308a0ce8f21225d394a00a733e72c3242a14f /Makefile
parent24c535e41b71cf6fdc22216b3c4196264e247880 (diff)
downloadpass-f4e068268ca15e1623d038acc33abd04a24a2f5f.tar.gz
pass-f4e068268ca15e1623d038acc33abd04a24a2f5f.tar.bz2
pass-f4e068268ca15e1623d038acc33abd04a24a2f5f.zip
Makefile: osx/bsd does not support -D
Diffstat (limited to '')
-rw-r--r--Makefile47
1 files changed, 23 insertions, 24 deletions
diff --git a/Makefile b/Makefile
index 836ff91..cce093b 100644
--- a/Makefile
+++ b/Makefile
@@ -6,47 +6,45 @@ MANDIR ?= $(PREFIX)/share/man
PLATFORMFILE := src/platform/$(shell uname | cut -d _ -f 1 | tr '[:upper:]' '[:lower:]').sh
+BASHCOMP_PATH ?= $(DESTDIR)$(PREFIX)/share/bash-completion/completions
+ZSHCOMP_PATH ?= $(DESTDIR)$(PREFIX)/share/zsh/site-functions
+FISHCOMP_PATH ?= $(DESTDIR)$(PREFIX)/share/fish/completions
+
ifeq ($(FORCE_ALL),1)
FORCE_BASHCOMP := 1
FORCE_ZSHCOMP := 1
FORCE_FISHCOMP := 1
endif
-
-ifeq ($(FORCE_BASHCOMP),1)
-BASHCOMP_SWITCH := "-D"
-else
-BASHCOMP_SWITCH :=
+ifneq ($(strip $(wildcard $(BASHCOMP_PATH))),)
+FORCE_BASHCOMP := 1
endif
-ifeq ($(FORCE_ZSHCOMP),1)
-ZSHCOMP_SWITCH := "-D"
-else
-ZSHCOMP_SWITCH :=
+ifneq ($(strip $(wildcard $(ZSHCOMP_PATH))),)
+FORCE_ZSHCOMP := 1
endif
-ifeq ($(FORCE_FISHCOMP),1)
-FISHCOMP_SWITCH := "-D"
-else
-FISHCOMP_SWITCH :=
+ifneq ($(strip $(wildcard $(FISHCOMP_PATH))),)
+FORCE_FISHCOMP := 1
endif
all:
@echo "Password store is a shell script, so there is nothing to do. Try \"make install\" instead."
install-common:
- @install -m 0644 -v -D man/pass.1 "$(DESTDIR)$(MANDIR)/man1/pass.1"
-
- @install -m 0644 -v $(BASHCOMP_SWITCH) src/completion/pass.bash-completion "$(DESTDIR)$(PREFIX)/share/bash-completion/completions/pass" 2>/dev/null || echo "** Bash completion file skipped. **"
- @install -m 0644 -v $(ZSHCOMP_SWITCH) src/completion/pass.zsh-completion "$(DESTDIR)$(PREFIX)/share/zsh/site-functions/_pass" 2>/dev/null || echo "** Zsh completion file skipped. **"
- @install -m 0644 -v $(FISHCOMP_SWITCH) src/completion/pass.fish-completion "$(DESTDIR)$(PREFIX)/share/fish/completions/pass.fish" 2>/dev/null || echo "** Fish completion file skipped. **"
+ @mkdir -p "$(DESTDIR)$(MANDIR)/man1" && install -m 0644 -v man/pass.1 "$(DESTDIR)$(MANDIR)/man1/pass.1"
+
+ @[ "$(FORCE_BASHCOMP)" == "1" ] && mkdir -p "$(BASHCOMP_PATH)" && install -m 0644 -v src/completion/pass.bash-completion "$(BASHCOMP_PATH)/pass" || true
+ @[ "$(FORCE_ZSHCOMP)" == "1" ] && mkdir -p "$(ZSHCOMP_PATH)" && install -m 0644 -v src/completion/pass.zsh-completion "$(ZSHCOMP_PATH)/_pass" || true
+ @[ "$(FORCE_FISHCOMP)" == "1" ] && mkdir -p "$(FISHCOMP_PATH)" && install -m 0644 -v src/completion/pass.fish-completion "$(FISHCOMP_PATH)/pass.fish" || true
+
ifneq ($(strip $(wildcard $(PLATFORMFILE))),)
install: install-common
- @install -m 0644 -v -D "$(PLATFORMFILE)" "$(DESTDIR)$(LIBDIR)/password-store/platform.sh"
- @mkdir -p -v "$(DESTDIR)$(BINDIR)/"
+ @mkdir -p "$(DESTDIR)$(LIBDIR)/password-store" && install -m 0644 -v "$(PLATFORMFILE)" "$(DESTDIR)$(LIBDIR)/password-store/platform.sh"
+ @mkdir -p "$(DESTDIR)$(BINDIR)/"
sed 's:.*PLATFORM_FUNCTION_FILE.*:source "$(DESTDIR)$(LIBDIR)/password-store/platform.sh":' src/password-store.sh > "$(DESTDIR)$(BINDIR)/pass"
@chmod 0755 "$(DESTDIR)$(BINDIR)/pass"
else
install: install-common
- @mkdir -p -v "$(DESTDIR)$(BINDIR)/"
+ @mkdir -p "$(DESTDIR)$(BINDIR)/"
sed '/PLATFORM_FUNCTION_FILE/d' src/password-store.sh > "$(DESTDIR)$(BINDIR)/pass"
@chmod 0755 "$(DESTDIR)$(BINDIR)/pass"
endif
@@ -56,9 +54,10 @@ uninstall:
"$(DESTDIR)$(BINDIR)/pass" \
"$(DESTDIR)$(LIBDIR)/password-store/" \
"$(DESTDIR)$(MANDIR)/man1/pass.1" \
- "$(DESTDIR)$(PREFIX)/share/bash-completion/completions/pass" \
- "$(DESTDIR)$(PREFIX)/share/zsh/site-functions/_pass" \
- "$(DESTDIR)$(PREFIX)/share/fish/completions/pass.fish"
+ "$(BASHCOMP_PATH)/pass" \
+ "$(ZSHCOMP_PATH)/_pass" \
+ "$(FISHCOMP_PATH)/pass.fish"
+ @rmdir "$(DESTDIR)$(LIBDIR)/password-store/" 2>/dev/null || true
TESTS = $(sort $(wildcard tests/t[0-9][0-9][0-9][0-9]-*.sh))