Skip to content
Snippets Groups Projects
Commit 8422d274 authored by Michael Weber's avatar Michael Weber
Browse files

[project @ 2000-07-26 20:47:21 by michaelw]

* backup files are only generated, if there is an old dependency file.

* if $Makefile is "-", print dependencies to STDOUT *without* creating
  a backup file.


*** MERGE with 4.08.1 ***
parent 87ac3f71
No related merge requests found
...@@ -176,41 +176,60 @@ foreach $sf (@Src_files) { ...@@ -176,41 +176,60 @@ foreach $sf (@Src_files) {
} }
} }
# #
# Create backup version of output file. # print dependencies
# #
if ( ! -f $Makefile ) { if ( $Makefile eq "-" ) {
# truncate() may not be implemented, so we #
# play it safe here. # print dependencies to STDOUT
local(*TRUNC); #
open(TRUNC,"> $Makefile.bak") && close(TRUNC); &print_deps();
} elsif ( ! -f $Makefile ) {
#
# $Makefile does not exist, just print the deps.
#
open(NMKF,"> $Makefile") || die "$Pgm: can't open $Makefile: $!\n";
select(NMKF);
&print_deps();
close(NMKF);
} else { } else {
rename($Makefile,"$Makefile.bak"); #
} # Create backup version of output file, then generate a new one.
# now copy Makefile.bak into Makefile, rm'ing old dependencies #
# and adding the new rename($Makefile,"$Makefile.bak") || die "$Pgm: can't rename $Makefile: $!\n";
open(OMKF,"< $Makefile.bak") || die "$Pgm: can't open $Makefile.bak: $!\n";
open(NMKF,"> $Makefile") || die "$Pgm: can't open $Makefile: $!\n"; # now copy Makefile.bak into Makefile, rm'ing old dependencies
select(NMKF); # and adding the new
$_ = <OMKF>; open(OMKF,"< $Makefile.bak") || die "$Pgm: can't open $Makefile.bak: $!\n";
while ($_ && $_ ne $Begin_magic_str) { # copy through, 'til Begin_magic_str open(NMKF,"> $Makefile") || die "$Pgm: can't open $Makefile: $!\n";
print $_; select(NMKF);
$_ = <OMKF>;
} $_ = <OMKF>;
while ($_ && $_ ne $End_magic_str) { # delete 'til End_magic_str while ($_ && $_ ne $Begin_magic_str) { # copy through, 'til Begin_magic_str
$_ = <OMKF>; print $_;
} $_ = <OMKF>;
# insert dependencies }
print "$Begin_magic_str", @Depend_lines, $End_magic_str || die "Failed to write out dependencies ($!)"; while ($_ && $_ ne $End_magic_str) { # delete 'til End_magic_str
$_ = <OMKF>;
}
while (<OMKF>) { # copy the rest through &print_deps();
print $_ || die "Failed to write out dependencies ($!)";
while (<OMKF>) { # copy the rest through
print $_ || die "Failed to write out dependencies ($!)";
}
close(NMKF) || exit(1);
close(OMKF) || exit(1);
} }
close(NMKF) || exit(1);
close(OMKF) || exit(1);
exit 0; exit 0;
sub print_deps {
# insert dependencies
print "$Begin_magic_str", @Depend_lines, $End_magic_str || die "Failed to write out dependencies ($!)";
}
sub mangle_command_line_args { sub mangle_command_line_args {
local(@Args) = @_; local(@Args) = @_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment