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

  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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 #!/usr/bin/perl use strict; use warnings; use IO::All; use File::Find::Object::Rule; use 5.014; sub _map_wmls_to_deps { my $files = shift; return [ map { my$s = $_;$s =~ s{\.wml\z}{}; $s =~ s{\A(?:\./)?t2/}{\$(T2_DEST)/}; $s; } @$files ]; } =begin foo lib/amazon.wml lib/camila_ron.wml lib/cpan_dists.wml lib/dbook.wml lib/div2mag.wml lib/driver.wml lib/footer.wml lib/iglu.wml lib/lang_switch.wml lib/local-defs.wml lib/mathjax.wml lib/multi-lang.wml lib/paypal.wml lib/prelude.wml lib/render_fortunes_pages.wml lib/rest-of-template.wml lib/SFresume_base.wml lib/share-this.wml lib/sponsored_ad.wml lib/toc_div.wml lib/utils.wml lib/vim_include_code.wml lib/xml_g_fiction.wml =end foo =cut # Write deps.mak { my @files = File::Find::Object::Rule ->name('*.wml') ->in('t2'); my $rule = File::Find::Object::Rule->new; my$discard = $rule->new->directory # Temporarily added for debugging: # ->exec(sub { print "$_[2]\n"; }) ->name( qr{\A(?:docbook|screenplay-xml|fiction-xml|presentations|MathJax)\z} ) ->prune->discard ; my @headers = map { ($_ . '') =~ s{\Alib/}{}r } File::Find::Object::Rule ->or($discard,$rule->new()) ->name('*.wml') ->in('lib'); my %files_containing_headers = ( map {$_ => { re => qr{^\#include *"\Q$_\E"}ms, files => {}, }, } @headers, ); foreach my$fn (@files) { my $contents = io->file($fn)->slurp; foreach my $match ($contents =~ m{^\#include *"([^"]+)"}gms) { if (exists($files_containing_headers{$match})) { $files_containing_headers{$match}{files}{$fn} = 1; } } } my$deps_text = ""; foreach my $header (sort {$a cmp $b } keys(%files_containing_headers)) { my$header_deps = [ sort { $a cmp$b } keys( %{$files_containing_headers{$header}{files}} ) ]; if (@$header_deps) {$deps_text .= join(' ', @{ _map_wmls_to_deps($header_deps ) });$deps_text .= ": lib/$header\n\n"; } } io->file("deps.mak")->print($deps_text); } 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.