acanaday
acanaday

Reputation: 400

Automake Yacc Output Filename Quandary

Problem:

I have a project which I'm porting from Solaris/Lex/Yacc to Linux/Flex/Bison + Autotools. I'm running into the following issue, and I wonder if anyone out there knows how to get around it. Given a target like so (only necessary details included):

bin_PROGRAMS=my_prog

my_prog_YFLAGS=-d
my_prog_SOURCES=\
   main.cpp \
   parser.ypp \
   scanner.lpp

Automake is generating the following source files from the lpp and ypp:

Attempted Solutions:

Using bison's -b and -o options to alter output file names. The problem with this is that automake appears to assume default output names (parser.tab.c) and move the files with a script. If I alter the output file names with bison, the build fails when automake attempts to rename the files that aren't there.

Is there some option or something I am missing?

Upvotes: 3

Views: 1050

Answers (1)

acanaday
acanaday

Reputation: 400

Solution:

So it took me actually reading through the automake source itself (for the curious, look at the handle_single_transform function). If there are per-target options specified for a given source-type, automake automatically prepends the project name to any generated files.

Therefore, changing:

my_prog_YFLAGS=-d

to

AM_YFLAGS=-d

Causes automake to properly generate rules causing parser.ypp to generate:

  • parser.cpp
  • parser.h

Upvotes: 4

Related Questions