summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksandermj@chromium.org>2023-04-27 10:08:44 +0000
committerAleksander Morgado <aleksandermj@chromium.org>2023-04-27 10:08:44 +0000
commit4e5e10a1b78cc2a18529738f6a70ea95b447a253 (patch)
tree0be128ba6e441113937fc05baa88b970901943b4
parent7c0355909f606df792dc73cfff5e818f9fa562bb (diff)
downloadlibqmi-4e5e10a1b78cc2a18529738f6a70ea95b447a253.tar.gz
build-aux,mkenums: allow having separate files for flags and enums
-rwxr-xr-xbuild-aux/qmi-mkenums12
1 files changed, 12 insertions, 0 deletions
diff --git a/build-aux/qmi-mkenums b/build-aux/qmi-mkenums
index 7077e345..66516b12 100755
--- a/build-aux/qmi-mkenums
+++ b/build-aux/qmi-mkenums
@@ -350,6 +350,10 @@ parser.add_argument('--vtail', default=[], dest='vtail', action='append',
help='Value tail, produced after iterating over enum values')
parser.add_argument('--comments', default='', dest='comment_tmpl',
help='Comment structure')
+parser.add_argument('--enums-only', default=False, action='store_true', dest='enumsonly',
+ help='Only process enums, not flags')
+parser.add_argument('--flags-only', default=False, action='store_true', dest='flagsonly',
+ help='Only process flags, not enums')
parser.add_argument('--template', default='', dest='template',
help='Template file')
parser.add_argument('--output', default=None, dest='output')
@@ -383,6 +387,9 @@ if options.template != '':
idprefix += options.idprefix
symprefix += options.symprefix
+enumsonly = options.enumsonly
+flagsonly = options.flagsonly
+
# This is a hack to maintain some semblance of backward compatibility with
# the old, Perl-based glib-mkenums. The old tool had an implicit ordering
# on the arguments and templates; each argument was parsed in order, and
@@ -556,6 +563,11 @@ def process_file(curfilename):
if flags is None:
flags = seenbitshift
+ if flags and enumsonly:
+ continue
+ elif not flags and flagsonly:
+ continue
+
# Autogenerate a prefix
if enum_prefix is None:
for entry in entries: