Commit 860e20c6 authored by Michael Shigorin's avatar Michael Shigorin

lib/common.mk: avoid using uninitialized variables

It somehow managed to evade me that $(TMP) might be uninitialized; definitely should be checked before stuffing into sed substitution command. NB: this could be done in pure make but my take was less readable. Thanks shadowsbrother/gmail for hitting and reporting this.
parent 74e5734e
......@@ -7,10 +7,17 @@ BUILD_LOG = build.log
SYMLINK = build
# brevity postprocessor; not exported, for toplevel use only
SHORTEN = $(shell \
echo -n "| sed"; \
SHORTEN = $(shell FILTER=; \
if [ -s "$(SYMLINK)" ]; then \
echo -n " -e 's,$(BUILDDIR),$(SYMLINK),'"; \
FILTER=" -e 's,$(BUILDDIR),$(SYMLINK),'"; \
fi; \
if [ -n "$$TMP" ]; then \
FILTER="$$FILTER -e 's,$$TMP,\$$TMP,'"; \
fi; \
if [ -n "$$HOME" ]; then \
FILTER="$$FILTER -e 's,$$HOME,~,'"; \
fi; \
if [ -n "$$FILTER" ]; then \
echo -n "| sed $$FILTER"; \
fi; \
echo -n " -e 's,$(TMP),\$$TMP,' -e 's,$(HOME),~,'"; \
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment