def METHOD_NAME(self, pkg, spec, prefix):
    substitutions = [
        ("@MPICC", spec["mpi"].mpicc),
        ("@MPICXX_LIB", spec["mpi:cxx"].libs.joined()),
        ("@MPICXX", spec["mpi"].mpicxx),
        ("@MPIFC", spec["mpi"].mpifc),
        ("@RANLIB", "ranlib"),
        ("@PEXSI_STAGE", pkg.stage.source_path),
        ("@SUPERLU_PREFIX", spec["superlu-dist"].prefix),
        ("@METIS_PREFIX", spec["metis"].prefix),
        ("@PARMETIS_PREFIX", spec["parmetis"].prefix),
        ("@LAPACK_PREFIX", spec["lapack"].prefix),
        ("@BLAS_PREFIX", spec["blas"].prefix),
        ("@LAPACK_LIBS", spec["lapack"].libs.joined()),
        ("@BLAS_LIBS", spec["blas"].libs.joined()),
        # FIXME : what to do with compiler provided libraries ?
        ("@STDCXX_LIB", " ".join(pkg.compiler.stdcxx_libs)),
    ]
    fldflags = ""
    if "@0.9.2" in spec:
        fldflags += " -Wl,--allow-multiple-definition"
    if "^superlu +openmp" in spec or "^openblas threads=openmp" in spec:
        fldflags += " " + pkg.compiler.openmp_flag
    substitutions.append(("@FLDFLAGS", fldflags.lstrip()))
    template = join_path(os.path.dirname(inspect.getmodule(self).__file__), "make.inc")
    makefile = join_path(pkg.stage.source_path, "make.inc")
    copy(template, makefile)
    for key, value in substitutions:
        filter_file(key, value, makefile)