# shlomi-fish-homepage / bin / gen-deps-mak.pl

 shl...@iglu.org.… 0bcae79 2011-05-30 Shlomi Fish 44c7eaf 2012-06-14 shl...@iglu.org.… 0bcae79 2011-05-30 Shlomi Fish 44c7eaf 2012-06-14 shl...@iglu.org.… 6439e82 2011-05-30 shl...@iglu.org.… 0bcae79 2011-05-30 Shlomi Fish 44c7eaf 2012-06-14 shl...@iglu.org.… 0bcae79 2011-05-30 Shlomi Fish 44c7eaf 2012-06-14 shl...@iglu.org.… 0bcae79 2011-05-30 Shlomi Fish 44c7eaf 2012-06-14 shl...@iglu.org.… 0bcae79 2011-05-30 Shlomi Fish 44c7eaf 2012-06-14 shl...@iglu.org.… 0bcae79 2011-05-30   1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 #!/usr/bin/perl use strict; use warnings; use IO::All; use File::Find::Object::Rule; sub _map_wmls_to_deps { my $files = shift; return [ map { my$s = $_;$s =~ s{\.wml\z}{}; $s =~ s{\A(?:\./)?t2/}{\$(T2_DEST)/}; $s; } @$files ]; } # Write deps.mak { my @files = File::Find::Object::Rule ->name('*.wml') ->in('t2'); my %files_containing_headers = ( map { $_ => { re => qr{^\#include *"\Q$_\E\.wml"}ms, files => [], }, } qw( amazon dbook div2mag iglu multi-lang SFresume_base stories/blurbs stories/stories-list toc_div vim_include_code xml_g_fiction ), ); foreach my $fn (@files) { my$contents = io->file($fn)->slurp; foreach my$header (keys(%files_containing_headers)) { if ($contents =~$files_containing_headers{$header}{re}) { push @{$files_containing_headers{$header}{files} },$fn; } } } my $deps_text = ""; foreach my$header (sort { $a cmp$b } keys(%files_containing_headers)) { $deps_text .= join(' ', @{ _map_wmls_to_deps($files_containing_headers{$header}{files} ) } );$deps_text .= ": lib/$header.wml\n\n"; } io->file("deps.mak")->print($deps_text); }