Build system: don't use supposedly local variable inside macro
authorThomas Miedema <thomasmiedema@gmail.com>
Thu, 28 May 2015 16:59:29 +0000 (18:59 +0200)
committerThomas Miedema <thomasmiedema@gmail.com>
Sat, 30 May 2015 15:03:46 +0000 (17:03 +0200)
commit0a159e3ad7a56da41a7336fcec79d9ba37cd40cb
tree98489ebd8d2296af7523cef3962c3cd936fe42d8
parent0d20d769b2c2aadd62cdbf557f891e9a7bdbc510
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
rules/shell-wrapper.mk