chiark / gitweb /
media-scraper: makefile fragment writer
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 13 Sep 2020 17:14:34 +0000 (18:14 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 13 Sep 2020 17:14:34 +0000 (18:14 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
media-scraper

index 8ba5aeb3f1ce744f26f79e7468a304f189998d02..7198a1a4bb7ca9706c77eff29dcc7d0fb0a124fd 100755 (executable)
@@ -97,6 +97,8 @@ foreach my $sect (values %$libinfo) {
   next unless $scraper;
   my $method = $scraper->{method};
   my $fn = ${*::}{"method_$method"};
+  my $makepath = "$basename/.make";
+  my $makefile = new IO::File "$makepath.tmp", '>' or die $!;
   my $method_fn = $fn->($scraper, $method);
   foreach (split(/\n/, $sect->{files})) {
     s/^\s+//;
@@ -106,6 +108,9 @@ foreach my $sect (values %$libinfo) {
     my $base = "$basename/$filespec";
     my $licpath = "$base.licence";
     print DEBUG "file $base ";
+    print $makefile <<END or die $!;
+LIBRARY_FILES += $base
+END
     if (stat $licpath) {
       print DEBUG "already.\n";
       next;
@@ -119,4 +124,5 @@ foreach my $sect (values %$libinfo) {
     rename "$licpath.tmp", "$licpath" or die $!;
     print DEBUG "done.\n";
   }
+  close $makefile or die $!;
 }