diff options
author | Thomas Miedema <thomasmiedema@gmail.com> | 2015-05-28 18:59:29 +0200 |
---|---|---|
committer | Thomas Miedema <thomasmiedema@gmail.com> | 2015-05-30 17:03:46 +0200 |
commit | 0a159e3ad7a56da41a7336fcec79d9ba37cd40cb (patch) | |
tree | 98489ebd8d2296af7523cef3962c3cd936fe42d8 /rules/shell-wrapper.mk | |
parent | 0d20d769b2c2aadd62cdbf557f891e9a7bdbc510 (diff) | |
download | haskell-0a159e3ad7a56da41a7336fcec79d9ba37cd40cb.tar.gz |
Build system: don't use supposedly local variable inside macro
There is no support for local variables inside `make` macros (defined
using the `define` keyword), see
[wiki:Building/Architecture/Idiom/Macros].
In this case `make show VALUE=INPLACE_WRAPPER` would print some bogus
value ("inplace/bin/mkUserGuidePart" actually, from the last BUILD_DIRS
entry in ghc.mk that calls shell-wrapper), and using that variable
somewhere might be a bug.
Test Plan:
I checked the rules directory with the following crude regexp, and this
seems the be the only real offender.
grep -P '^[^ $#\t][^$]*[^+]=' rules/*
What it is supposed to do (from right to left):
* look for variable assignments
* but not updates (+=)
* where the variable name doesn't contain any dollar signs
* and the line doesn't start with whitespace or a comment
[skip ci]
Differential Revision: https://phabricator.haskell.org/D918
Diffstat (limited to 'rules/shell-wrapper.mk')
-rw-r--r-- | rules/shell-wrapper.mk | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/rules/shell-wrapper.mk b/rules/shell-wrapper.mk index 6b84072537..dac90169cb 100644 --- a/rules/shell-wrapper.mk +++ b/rules/shell-wrapper.mk @@ -26,18 +26,18 @@ ifeq "$$($1_$2_WANT_INPLACE_WRAPPER)" "YES" $1_$2_INPLACE_SHELL_WRAPPER_NAME = $$($1_$2_PROG) ifeq "$$($1_$2_TOPDIR)" "YES" -INPLACE_WRAPPER = $$(INPLACE_LIB)/$$($1_$2_INPLACE_SHELL_WRAPPER_NAME) +$1_$2_INPLACE_WRAPPER = $$(INPLACE_LIB)/$$($1_$2_INPLACE_SHELL_WRAPPER_NAME) else -INPLACE_WRAPPER = $$(INPLACE_BIN)/$$($1_$2_INPLACE_SHELL_WRAPPER_NAME) +$1_$2_INPLACE_WRAPPER = $$(INPLACE_BIN)/$$($1_$2_INPLACE_SHELL_WRAPPER_NAME) endif -all_$1_$2 : $$(INPLACE_WRAPPER) +all_$1_$2 : $$($1_$2_INPLACE_WRAPPER) -$$(INPLACE_WRAPPER): WRAPPER=$$@ +$$($1_$2_INPLACE_WRAPPER): WRAPPER=$$@ ifeq "$$($1_$2_SHELL_WRAPPER)" "YES" -$$(INPLACE_WRAPPER): $$($1_$2_SHELL_WRAPPER_NAME) +$$($1_$2_INPLACE_WRAPPER): $$($1_$2_SHELL_WRAPPER_NAME) endif -$$(INPLACE_WRAPPER): $$($1_$2_INPLACE) +$$($1_$2_INPLACE_WRAPPER): $$($1_$2_INPLACE) $$(call removeFiles, $$@) echo '#!$$(SHELL)' >> $$@ echo 'executablename="$$(TOP)/$$<"' >> $$@ |