[commit: ghc] master: Build system: make clean in utils/ghc-pkg should not delete inplace/lib/bin (0d20d76)

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


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

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

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

commit 0d20d769b2c2aadd62cdbf557f891e9a7bdbc510
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date:   Thu May 28 11:57:07 2015 +0200

    Build system: make clean in utils/ghc-pkg should not delete inplace/lib/bin
    
    Make sure $1_$2_PROG always gets assigned a value, even when cleaning.
    
    The problem with not setting the variable becomes apparent when looking
    at the following two lines of code:
    
    ```
      $1_$2_INPLACE = $$(INPLACE_LIB)/bin/$$($1_$2_PROG)
      $(call clean-target,$1,$2_inplace,$$($1_$2_INPLACE))
    ```
    
    So running `make clean` in for example `utils/ghc-pkg` deletes
    `inplace/lib/bin/` instead of `inplace/lib/bin/ghc-pkg`.
    
    The offending code was introduced in commit
    2b85372ca18115bb1d6363256fcea6f54e415bed.
    
    There is one small implication. When cleaning before configure, the
    variable $1_$2_PROG will now be assigned a slightly wrong value, because
    exeext$3 isn't known yet. But I think that's ok, as no files have been
    build yet, so it will just try to delete a slighly different nonexistent
    file.
    
    [skip ci]
    
    Differential Revision: https://phabricator.haskell.org/D916


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

0d20d769b2c2aadd62cdbf557f891e9a7bdbc510
 rules/build-prog.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rules/build-prog.mk b/rules/build-prog.mk
index b32a7a0..10d31c5 100644
--- a/rules/build-prog.mk
+++ b/rules/build-prog.mk
@@ -29,8 +29,8 @@ endif
 ifneq "$$($1_$2_PROG)" ""
 $$(error $1_$2_PROG is set)
 endif
-$1_$2_PROG = $$($1_$2_PROGNAME)$$(exeext$3)
 endif
+$1_$2_PROG = $$($1_$2_PROGNAME)$$(exeext$3)
 
 ifeq "$$(findstring $3,0 1 2)" ""
 $$(error $1/$2: stage argument to build-prog should be 0, 1, or 2)



More information about the ghc-commits mailing list