]> git.donarmstrong.com Git - lilypond.git/blob - bin/wild-perl
release: 0.1.50
[lilypond.git] / bin / wild-perl
1 # -*- perl -*-
2 ##! @PERL@
3
4 @ignorestuff = ();
5
6 sub ignore_query
7 {
8     my ($testfile) = @_;
9     return !grep(/$testfile/, @ignorestuff);
10 }
11
12 print "# Generated automatically by wild-perl 0.1\n";
13
14 while (<>) {
15         $line = $_;
16         if ($line =~ /^ *nowildcard: *(.*)$/) {
17             $ignore = $1;
18             @ignorelist = split (/ +/, $ignore);
19             foreach $i (@ignorelist) {
20                 print "# ignoring wildcards for \`$i\'\n";
21                 push @ignorestuff, $i; # concat ? uh?
22             }
23
24             
25         } elsif ($line =~ /(.*)\$\(wildcard(.*)\)(.*)/) {
26             $wild = $2;
27             
28             @expanded = glob ($wild);
29
30             @expanded = grep {ignore_query($_);}  @expanded;
31             
32             print $1 . join (' ', @expanded) . $3 . "\n";
33         } else {
34             print $line;
35         }
36 }
37
38
39 print "\$(srcdir)/Makefile.am: \$(srcdir)/Makefile.am.wild\n" .
40     "\t\$(PERL) \$(top_srcdir)/bin/wild-perl < \$< > \$@";
41