def METHOD_NAME(soc_caps_dir, filename, always_write):  # type: (Path, str, bool) -> bool
    soc_headers = list(soc_caps_dir.glob(filename))
    if soc_headers == []:
        return False
    # Sort header files to make the generated files deterministic
    soc_headers.sort(key=lambda file: file.name)
    defines = []
    for soc_header in soc_headers:
        defines.extend(get_defines(soc_header))
    writer = KconfigWriter()
    for line in defines:
        try:
            res = parse_define(line)
        except pyparsing.ParseException:
            logging.debug('Failed to parse: {}'.format(line))
            continue
        # Add the kconfig entry corresponding to the type we parsed
        if 'str_value' in res:
            writer.add_entry(res.name, 'string', res.str_value)
        elif 'int_value' in res:
            # defines with an integer value of 0 or 1 are
            # added as bool entries as long they have no literal suffix
            if 'literal_suffix' not in res and res.int_value == '0':
                writer.add_entry(res.name, 'bool', False)
            elif 'literal_suffix' not in res and res.int_value == '1':
                writer.add_entry(res.name, 'bool', True)
            else:
                writer.add_entry(res.name, 'int', res.int_value)
        elif 'hex_value' in res:
            writer.add_entry(res.name, 'hex', res.hex_value)
    # Updates output if necessary
    updated = writer.update_file(Path(soc_caps_dir) / 'Kconfig.soc_caps.in', always_write)
    return updated