Repository: spack/spack

Issue:
Installation issue: suite-sparse
SuiteSparse fails to install with version 5.6.0, version 5.3.0 still works haven't tried 5.4.0 etc.

This looks like it is because the `INSTALL` config option is being set during build but the SuiteSparse README recommends only doing that during install

Relevant README lines

```
  When compiling the libraries, do NOT use the INSTALL=... options for
  installing. Just do:
  
      make

.....
Now you can install the libraries, if you wish, in a location other than
  SuiteSparse/lib, SuiteSparse/include, and SuiteSparse/share/doc, using
  'make install INSTALL=...'

````

This probably succeeds on some machines if SuiteSparse libraries like amd are found in the default library path



---

### Steps to reproduce the issue

```console
$ spack install suite-sparse # version 5.6.0

/home/wortiz/spack/lib/spack/env/gcc/gcc -O3 -fPIC -fno-common -fexceptions   -O3 -fexceptions -fPIC  -I../../include -o amd_simple amd_simple.c -L/home/wortiz/spack/opt/spack/linux-ubuntu18.04-haswell/gcc-9.2.1/suite-sparse-5.6.0-mbzgajdyrup6nqxdvqjrpintl5ja5ld7/lib -L../../lib -lamd -lsuitesparseconfig -lm -lrt -Wl,-rpath=/home/wortiz/spack/opt/spack/linux-ubuntu18.04-haswell/gcc-9.2.1/suite-sparse-5.6.0-mbzgajdyrup6nqxdvqjrpintl5ja5ld7/lib
./amd_simple > my_amd_simple.out
./amd_simple: error while loading shared libraries: libamd.so.2: cannot open shared object file: No such file or directory
Makefile:45: recipe for target 'amd_simple' failed

```

### Platform and user environment

Please report your OS here:
 5.3.0-40-generic #32~18.04.1-Ubuntu SMP Mon Feb 3 14:05:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux




Discussion:
The following change appears to allow 5.6.0 to build okay as there is a make('default' for suite-sparse 5.6.0

```
diff --git a/var/spack/repos/builtin/packages/suite-sparse/package.py b/var/spack/repos/builtin/packages/suite-sparse/package.py
index 10f99dfbb..ec09a85e7 100644
--- a/var/spack/repos/builtin/packages/suite-sparse/package.py
+++ b/var/spack/repos/builtin/packages/suite-sparse/package.py
@@ -63,7 +63,6 @@ def install(self, spec, prefix):
         pic_flag  = self.compiler.pic_flag if '+pic' in spec else ''
 
         make_args = [
-            'INSTALL=%s' % prefix,
             # By default, the Makefile uses the Intel compilers if
             # they are found. The AUTOCC flag disables this behavior,
             # forcing it to use Spack's compiler wrappers.
@@ -134,6 +133,9 @@ def install(self, spec, prefix):
             self.spec.version <= Version('5.6.0')):
             make('default', *make_args)
 
+        make_args.append(
+            'INSTALL=%s' % prefix
+        )
         make('install', *make_args)
 
     @property
```
Looks like a possible duplicate of #14654

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/suite-sparse/package.py b/var/spack/repos/builtin/packages/suite-sparse/package.py
--- a/var/spack/repos/builtin/packages/suite-sparse/package.py
+++ b/var/spack/repos/builtin/packages/suite-sparse/package.py
@@ -34,6 +34,7 @@ class SuiteSparse(Package):
 
     depends_on('blas')
     depends_on('lapack')
+    depends_on('m4', type='build', when='@5.0.0:')
     depends_on('cmake', when='@5.2.0:', type='build')
 
     depends_on('metis@5.1.0', when='@4.5.1:')
@@ -64,7 +65,6 @@ def install(self, spec, prefix):
         pic_flag  = self.compiler.pic_flag if '+pic' in spec else ''
 
         make_args = [
-            'INSTALL=%s' % prefix,
             # By default, the Makefile uses the Intel compilers if
             # they are found. The AUTOCC flag disables this behavior,
             # forcing it to use Spack's compiler wrappers.
@@ -134,6 +134,7 @@ def install(self, spec, prefix):
         if '@5.4.0:' in self.spec:
             make('default', *make_args)
 
+        make_args.append('INSTALL=%s' % prefix)
         make('install', *make_args)
 
     @property


Test patch: