--- loncom/build/Attic/parse.pl 2000/12/12 17:05:36 1.14 +++ loncom/build/Attic/parse.pl 2000/12/13 21:43:18 1.15 @@ -161,6 +161,11 @@ elsif ($mode eq "install") { $a=&make_links_install_segment(\@directories); print $a; } +elsif ($mode eq "build") { + @directories=&determine_directory_structure; + $a=&make_files_build_segment(\@directories); + print $a; +} # ------------------------------------------------------ a list of file targets sub make_file_list { @@ -465,6 +470,81 @@ END return $description; } +# ------------------------------------------------------ Commands to build files +sub make_files_build_segment { + my ($dirs)=@_; + my $description; + my @allfiles=keys %{$info{'LOCATION'}{$distribution}}; + my $tab="\t"; + my $sources="all: "; + foreach my $d (@$dirs) { + # set other values + my $dirdescription=$info{'DIRECTORY'}{$distribution}{$d}{'DESCRIPTION'}; + $dirdescription="(" . $dirdescription . ")" if $dirdescription; + # find files that are contained in this directory + my @files; + my @filesfull; + foreach my $f (@allfiles) { + if ($f=~/^$d\/([^\/]+)$/) { + push @files,$1; + push @filesfull,$f; + } + } + if (@files) { + foreach my $i (0..$#files) { + # if has build information, output appropriate something + my $build=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'BUILD'}; + my $source=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'SOURCE'}; + $build=~s/^\s+//; $build=~s/\s+$//; + if ($build) { + my $dependencies=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'DEPENDENCIES'}; + my $source2=$source; + $source2=~s/^[^\/]+\///; + $source2="../" . $source2; + $sources.="$source2 "; + my $directory=$build; + $directory=~s/^[^\/]+\///; + $directory=~s/([^\/]+)$//; + $directory="../" . $directory; + my $buildfile=$1; + my $sdir=$source; + $sdir=~s/^[^\/]+\///; + $sdir=~s/([^\/]+)$//; + $sdir="../" . $sdir; + $dependencies=~s/\s+$//; + my $depstat=""; + if ($dependencies=~s/\s+\[ALWAYS_RUN_BUILD_COMMAND\]//) { + $depstat=" alwaysrun"; + } + $dependencies=~s/\s+/ $sdir/gs; + $description.=<