summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2020-06-04 18:28:27 -0700
committerH. Peter Anvin (Intel) <hpa@zytor.com>2020-06-04 18:30:27 -0700
commitdc1a6c5306d4a978206b25f9ffbc1827561facd3 (patch)
tree420b03f6fbd5893419a71e651e3d9e03b7faea47 /tools
parent8d03b9ccc8c84ccf96f005b55c2aa5069b775a00 (diff)
downloadnasm-dc1a6c5306d4a978206b25f9ffbc1827561facd3.tar.gz
mkdep.pl: fix internalization/externalization
At some point internalization/externalization of dependencies apparently broke. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/mkdep.pl23
1 files changed, 15 insertions, 8 deletions
diff --git a/tools/mkdep.pl b/tools/mkdep.pl
index 1966660d..b60b1b05 100755
--- a/tools/mkdep.pl
+++ b/tools/mkdep.pl
@@ -1,7 +1,7 @@
#!/usr/bin/perl
## --------------------------------------------------------------------------
##
-## Copyright 1996-2017 The NASM Authors - All Rights Reserved
+## Copyright 1996-2020 The NASM Authors - All Rights Reserved
## See the file AUTHORS included with the NASM distribution for
## the specific copyright holders.
##
@@ -109,6 +109,8 @@ sub alldeps($$) {
sub convert_file($$) {
my($file,$sep) = @_;
+ print STDERR "convert_file: $file\n";
+
my @fspec = (basename($file));
while ( ($file = dirname($file)) ne File::Spec->curdir() &&
$file ne File::Spec->rootdir() ) {
@@ -140,16 +142,15 @@ sub _insert_deps($$) {
my $cont = "\\";
my $include_command = undef;
my $selfrule = 0;
- my $do_external = 0;
my $maxline = 78; # Seems like a reasonable default
my %exclude = (); # Don't exclude anything
my @genhdrs = ();
my $external = undef;
my $raw_output = 0;
my @outfile = ();
- my $done = 0;
+ my $is_external = 0;
- while ( defined($line = <$in>) && !$done ) {
+ while ( defined($line = <$in>) ) {
if ( $line =~ /^([^\s\#\$\:]+\.h):/ ) {
# Note: we trust the first Makefile given best
my $fpath = $1;
@@ -179,10 +180,11 @@ sub _insert_deps($$) {
$selfrule = !!$val;
}
} elsif ( $line =~ /^(\s*\#?\s*EXTERNAL_DEPENDENCIES\s*=\s*)([01])\s*$/ ) {
+ # If this line is not present, we cannot externalize
$is_external = $externalize ? 1 : $force_inline ? 0 : $2+0;
$line = $1.$is_external."\n";
} elsif ( $line eq $barrier ) {
- $done = 1; # Stop reading input at barrier line
+ last; # Stop reading at barrier line
}
push @outfile, $line;
@@ -190,17 +192,20 @@ sub _insert_deps($$) {
close($in);
$is_external = $is_external && defined($external);
+ undef $external if ( !$is_external );
if ( !$is_external || $externalize ) {
print $out @outfile;
- } else {
- print $out $barrier; # Start generated file with barrier
}
+ print $out $barrier;
+
if ( $externalize ) {
- if ( $is_external && defined($include_command) ) {
+ # Just strip internal file dependency information
+ if (defined($include_command)) {
print $out "$include_command $external\n";
}
+ unlink($external);
return undef;
}
@@ -210,6 +215,8 @@ sub _insert_deps($$) {
my $ofile;
my @deps;
+ next unless (defined($dfile));
+
if ( $selfrule && $dfile eq $external ) {
$ofile = convert_file($dfile, $sep).':';
@deps = sort(keys(%deps));