37 Generation of List of .as Files

This Perl script is intended to generate the files src/Makefile.asfiles and test/Makefile.asfiles. These files are generated via the call

perl asfiles.pl PROJECTROOT projectname directory > Makefile.asfiles

where PROJECTROOT is set to the full path of the root directory of the project, projectname is set to myalps (as specified in Makefile.def.nw) and directory is either src or test.

Convention 25 For simplicity we assume that there is at most one sourcefile command per line.

If the character % appears as the first non-whitespace character on the line then sourcefile then is not considered.

499* 21+   495  503
#------------------------------------------------------------------
#---
#--- ALLPROSE
#--- Copyright (C) Ralf Hemmecke (ralf@hemmecke.de)
#--- http://www.hemmecke.de/aldor
#---
#------------------------------------------------------------------

# The main loop
if (scalar(@ARGV) < 3) {
  die "Usage: $0 PROJECTROOT projectname directory\n";
}
$PROJECTROOT=$ARGV[0];
$projectname=$ARGV[1];
$directory  =$ARGV[2];

# do not write duplicate lines
%ASFILES=();

open(SF, "$PROJECTROOT/$projectname.tex.nw");
while (<SF>) {
    if (/\s*%/) {next;}
    if (/\\sourcefile{$directory\/([^}]+)\.as/) {$ASFILES{$1}=1;}
}
close(SF);
print "# Generated via\n# ".join(" \\\n#   ", $0, @ARGV)."\n";
print "ASFILES=\\\n  " . join("\\\n  ", sort keys %ASFILES) . "\n";

Uses ASFILES 462, loop 356, projectname 124, and PROJECTROOT 346.