def patch(self):
        math_libs = self.spec['lapack'].libs + self.spec['blas'].libs
        makefile = FileFilter('Makefile')
        if self.spec.satisfies('%gcc'):
            makefile.filter(r'^MKL\s+=\s1', 'MKL=0')
            makefile.filter(r'^CC\s+=\sgcc',
                            'CC={0}'.format(spack_cc))
            makefile.filter(r'^CXX\s+=\sg\+\+',
                            'CXX={0}'.format(spack_cxx))
            makefile.filter(r'^BLASLIBS\s+=\s-llapack\s-lblas',
                            'BLASLIBS={0}'.format(math_libs.ld_flags))
        elif self.spec.satisfies('%fj'):
            makefile.filter(r'^#ENV\s+=\sFX100', 'ENV=FX100')
            makefile.filter(r'^ENV\s+=\sGCC', '#ENV=GCC')
            makefile.filter(r'^MKL\s+=\s1', 'MKL=0')
            makefile.filter(r'^CC\s+=\sfccpx',
                            'CC={0}'.format(spack_cc))
            makefile.filter(r'^CXX\s+=\sFCCpx',
                            'CXX={0}'.format(spack_cxx))
            makefile.filter(r'^BLASLIBS\s+=\s-llapack\s-lblas',
                            'BLASLIBS={0}'.format(math_libs.ld_flags))
        elif self.spec.satisfies('%intel'):
            makefile.filter(r'^ENV\s+=\sGCC', '#ENV=GCC')
            makefile.filter(r'^ENV\s+=\sICC', 'ENV=ICC')
            makefile.filter(r'^CC\s+=\sicc',
                            'CC={0}'.format(spack_cc))
            makefile.filter(r'^CXX\s+=\sicc',
                            'CXX={0}'.format(spack_cxx))