[commit: ghc] master: Build system: don't use supposedly local variable inside macro (0a159e3)

git at git.haskell.org git at git.haskell.org
Sat May 30 15:08:58 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/0a159e3ad7a56da41a7336fcec79d9ba37cd40cb/ghc

>---------------------------------------------------------------

commit 0a159e3ad7a56da41a7336fcec79d9ba37cd40cb
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date:   Thu May 28 18:59:29 2015 +0200

    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


>---------------------------------------------------------------

0a159e3ad7a56da41a7336fcec79d9ba37cd40cb
 rules/shell-wrapper.mk | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/rules/shell-wrapper.mk b/rules/shell-wrapper.mk
index 6b84072..dac9016 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)/$$<"'                                  >> $$@



More information about the ghc-commits mailing list