#!/usr/bin/perl
print "##\n";
print "## image-depend - generate dependencies for images.\n";
print "## Images are created by 'gnuplot'\n";
print "## from *.gpi input files\n";
print "##\n";
print "## Developed by Lubomir Host 'rajo' <rajo AT platon.sk>\n";
print "## Copyright (c) 2003 Platon SDG\n";
print "## Licensed under terms of GNU General Public License.\n";
print "## All rights reserved.\n";
print "##\n\n";
print "## \$Platon\$\n";
@ARGV = ('/dev/stdin') unless @ARGV;
$prefix = "images";
$input_patt = '^.*\.gpi$';
$pattern = '^.*\.dat$';
$rule = "\@echo '---- \$\@: \$?'\n touch \$@";
$used_files = "";
#printf STDERR "Processing files: ";
for $input ( @ARGV ) {
# printf STDERR "$input ";
if ($input =~ /$input_patt/) {
open $INPUT, "<$input" or die "can't open file '$input': $!";
$line = 1;
print "\n$input: ";
while (<$INPUT>) {
chop;
next if (m/^#/); # ignore comments
foreach my $file (split "\"", $_) {
#print "Testing '$file'\n";
if ($file =~ /$pattern/ && -f "$prefix/$file" ) {
#print "\\\n # line $line\n";
print "\\\n $prefix/$file ";
$used_files .= "# USED: $prefix/$file\n"
}
}
$line++;
}
print "\n $rule\n";
close ($INPUT);
}
}
print "#########################\n";
print "# Used files:\n";
print $used_files;
print "\n# End of dependencies\n";
print "# vim: ft=make\n";
# Next lines are needed
# vim: ft=perl
Platon Group <platon@platon.org> http://platon.org/
|