summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorManos Pitsidianakis <el13635@mail.ntua.gr>2020-05-19 12:57:09 +0300
committerManos Pitsidianakis <el13635@mail.ntua.gr>2020-05-19 12:57:09 +0300
commitf8961f493a4374385f55df48bf58cf22a8330145 (patch)
treeb888f8250cbd00d98491ec58613599ecad301a23 /Makefile
parentfb2bb74c5ca65dca543e636855429b7f34e1e70f (diff)
downloadmeli-f8961f493a4374385f55df48bf58cf22a8330145.zip
Makefile: expand paths
Makefile displays a warning if $MANDIR is not in your manpaths or $BINDIR is not in your $PATH. Expand paths $PREFIX (and by association $BINDIR and $MANDIR) before doing that validation or otherwise paths like '~/.local' and '/home/user/.local' will be erroneously reported different
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile11
1 files changed, 6 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 8c831cd7..206e8830 100644
--- a/Makefile
+++ b/Makefile
@@ -19,8 +19,9 @@
# Options
PREFIX ?= /usr/local
-BINDIR ?= ${PREFIX}/bin
-MANDIR ?= ${PREFIX}/share/man
+EXPANDED_PREFIX := `cd ${PREFIX} && pwd -P`
+BINDIR ?= ${EXPANDED_PREFIX}/bin
+MANDIR ?= ${EXPANDED_PREFIX}/share/man
CARGO_TARGET_DIR ?= target
MIN_RUSTC ?= 1.39.0
@@ -30,7 +31,7 @@ CARGO_BIN ?= cargo
MANPAGES ?= meli.1 meli.conf.5 meli-themes.5
FEATURES ?= --features "${MELI_FEATURES}"
-MANPATHS := `manpath 2> /dev/null`
+MANPATHS = `ACCUM="";for m in \`manpath 2> /dev/null | tr ':' ' '\`; do if [ -d "$${m}" ]; then REAL_PATH=\`cd $${m} && pwd\` ACCUM="$${ACCUM}:$${REAL_PATH}";fi;done;echo -n $${ACCUM} | sed 's/^://'`
VERSION ?= `sed -n "s/^version\s*=\s*\"\(.*\)\"/\1/p" Cargo.toml`
# Output parameters
@@ -60,7 +61,7 @@ help:
@echo " - ${BOLD}deb-dist${ANSI_RESET} (builds debian package in the parent directory)"
@echo " - ${BOLD}distclean${ANSI_RESET} (cleans distribution build artifacts)"
@echo "\nENVIRONMENT variables of interest:"
- @echo "* PREFIX = ${UNDERLINE}${PREFIX}${ANSI_RESET}"
+ @echo "* PREFIX = ${UNDERLINE}${EXPANDED_PREFIX}${ANSI_RESET}"
@echo -n "* MELI_FEATURES = ${UNDERLINE}"
@[ -z $${MELI_FEATURES+x} ] && echo -n "unset" || echo -n ${MELI_FEATURES}
@echo ${ANSI_RESET}
@@ -69,7 +70,7 @@ help:
@echo -n "* MANPATH = ${UNDERLINE}"
@[ $${MANPATH+x} ] && echo -n $${MANPATH} || echo -n "unset"
@echo ${ANSI_RESET}
- @echo "* output of manpath(1) = ${UNDERLINE}${MANPATHS}${ANSI_RESET}"
+ @echo "* (cleaned) output of manpath(1) = ${UNDERLINE}${MANPATHS}${ANSI_RESET}"
@echo -n "* NO_MAN ${UNDERLINE}"
@[ $${NO_MAN+x} ] && echo -n "set" || echo -n "unset"
@echo ${ANSI_RESET}