From ed54079dcd5ae5d6b801b9a0ea2f3ba013c08c0d Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 14 Feb 2019 16:20:27 +0100 Subject: Use generators for flex/bison --- meson.build | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'meson.build') diff --git a/meson.build b/meson.build index f2b902f..2dc827d 100644 --- a/meson.build +++ b/meson.build @@ -34,21 +34,21 @@ libstorycode_includes = include_directories('libstorycode') flex = find_program('flex') bison = find_program('bison') -storycode_parse_ch = custom_target('storycode_parse.c', - output : ['storycode_parse.c', - 'storycode_parse.h'], - input : 'libstorycode/storycode.y', - command : [bison, '--defines=@OUTPUT1@', - '--report=all', - '--output=@OUTPUT0@', - '@INPUT@']) - -storycode_lex_c = custom_target('storycode_lex.c', - output : ['storycode_lex.c', 'storycode_lex.h'], - input : ['libstorycode/storycode.l', storycode_parse_ch], - command : [flex, '--outfile=@OUTPUT0@', - '--header-file=@OUTPUT1@', - '@INPUT@']) +flex_gen = generator(flex, + output : ['@BASENAME@_lex.c', '@BASENAME@_lex.h'], + arguments : ['--outfile=@OUTPUT0@', + '--header-file=@OUTPUT1@', + '@INPUT@']) + +bison_gen = generator(bison, + output : ['@BASENAME@_parse.c', '@BASENAME@_parse.h'], + arguments : ['--defines=@OUTPUT1@', + '--report=all', + '--output=@OUTPUT0@', + '@INPUT@']) + +storycode_lex_c = flex_gen.process('libstorycode/storycode.l') +storycode_parse_ch = bison_gen.process('libstorycode/storycode.y') libstorycode = library('storycode', ['libstorycode/narrative.c', @@ -57,6 +57,7 @@ libstorycode = library('storycode', 'libstorycode/stylesheet.c', 'libstorycode/storycode.c', storycode_lex_c, + storycode_parse_ch, ], include_directories : libstorycode_includes, install : true) -- cgit v1.2.3