build: fix support for --disable-dependency-tracking

Reported by Juan Manuel Guerrero.
https://lists.gnu.org/archive/html/bug-bison/2014-07/msg00000.html.

* examples/local.mk (%D%/extracted.stamp): Make sure the output
directory exists.
* examples/extexi (process): Likewise.
This commit is contained in:
Akim Demaille
2018-09-09 14:58:25 +02:00
parent 04705b9370
commit 333bcd2ee3
2 changed files with 8 additions and 2 deletions

View File

@@ -47,6 +47,9 @@
use strict; use strict;
use File::Basename qw(dirname);
use File::Path qw(make_path);
# Whether we generate synclines. # Whether we generate synclines.
my $synclines = 0; my $synclines = 0;
@@ -92,7 +95,9 @@ sub file_wanted ($)
undef undef
} }
# process ($in)
# -------------
# Read input file $in, and generate the outputs.
sub process ($) sub process ($)
{ {
my ($in) = @_; my ($in) = @_;
@@ -152,7 +157,7 @@ sub process ($)
# Output the files. # Output the files.
for my $file (keys %file) for my $file (keys %file)
{ {
# No spurious end of line: use printf. make_path (dirname ($file));
my $o = new IO::File(">$file") my $o = new IO::File(">$file")
or die "$file: cannot create: $?"; or die "$file: cannot create: $?";
print $o $file{$file}{$_} print $o $file{$file}{$_}

View File

@@ -33,6 +33,7 @@ extracted =
CLEANFILES += $(extracted) %D%/extracted.stamp CLEANFILES += $(extracted) %D%/extracted.stamp
%D%/extracted.stamp: $(doc) $(extexi) %D%/extracted.stamp: $(doc) $(extexi)
$(AM_V_GEN)rm -f $@ $@.tmp $(AM_V_GEN)rm -f $@ $@.tmp
$(AM_V_at)$(MKDIR_P) %D%
$(AM_V_at)touch $@.tmp $(AM_V_at)touch $@.tmp
$(AM_V_at)$(extract) $(extracted) $(AM_V_at)$(extract) $(extracted)
$(AM_V_at)mv $@.tmp $@ $(AM_V_at)mv $@.tmp $@