maint-tool (89857) | maint-tool (130561) |
---|---|
1#!/usr/bin/perl 2# -*- perl -*- 3 4# Copyright (C) 2001 5# Free Software Foundation 6# 7# This file is part of the libiberty library. 8# Libiberty is free software; you can redistribute it and/or --- 199 unchanged lines hidden (view full) --- 208 my ($a,$b) = @_; 209 return -1 if $a eq "config.h"; 210 return 1 if $b eq "config.h"; 211 return $a cmp $b; 212} 213 214sub deps { 215 | 1#!/usr/bin/perl 2# -*- perl -*- 3 4# Copyright (C) 2001 5# Free Software Foundation 6# 7# This file is part of the libiberty library. 8# Libiberty is free software; you can redistribute it and/or --- 199 unchanged lines hidden (view full) --- 208 my ($a,$b) = @_; 209 return -1 if $a eq "config.h"; 210 return 1 if $b eq "config.h"; 211 return $a cmp $b; 212} 213 214sub deps { 215 |
216 $crule = "\tif [ x\"\$(PICFLAG)\" != x ]; then \\\n"; 217 $crule .= "\t \$(COMPILE.c) \$(PICFLAG) \$< -o pic/\$@; \\\n"; 218 $crule .= "\telse true; fi\n"; 219 $crule .= "\t\$(COMPILE.c) \$< \$(OUTPUT_OPTION)\n"; 220 $crule .= "\n"; 221 |
|
216 $incdir = shift @ARGV; 217 218 opendir(INC, $incdir); 219 while ($f = readdir INC) { 220 next unless $f =~ /\.h$/; 221 $mine{$f} = "\$(INCDIR)/$f"; 222 $deps{$f} = join(' ', &deps_for("$incdir/$f")); 223 } 224 $mine{'config.h'} = "config.h"; 225 | 222 $incdir = shift @ARGV; 223 224 opendir(INC, $incdir); 225 while ($f = readdir INC) { 226 next unless $f =~ /\.h$/; 227 $mine{$f} = "\$(INCDIR)/$f"; 228 $deps{$f} = join(' ', &deps_for("$incdir/$f")); 229 } 230 $mine{'config.h'} = "config.h"; 231 |
232 opendir(INC, $srcdir); 233 while ($f = readdir INC) { 234 next unless $f =~ /\.h$/; 235 $mine{$f} = "\$(srcdir)/$f"; 236 $deps{$f} = join(' ', &deps_for("$srcdir/$f")); 237 } 238 $mine{'config.h'} = "config.h"; 239 |
|
226 open(IN, "$srcdir/Makefile.in"); 227 open(OUT, ">$srcdir/Makefile.tmp"); 228 while (<IN>) { 229 last if /remainder of this file/; 230 print OUT; 231 } 232 print OUT "# The dependencies in the remainder of this file are automatically\n"; 233 print OUT "# generated by \"make maint-deps\". Manual edits will be lost.\n\n"; --- 13 unchanged lines hidden (view full) --- 247 push(@pending, split(' ', $deps{$p})); 248 $scanned{$p} = 1; 249 } 250 } 251 } 252 @deps = sort { &locals_first($a,$b) } keys %scanned; 253 $obj = $f; 254 $obj =~ s/\.c$/.o/; | 240 open(IN, "$srcdir/Makefile.in"); 241 open(OUT, ">$srcdir/Makefile.tmp"); 242 while (<IN>) { 243 last if /remainder of this file/; 244 print OUT; 245 } 246 print OUT "# The dependencies in the remainder of this file are automatically\n"; 247 print OUT "# generated by \"make maint-deps\". Manual edits will be lost.\n\n"; --- 13 unchanged lines hidden (view full) --- 261 push(@pending, split(' ', $deps{$p})); 262 $scanned{$p} = 1; 263 } 264 } 265 } 266 @deps = sort { &locals_first($a,$b) } keys %scanned; 267 $obj = $f; 268 $obj =~ s/\.c$/.o/; |
255 $obj = "$obj:"; | 269 $obj = "./$obj:"; |
256 if ($#deps >= 0) { | 270 if ($#deps >= 0) { |
257 print OUT $obj; 258 $len = length($obj); | 271 print OUT "$obj \$(srcdir)/$f"; 272 $len = length("$obj $f"); |
259 for $dt (@deps) { 260 $d = $mine{$dt}; 261 if ($len + length($d) > 70) { 262 printf OUT " \\\n\t$d"; 263 $len = 8 + length($d); 264 } else { 265 print OUT " $d"; 266 $len += length($d) + 1; 267 } 268 } 269 print OUT "\n"; | 273 for $dt (@deps) { 274 $d = $mine{$dt}; 275 if ($len + length($d) > 70) { 276 printf OUT " \\\n\t$d"; 277 $len = 8 + length($d); 278 } else { 279 print OUT " $d"; 280 $len += length($d) + 1; 281 } 282 } 283 print OUT "\n"; |
284 } else { 285 print OUT "$obj \$(srcdir)/$f\n"; |
|
270 } | 286 } |
287 $c = $crule; 288 $c =~ s@\$\<@\$\(srcdir\)\/$f@g; 289 print OUT $c; |
|
271 } 272 } 273 closedir(S); 274 close(IN); 275 close(OUT); 276 277 rename("$srcdir/Makefile.tmp", "$srcdir/Makefile.in"); 278} | 290 } 291 } 292 closedir(S); 293 close(IN); 294 close(OUT); 295 296 rename("$srcdir/Makefile.tmp", "$srcdir/Makefile.in"); 297} |