diff --git a/contrib/cube/meson.build b/contrib/cube/meson.build
index 49276aed64..3cf7ebdd8e 100644
--- a/contrib/cube/meson.build
+++ b/contrib/cube/meson.build
@@ -6,7 +6,7 @@ cube_sources = files(
 cubescan = custom_target('cubescan',
   input: ['cubescan.l'],
   output: ['cubescan.c'],
-  command: [flex, '-CFe', '-p', '-p', '-o', '@OUTPUT@', '@INPUT@'])
+  command: [flex, '-o', '@OUTPUT@', '@INPUT@'])
 
 cube_sources += custom_target('cubeparse',
   input: 'cubeparse.y',
diff --git a/src/backend/parser/meson.build b/src/backend/parser/meson.build
index 491eacf20b..5ce4d09f31 100644
--- a/src/backend/parser/meson.build
+++ b/src/backend/parser/meson.build
@@ -28,7 +28,7 @@ parser_sources = [files('parser.c')]
 backend_scanner = custom_target('scan',
   input: ['scan.l'],
   output: ['scan.c'],
-  command: [flex, '-CF', '-p', '-p', '-o', '@OUTPUT@', '@INPUT0@'])
+  command: [flex, '-b', '-CF', '-p', '-p', '-o', '@OUTPUT@', '@INPUT0@'])
 parser_sources += backend_scanner[0]
 
 parser_sources += backend_parser_header[0]
diff --git a/src/backend/replication/meson.build b/src/backend/replication/meson.build
index 2573f166d7..ee12c6d49d 100644
--- a/src/backend/replication/meson.build
+++ b/src/backend/replication/meson.build
@@ -17,7 +17,7 @@ backend_sources += files(
 repl_scanner = custom_target('repl_scanner',
   input : files('repl_scanner.l'),
   output : ['repl_scanner.c'],
-  command : [flex, '-CF', '-p', '-p', '-o', '@OUTPUT0@', '@INPUT@']
+  command: [flex, '-o', '@OUTPUT@', '@INPUT@']
 )
 
 generated_backend_sources += custom_target('repl_gram',
@@ -30,7 +30,7 @@ generated_backend_sources += custom_target('repl_gram',
 syncrep_scanner = custom_target('syncrep_scanner',
   input: 'syncrep_scanner.l',
   output: 'syncrep_scanner.c',
-  command: [flex, '-CF', '-p', '-p', '-o', '@OUTPUT0@', '@INPUT@'])
+  command: [flex, '-o', '@OUTPUT@', '@INPUT@'])
 
 generated_backend_sources += custom_target('syncrep_gram',
   input: 'syncrep_gram.y',
diff --git a/src/backend/utils/adt/meson.build b/src/backend/utils/adt/meson.build
index 086fde8ff0..e1cea1eb4e 100644
--- a/src/backend/utils/adt/meson.build
+++ b/src/backend/utils/adt/meson.build
@@ -109,7 +109,7 @@ backend_sources += files(
 jsonpath_scan = custom_target('jsonpath_scan',
   input: ['jsonpath_scan.l'],
   output: ['jsonpath_scan.c'],
-  command: [flex, '-CF', '-p', '-p', '-o', '@OUTPUT@', '@INPUT@'])
+  command: [flex, '-b', '-CF', '-p', '-p', '-o', '@OUTPUT@', '@INPUT@'])
 
 # jsonpath_scan is compiled as part of jsonpath_gram
 generated_backend_sources += custom_target('jsonpath_parse',
diff --git a/src/backend/utils/misc/meson.build b/src/backend/utils/misc/meson.build
index 5274c8aa1a..2c0090ad33 100644
--- a/src/backend/utils/misc/meson.build
+++ b/src/backend/utils/misc/meson.build
@@ -18,7 +18,7 @@ backend_sources += files(
 guc_scan = custom_target('guc_scan',
   input: ['guc-file.l'],
   output: ['guc-file.c.h'],
-  command: [flex, '-CF', '-p', '-p', '-o', '@OUTPUT@', '@INPUT@'])
+  command: [flex, '-o', '@OUTPUT@', '@INPUT@'])
 
 generated_backend_sources += guc_scan
 
diff --git a/src/bin/pgbench/meson.build b/src/bin/pgbench/meson.build
index 5c4a778ff3..bc135abebf 100644
--- a/src/bin/pgbench/meson.build
+++ b/src/bin/pgbench/meson.build
@@ -9,7 +9,7 @@ pgbench_sources = files(
 exprscan = custom_target('exprscan',
   input : files('exprscan.l'),
   output : ['exprscan.c'],
-  command : [flex, '-CF', '-p', '-p', '-o', '@OUTPUT0@', '@INPUT@']
+  command : [flex, '-o', '@OUTPUT0@', '@INPUT@']
 )
 
 exprparse = custom_target('exprparse',
diff --git a/src/bin/psql/meson.build b/src/bin/psql/meson.build
index 98921f801d..e56beb28e1 100644
--- a/src/bin/psql/meson.build
+++ b/src/bin/psql/meson.build
@@ -18,7 +18,7 @@ psql_sources = files(
 psql_sources += custom_target('psqlscanslash',
   input: ['psqlscanslash.l'],
   output: ['psqlscanslash.c'],
-  command: [flex, '-CFe', '-p', '-p', '-o', '@OUTPUT@', '@INPUT@'])
+  command: [flex, '-b', '-Cfe', '-p', '-p', '-o', '@OUTPUT@', '@INPUT@'])
 
 psql_sources += custom_target('psql_help',
   input: ['create_help.pl'],
diff --git a/src/fe_utils/meson.build b/src/fe_utils/meson.build
index b305727d96..e3f0b34cf1 100644
--- a/src/fe_utils/meson.build
+++ b/src/fe_utils/meson.build
@@ -16,7 +16,7 @@ fe_utils_sources = files(
 fe_utils_sources += custom_target('psqlscan',
   input: ['psqlscan.l'],
   output: ['psqlscan.c'],
-  command: [flex, '-Cfe', '-p', '-p', '-o', '@OUTPUT@', '@INPUT@'])
+  command: [flex, '-b', '-Cfe', '-p', '-p', '-o', '@OUTPUT@', '@INPUT@'])
 
 fe_utils = static_library('fe_utils',
   fe_utils_sources + generated_headers,
diff --git a/src/test/isolation/meson.build b/src/test/isolation/meson.build
index 637b480755..ea8baa2063 100644
--- a/src/test/isolation/meson.build
+++ b/src/test/isolation/meson.build
@@ -8,7 +8,7 @@ isolation_sources = pg_regress_c + files(
 spec_scanner = custom_target('specscanner',
   input : files('specscanner.l'),
   output : ['specscanner.c'],
-  command : [flex, '-CF', '-p', '-p', '-o', '@OUTPUT0@', '@INPUT@']
+  command : [flex, '-o', '@OUTPUT0@', '@INPUT@']
 )
 
 isolationtester_sources = files('isolationtester.c')
