-
This is a multipart MIME message.
Karl:
> Attached program finds dependencies in lilypond files.
> E.g.:
>
> $ grep include Sliv.ly global.ly
> Sliv.ly:\include "global.ly"
> Sliv.ly:\include "Mliv.ly"
> Sliv.ly:\include "score.ly"
> global.ly:\include "choirbook.ly"
> global.ly:\include "../common/global.ly"
> $ depend_ly ps Sliv.ly
> Sliv.ps: Sliv.ly ../common/global.ly Mliv.ly choirbook.ly global.ly
> score.ly
>
> So you can have:
>
> %.ps: %.ly
> lilypond --ps $<
>
> dep depend.mk:
> depend_ly ps S*.ly > depend.mk
>
> -include depend.mk
>
> in your makefile.
And here is one for latex-files.
(on files from http://aspodata.se/noter/palestrina/dies_sanctificatus/)
$ depend_tex eps all.tex
all.dvi: all.tex Giovanni_Pierluigi_da_Palestrina.eps Salt-systems.tex
Sbas-systems.tex Skb-systems.tex Sold-systems.tex Ssopran-systems.tex
Stenor-systems.tex Tdiessancti.eps Theac.eps
all.psfonts: Salt.eps Sbas.eps Skb.eps Sold.eps Ssopran.eps Stenor.eps
or from lshort-german (the not so short introdution to latex in german):
$ depend_tex eps l2kurz.tex
l2kurz.dvi: l2kurz.tex a.ps l2gfdl.tex l2k1.tex l2k2.tex l2k3.tex l2k4.tex
l2k5.tex l2k6.tex l2ka.tex l2ksym.tex
$ grep a.ps *.tex
l2k4.tex:Hier \includegraphics{a.ps} ist ein Bild.
l2k4.tex:Hier \includegraphics{a.ps} ist
or from an article (it does not work with includegraphics in macros
as witnessed by the #1.eps and #2.eps, but it finds bib-files)
$ depend_tex eps all.tex
all.dvi: all.tex #1.eps #2.eps 1572-altus-slutet.eps
1585-altus-slutet.eps arcbeg-1.eps arcend-1.eps litt.bib lu-1.eps lu-2.eps
musvet.eps palhic-1.eps pallap-1.eps victbeg-1.eps victend-1.eps
all.psfonts: arcbeg.eps arcend.eps lu.eps palhic.eps pallap.eps victbeg.eps
victend.eps
Regards,
/Karl
#!/usr/bin/perl -w
use strict;
my %inc;
my %psfonts;
my $ext;
sub Usage() {
print "Usage:
depend_tex ext tex-file(s)
Where
ext is the file default extension in \\includegraphics
e.g.: eps, jpg
";
exit 1;
}
sub tex_inc( $ ) {
my $file = shift;
my $fh;
my %lst = ();
open($fh, "<", $file) || return;
while(<$fh>) {
s/%.*$//;
# this breaks when the files are included from a macro, and
# if the command is on more than one line
m/\\(include|input|includegraphics|bibliography)(\[[^\]]+\])?\{([^\}]+)\}/
|| next;
my $cmd = $1;
my $inc_file = $3;
if ($inc_file =~ m/\.(.){1,5}$/) {
# if it has a 1-5 letter extension, we don't need to add any
} elsif ($cmd eq "input") {
$inc_file .= ".tex";
} elsif ($cmd eq "include") {
$inc_file .= ".tex";
} elsif ($cmd eq "bibliography") {
$inc_file .= ".bib";
} else {
$inc_file .= ".$ext";
}
if ($cmd eq "input" && $inc_file =~ m/\.tex$/ && !$inc{$inc_file}) {
if ($inc_file =~ m/-systems.tex$/) {
} else {
$lst{$inc_file} = 1;
}
}
# we must condider non-existant files, they can be generated
$inc{$inc_file} = 1;
if ($inc_file =~ m/^(.*)-systems.tex$/ ||
$inc_file =~ m/^(.*)-\d+.eps$/ ) {
$psfonts{"$1.eps"} = 1;
}
}
close($fh);
foreach (keys(%lst)) {
&tex_inc($_);
}
}
if (@ARGV < 2) { Usage(); }
$ext = shift @ARGV;
my $file;
foreach $file (@ARGV) {
# reset found dependancies for each new file to check
%inc = ();
%psfonts = ();
&tex_inc($file);
my $stem = $file;
$stem =~ s/\.(la)?tex$//;
my $prefix = "$stem.dvi";
my $lst = join(" ", sort(keys(%inc)));
print "$prefix:\t$file ", $lst, "\n";
$lst = join(" ", sort(keys(%psfonts)));
if ($lst) {
print "$stem.psfonts:\t$lst\n";
}
}
_______________________________________________
lilypond-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-user