def METHOD_NAME(self, spec, prefix):
    lapack = self.spec["lapack"].libs
    blas = self.spec["blas"].libs
    mpi = self.spec["mpi"].libs
    substitutions = {
        "@F90": spack_fc,
        "@MPIF90": self.spec["mpi"].mpifc,
        "@LIBS": (lapack + blas + mpi).joined(),
    }
    template = join_path(os.path.dirname(inspect.getmodule(self).__file__), "make.sys")
    copy(template, self.makefile_name)
    for key, value in substitutions.items():
        filter_file(key, value, self.makefile_name)
    if self.spec.satisfies("%gcc@10:"):
        fflags = ["-fallow-argument-mismatch"]
        filter_file(r"(^FCOPTS=.*)", r"\1 {0}".format(" ".join(fflags)), self.makefile_name)
    if "@:2 +shared" in self.spec:
        # this is to build a .shared wannier90 library
        filter_file(
            "LIBRARY = ../../libwannier.a",
            "LIBRARY = ../../libwannier." + dso_suffix,
            join_path(self.stage.source_path, "src/Makefile.2"),
        )
        filter_file(
            "parameters.o kmesh.o io.o comms.o "
            "utility.o get_oper.o constants.o "
            "postw90_common.o wan_ham.o spin.o "
            "dos.o berry.o kpath.o kslice.o "
            "boltzwann.o geninterp.o",
            "comms.o get_oper.o postw90_common.o "
            "wan_ham.o spin.o dos.o berry.o "
            "kpath.o kslice.o boltzwann.o geninterp.o",
            join_path(self.stage.source_path, "src/Makefile.2"),
        )
        filter_file(
            "../../wannier90.x: .*",
            "../../wannier90.x: $(OBJS) " "../wannier_prog.F90 $(LIBRARY)",
            join_path(self.stage.source_path, "src/Makefile.2"),
        )
        filter_file(
            "../../postw90.x: $(OBJS_POST) " "$(POSTDIR)postw90.F90",
            "../../postw90.x: $(OBJS_POST) " "$(POSTDIR)postw90.F90 $(LIBRARY)",
            join_path(self.stage.source_path, "src/Makefile.2"),
            string=True,
        )
        filter_file(
            "$(COMPILER) ../wannier_prog.F90 "
            "$(LDOPTS) $(OBJS) $(LIBS) "
            "-o ../../wannier90.x",
            "$(COMPILER) -I../obj ../wannier_prog.F90 "
            "$(LDOPTS) -L../.. -lwannier "
            "-o ../../wannier90.x",
            join_path(self.stage.source_path, "src/Makefile.2"),
            string=True,
        )
        filter_file(
            "$(COMPILER) $(POSTDIR)postw90.F90 "
            "$(POSTOPTS) $(LDOPTS) "
            "$(OBJS_POST) "
            "$(LIBS) -o ../../postw90.x",
            "$(COMPILER) -I../obj $(POSTDIR)postw90.F90 "
            "$(POSTOPTS) $(LDOPTS) $(OBJS_POST) "
            "-L../.. -lwannier $(LIBS) -o ../../postw90.x",
            join_path(self.stage.source_path, "src/Makefile.2"),
            string=True,
        )
        filter_file(
            "$(AR) $(ARFLAGS) " "$(LIBRARY) $(OBJS2) $(OBJS)",
            "$(MPIF90) $(FCOPTS) -shared -o " "$(LIBRARY) $(OBJS2) $(OBJS) $(LIBS)",
            join_path(self.stage.source_path, "src/Makefile.2"),
            string=True,
        )