def METHOD_NAME(case, compclass, compname, libroot, bldroot, libname="", user_cppdefs=""):
    ###############################################################################
    gmake_args = get_standard_makefile_args(case)
    gmake_j = case.get_value("GMAKE_J")
    gmake = case.get_value("GMAKE")
    complib = ""
    if libname:
        complib = os.path.join(libroot, "lib{}.a".format(libname))
    else:
        complib = os.path.join(libroot, "lib{}.a".format(compclass))
    makefile = os.path.join(case.get_value("CASETOOLS"), "Makefile")
    cmd = "{gmake} complib -j {gmake_j:d} COMP_CLASS={compclass} COMP_NAME={compname} COMPLIB={complib} {gmake_args} -f {makefile} -C {bldroot} ".format(
        gmake=gmake,
        gmake_j=gmake_j,
        compclass=compclass,
        compname=compname,
        complib=complib,
        gmake_args=gmake_args,
        makefile=makefile,
        bldroot=bldroot,
    )
    if user_cppdefs:
        cmd = cmd + "USER_CPPDEFS='{}'".format(user_cppdefs)
    stat, out, err = run_cmd(cmd, combine_output=True)
    print(out)
    if stat:
        logger.info("buildlib stat={} err={}".format(stat, err))
        os.unlink(complib)
    return stat