| Hello, Jim and others!
Hi Pavel!
| > Is it that behavior documented?
The documentation says:
With all the source in a single file, you use the following
command to convert it into a parser file:
@example
bison @var{file_name}.y
@end example
@noindent
In this example the file was called @file{rpcalc.y} (for
** ``Reverse Polish CALCulator''). Bison produces a file named
** @file{@var{file_name}.tab.c}, removing the @samp{.y} from the
** original file name. The file output by Bison contains the
source code for @code{yyparse}. The additional functions in
the input file (@code{yylex}, @code{yyerror} and @code{main})
are copied verbatim to the output.
which agrees with this behavior. The question is then: did the author
think about file_name=dir_part/base_part? (And BTW, why the heck is
there this `tab' part?)
| > If so, then it's probably not reasonable to change it.
| > I've Cc'd the automake list, because some of automake's
| > rules use bison through $(YACC) -- though I'll bet they
| > all use it in yacc-compatible mode.
|
| Yes, Automake currently used bison in Automake-compatible mode, but it
| would be fair for Automake to switch to the native mode as long as the
| processed files are distributed and "missing" emulates bison.
And indeed the behavior is then different:
/tmp % rm calc.* *tab* nostromo 17:37
/tmp % bison src/calc.y nostromo 17:38
/tmp % ls src calc.c -l nostromo 17:38
ls: calc.c: Aucun fichier ou répertoire de ce type
total 32
-rw-r--r-- 1 akim lrde 27517 oct 2 17:38 calc.tab.c
-rw-r--r-- 1 akim lrde 3335 oct 2 16:31 calc.y
/tmp % rm src/calc.tab.c nostromo Err 1
/tmp % bison src/calc.y -y nostromo 17:38
/tmp % ls src *tab* -l nostromo Err 1
-rw-r--r-- 1 akim lrde 27517 oct 2 17:38 y.tab.c
src:
total 4
-rw-r--r-- 1 akim lrde 3335 oct 2 16:31 calc.y
| In any case, the makefiles should specify the output file explicitly
| instead of relying on weird defaults.
This is not possible simply with Yacc/Bison which (can) generates many
files (*.output, *.h...).
| > | src:
| > | total 32
| > | -rw-r--r-- 1 akim lrde 27553 oct 2 16:31 calc.tab.c
| > | -rw-r--r-- 1 akim lrde 3335 oct 2 16:31 calc.y
|
| This is not _that_ ugly as it seems - with Automake you want to put
| sources where they belong - to the source directory.
The difference source/build you are referring to is based on Automake
concepts. They have no sense at all for tools such as bison or gcc
etc. They have input and output. I do not want them to try to grasp
source/build. I want them to behave uniformly: output *here*.
Akim