def edit(self, spec, prefix):

        if '%gcc' in spec:
            if '+openmp' in spec:
                make_include = join_path('arch', 'makefile.include.linux_gnu_omp')
            else:
                make_include = join_path('arch', 'makefile.include.linux_gnu')
        elif '%nvhpc' in spec:
            make_include = join_path('arch', 'makefile.include.linux_pgi')
            filter_file('-pgc++libs', '-c++libs', make_include, string=True)
            filter_file('pgcc', spack_cc, make_include)
            filter_file('pgc++', spack_cxx, make_include, string=True)
            filter_file('pgfortran', spack_fc, make_include)
            filter_file('/opt/pgi/qd-2.3.17/install/include',
                        spec['qd'].prefix.include, make_include)
            filter_file('/opt/pgi/qd-2.3.17/install/lib',
                        spec['qd'].prefix.lib, make_include)
        elif '%aocc' in spec:
            if '+openmp' in spec:
                copy(
                    join_path('arch', 'makefile.include.linux_gnu_omp'),
                    join_path('arch', 'makefile.include.linux_aocc_omp')
                )
                make_include = join_path('arch', 'makefile.include.linux_aocc_omp')
            else:
                copy(
                    join_path('arch', 'makefile.include.linux_gnu'),
                    join_path('arch', 'makefile.include.linux_aocc')
                )
                make_include = join_path('arch', 'makefile.include.linux_aocc')
            filter_file(
                'gcc', '{0} {1}'.format(spack_cc, '-Mfree'),
                make_include, string=True
            )
            filter_file('g++', spack_cxx, make_include, string=True)
            filter_file('^CFLAGS_LIB[ ]{0,}=.*$',
                        'CFLAGS_LIB = -O3', make_include)
            filter_file('^FFLAGS_LIB[ ]{0,}=.*$',
                        'FFLAGS_LIB = -O2', make_include)
            filter_file('^OFLAG[ ]{0,}=.*$',
                        'OFLAG = -O3', make_include)
            filter_file('^FC[ ]{0,}=.*$',
                        'FC = {0}'.format(spec['mpi'].mpifc),
                        make_include, string=True)
            filter_file('^FCL[ ]{0,}=.*$',
                        'FCL = {0}'.format(spec['mpi'].mpifc),
                        make_include, string=True)
        else:
            if '+openmp' in spec:
                make_include = join_path('arch',
                                         'makefile.include.linux_{0}_omp'.
                                         format(spec.compiler.name))
            else:
                make_include = join_path('arch',
                                         'makefile.include.linux_' +
                                         spec.compiler.name)

        os.rename(make_include, 'makefile.include')

        # This bunch of 'filter_file()' is to make these options settable
        # as environment variables
        filter_file('^CPP_OPTIONS[ ]{0,}=[ ]{0,}',
                    'CPP_OPTIONS ?= ',
                    'makefile.include')
        filter_file('^FFLAGS[ ]{0,}=[ ]{0,}',
                    'FFLAGS ?= ',
                    'makefile.include')

        filter_file('^LIBDIR[ ]{0,}=.*$', '', 'makefile.include')
        filter_file('^BLAS[ ]{0,}=.*$', 'BLAS ?=', 'makefile.include')
        filter_file('^LAPACK[ ]{0,}=.*$', 'LAPACK ?=', 'makefile.include')
        filter_file('^FFTW[ ]{0,}?=.*$', 'FFTW ?=', 'makefile.include')
        filter_file('^MPI_INC[ ]{0,}=.*$', 'MPI_INC ?=', 'makefile.include')
        filter_file('-DscaLAPACK.*$\n', '', 'makefile.include')
        filter_file('^SCALAPACK[ ]{0,}=.*$', 'SCALAPACK ?=', 'makefile.include')

        if '+cuda' in spec:
            filter_file('^OBJECTS_GPU[ ]{0,}=.*$',
                        'OBJECTS_GPU ?=',
                        'makefile.include')

            filter_file('^CPP_GPU[ ]{0,}=.*$',
                        'CPP_GPU ?=',
                        'makefile.include')

            filter_file('^CFLAGS[ ]{0,}=.*$',
                        'CFLAGS ?=',
                        'makefile.include')

        if '+vaspsol' in spec:
            copy('VASPsol/src/solvation.F', 'src/')