-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Christian Rössel wrote: > Philip Herron wrote: >> Hey >> >> I was just wondering say you have a Makefile.am like this: >> >> bin_PROGRAMS= myprog >> AM_YFLAGS= -d >> AM_LFLAGS= >> >> mprog_CFLAGS= -I$(top_srcdir)/include >> myprog_SOURCES= foo1.c foo2.c bla.l bla_gram.y bla2.l bla bla bla.... >> >> Can you specify seperate FLAG like LFLAG to one single source. >> >> Like it would solve alot of problems if you could run this but run the >> lexer -Pprefix option on only one of those lexer files. or specify >> sperate prefixes for each lexer/yacc >> >> -Phil > > Hi Phil, > > I not sure if this applies also to your lexer stuff, but there is an > "Per-Object Flags Emulation", see > http://www.gnu.org/software/automake/manual/automake.html#Per_002dObject-Flags > > Cheers, > Christian > > > ------------------------------------------------------------------- > ------------------------------------------------------------------- > Forschungszentrum Jülich GmbH > 52425 Jülich > > Sitz der Gesellschaft: Jülich > Eingetragen im Handelsregister des Amtsgerichts Düren Nr. HR B 3498 > Vorsitzende des Aufsichtsrats: MinDir'in Bärbel Brumme-Bothe > Geschäftsführung: Prof. Dr. Achim Bachem (Vorsitzender), > Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr. Harald Bolt, > Dr. Sebastian M. Schmidt > ------------------------------------------------------------------- > ------------------------------------------------------------------- > > Hey
Guys i am so happy right now i finally fixed my multiple lexer problem for good! I'll outline here what i done just to get around it. So its a closed topic and put it up on my blog :P so as i dont loose it because there are like 3 main approaches to doing it but automake with ylwrap does the trick. So What i have its one main program, it has to lexers: foo1.l foo2.l the foo2.l also has a foo2_grammar.y. and some other c files etc... So my Makefile.am looks like: bin_PROGRAMS= myprogram AM_YFLAGS = -d -p re_ myprogram_CFLAGS= -I$(top_srcdir)/include myprogram_SOURCES= foo_a.c foo_b.c foo_c.c foo1.l foo2.l foo2_grammar.y foo_d.c Becuase i only have one grammar file this can work but i'll show the work around for multiple grammar's and multiple lexers. So i can leave one of those lexers are default, i left the foo1.l as default yy prefix because its ok. But the 2nd lexer foo2.l: Just after your top header definitions just before your lexer stuff add in this: //make sure your leave the outfile to lex.yy.c for ylwrap to be pleased :P gives you the error something about -s being missing because ylwrap auto renames anyways. %option prefix="re_" outfile="lex.yy.c" change the "re_" -> whatever you want your prefix to be: so then also inside your lexer change your stuff to your prefix like: void re_error(const char *str) { fprintf(stderr,"Error: %s\n",str); } int re_wrap() { return 1; } int run_parser( const char* rulesPath ) { FILE *rules= fopen(rulesPath, "r"); if( rules == (FILE*)0 ) { fprintf(stderr, "Cannot open file: %s\n", rulesPath); return 1; } //change default input to the file instead of stdin.. re_in= rules; re_parse(); return 0; } notice the re_in instead of yyin the re_parse instead of yyparse() re_wrap instead of yywrap re_error instead of yyerror Then remember in my Makefile.am: AM_YFLAGS = -d -p re_ the -p works for the yacc. But the -Pprefix for flex causes erros for automake + ylwrap. This all seems to work for me ok. But say you have 2 lexers each with their own grammar i would make them like libraries like this: http://www.gnu.org/software/automake/manual/automake.html#Per_002dObject-Flags And then its seperate but also do different prefixes. like this! But its all easier than it sounds. Thanks very much for you all anwsering my questions :) - -Phil -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAknmELQACgkQAhcOgIaQQ2Ha1wCgkNWHaWcYtXTJpNOv7wPL576E l3YAoJSUwOjl8jBcxM0Idfqs/pwk2Wxb =giV5 -----END PGP SIGNATURE-----