Plan 9 from Bell Labs’s /usr/web/sources/contrib/anothy/src/lib/djb-ape/fixdeps.pl

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/usr/bin/perl

# Feed "gcc -MM *.c" output

open PIPE,"gcc -MM *.c|" || die;
while (<PIPE>) {
  chomp;
  while (m/\\$/) {	# continuation line
    $_ .= <PIPE> || die "invalid continuation line";
    chomp;
  }
  s/\\ //g;
  if (!m/\.o: /) {
    die "no .o dependancy?!\n";
  }
  ($object,$deps) = (m/([^:]*): (.*)/);
  if (not $object =~ m/^try/) {
    print "$object: \\\n";
    print "compile $deps\n";
    $source=$object;
    $source =~ s/\.o/.c/;
    print "	./compile $source\n\n";
  }
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.