mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
maint: fix example extraction issues.
calc++: don't rely on Automake to compile a C++ parser.
Basically, revert commit 609b3d8096,
Automake 1.11.3 is not safe enough for C++ parser.
* examples/calc++/calc++-parser.hh: Remove.
* examples/calc++/local.mk (examples/calc++/calc++-parser.stamp):
New.
examples: factor the extractions into a single step
extexi had to be run in the extraction directory. Now, it can be
given the files with expected output directory. This allows to
use $(*_extracted) variables (before we had to list again their
members, but limited to their base names). In turn, this also
allows fusing the extraction recipes into a single one.
Also, it is currently too hard (or requires too much duplication,
since Make wants all the occurrences of the files to be prefixed with
$(srcdir)/, which is something Automake cannot support for *_SOURCES)
to work in the source tree. So extract, and compile scanners and parsers
in the build tree.
* examples/extexi (basename): New.
(BEGIN): Now "file_wanted" maps base name to extracted file name.
* examples/calc++/local.mk, examples/mfcalc/local.mk,
* examples/rpcalc/local.mk: Fuse extraction rules into...
* examples/local.mk: Here.
(extract, extracted): New.
This commit is contained in:
@@ -29,7 +29,7 @@ BEGIN {
|
||||
if (ARGV[argc] == "--")
|
||||
break;
|
||||
for (i = argc + 1; i < ARGC; ++i)
|
||||
file_wanted[ARGV[i]] = 1;
|
||||
file_wanted[basename(ARGV[i])] = ARGV[i];
|
||||
ARGC = argc;
|
||||
}
|
||||
|
||||
@@ -43,13 +43,10 @@ BEGIN {
|
||||
}
|
||||
|
||||
/^@comment file: / {
|
||||
if (!file_wanted[$3])
|
||||
message("ignoring " $3);
|
||||
if (file = file_wanted[$3])
|
||||
message(" GEN " file);
|
||||
else
|
||||
{
|
||||
message("extracting " $3);
|
||||
file = $3;
|
||||
}
|
||||
message("SKIP " $3);
|
||||
}
|
||||
|
||||
/^@(small)?example$/, /^@end (small)?example$/ {
|
||||
@@ -125,6 +122,11 @@ function normalize(contents, i, lines, n, line, res) {
|
||||
}
|
||||
|
||||
|
||||
function basename(name, a, n) {
|
||||
n = split (name, a, "/");
|
||||
return a[n];
|
||||
}
|
||||
|
||||
function message(msg) {
|
||||
if (! message_printed[msg])
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user