diff options
-rw-r--r-- | libstorycode/storycode.y | 1 | ||||
-rw-r--r-- | meson.build | 31 |
2 files changed, 17 insertions, 15 deletions
diff --git a/libstorycode/storycode.y b/libstorycode/storycode.y index 38ce93b..33336a7 100644 --- a/libstorycode/storycode.y +++ b/libstorycode/storycode.y @@ -21,6 +21,7 @@ */ %{ + #include <stdio.h> extern int sclex(); extern int scparse(); void scerror(const char *s); 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) |