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.
This commit is contained in:
parent
74e5734eae
commit
860e20c62d
@ -7,10 +7,17 @@ BUILD_LOG = build.log
|
|||||||
SYMLINK = build
|
SYMLINK = build
|
||||||
|
|
||||||
# brevity postprocessor; not exported, for toplevel use only
|
# brevity postprocessor; not exported, for toplevel use only
|
||||||
SHORTEN = $(shell \
|
SHORTEN = $(shell FILTER=; \
|
||||||
echo -n "| sed"; \
|
|
||||||
if [ -s "$(SYMLINK)" ]; then \
|
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; \
|
fi; \
|
||||||
echo -n " -e 's,$(TMP),\$$TMP,' -e 's,$(HOME),~,'"; \
|
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user