Fix makefile filter suggestions (#23856)

Bash has a builtin `fc` that will override the compiler if you use "fc",
so it's better to use the full spack-supplied compiler path.

Additionally, the filter regex in the docs was wrong: it replaced the
entire assignment operation with the RHS.
This commit is contained in:
Seth R. Johnson 2021-05-22 14:47:43 -04:00 committed by GitHub
parent 4e6a6e4f27
commit d8cbd37aaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View File

@ -147,8 +147,10 @@ and a ``filter_file`` method to help with this. For example:
def edit(self, spec, prefix):
makefile = FileFilter('Makefile')
makefile.filter('CC = gcc', 'CC = cc')
makefile.filter('CXX = g++', 'CC = c++')
makefile.filter(r'^\s*CC\s*=.*', 'CC = ' + spack_cc)
makefile.filter(r'^\s*CXX\s*=.*', 'CXX = ' + spack_cxx)
makefile.filter(r'^\s*F77\s*=.*', 'F77 = ' + spack_f77)
makefile.filter(r'^\s*FC\s*=.*', 'FC = ' + spack_fc)
`stream <https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/stream/package.py>`_

View File

@ -4800,10 +4800,10 @@ Filtering functions
.. code-block:: python
filter_file(r'^CC\s*=.*', spack_cc, 'Makefile')
filter_file(r'^CXX\s*=.*', spack_cxx, 'Makefile')
filter_file(r'^F77\s*=.*', spack_f77, 'Makefile')
filter_file(r'^FC\s*=.*', spack_fc, 'Makefile')
filter_file(r'^\s*CC\s*=.*', 'CC = ' + spack_cc, 'Makefile')
filter_file(r'^\s*CXX\s*=.*', 'CXX = ' + spack_cxx, 'Makefile')
filter_file(r'^\s*F77\s*=.*', 'F77 = ' + spack_f77, 'Makefile')
filter_file(r'^\s*FC\s*=.*', 'FC = ' + spack_fc, 'Makefile')
#. Replacing ``#!/usr/bin/perl`` with ``#!/usr/bin/env perl`` in ``bib2xhtml``: