[gimp/meson: 127/127] Add custom_targets for regenerating lex/parsers



commit eb27788932aa7486c958a435716d1e934bc974b2
Author: Félix Piédallu <felix piedallu me>
Date:   Fri Feb 2 15:13:51 2018 +0100

    Add custom_targets for regenerating lex/parsers

 plug-ins/imagemap/meson.build |   68 +++++++++++++++++++++++++++++++++++------
 1 files changed, 58 insertions(+), 10 deletions(-)
---
diff --git a/plug-ins/imagemap/meson.build b/plug-ins/imagemap/meson.build
index 7b6ed22..4c3d795 100644
--- a/plug-ins/imagemap/meson.build
+++ b/plug-ins/imagemap/meson.build
@@ -99,13 +99,61 @@ executable(plugin_name,
   install_dir: join_paths(gimpplugindir, 'plug-ins'),
 )
 
-# TODO flex / bison re-generators
-# custom_target('rebuild-parsers',
-#  input : [],
-#  output: [ 'rebuild-parsers', ],
-#  command: [
-#
-#  ],
-#  build_by_default: false,
-#  build_always: true,
-#)
+
+
+flex  = find_program('flex',  required: false)
+bison = find_program('bison', required: false)
+
+if flex.found() and bison.found()
+
+  syntaxes = [
+    'cern',
+    'csim',
+    'ncsa',
+  ]
+
+  foreach syntax : syntaxes
+
+    prefix =  syntax + '_'
+    imapname = 'imap_' + syntax
+
+    custom_target(
+              imapname + '_lex.c',
+      input : imapname + '.l'    ,
+      output: imapname + '_lex.c',
+      command: [
+        flex,
+        '--case-insensitive',
+        '--prefix', prefix,
+        '--outfile', '@OUTPUT@',
+        '@INPUT@',
+      ],
+    )
+
+    custom_target(
+              imapname + '_parse.c',
+      input : imapname + '.y'      ,
+      output: imapname + '_parse.c',
+      command: [
+        bison, '--yacc',
+        '-d',
+        '--name-prefix', prefix,
+        '@INPUT@'
+      ],
+    )
+
+    custom_target(
+              imapname + '_parse.h',
+      input : imapname + '.y'      ,
+      output: imapname + '_parse.h',
+      command: [
+        bison, '--yacc',
+        '-d',
+        '--name-prefix', prefix,
+        '--output', '@OUTPUT@',
+        '@INPUT@'
+      ],
+    )
+
+  endforeach
+endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]