--- loncom/build/lpml_parse.pl 2001/09/17 18:25:15 1.10 +++ loncom/build/lpml_parse.pl 2001/09/17 20:44:38 1.11 @@ -228,6 +228,8 @@ my $dependency; my @links; my %categoryhash; +my @buildall; + # Make new parser with distribution specific input undef $parser; $parser = HTML::TokeParser->new(\$cleanstring) or @@ -325,6 +327,12 @@ sub format_lpml { print '# This file was automatically generated on '.`date`; print "\n".$invocation; } + elsif ($mode eq 'build') { + $lpml = "# Dynamic Makefile generated by LON-CAPA build process\n"; + $lpml .= '# This file was automatically generated on '.`date`; + $lpml .= "\n"; + $lpml .= "SHELL=\"/bin/sh\"\n\n"; + } else { return ''; } @@ -340,6 +348,9 @@ sub format_targetroot { elsif ($mode eq 'install') { return '# TARGET INSTALL LOCATION is "'.$targetroot."\"\n"; } + elsif ($mode eq 'build') { + return '# TARGET INSTALL LOCATION is "'.$targetroot."\"\n"; + } else { return ''; } @@ -355,6 +366,9 @@ sub format_sourceroot { elsif ($mode eq 'install') { return '# SOURCE CODE LOCATION IS "'.$sourceroot."\"\n";; } + elsif ($mode eq 'build') { + return '# SOURCE CODE LOCATION IS "'.$sourceroot."\"\n";; + } else { return ''; } @@ -634,6 +648,35 @@ sub format_files { return "\n".'files:'."\n".$text. "\n".'links:'."\n".join('',@links); } + elsif ($mode eq 'build') { + my $binfo; + my $tword; + my $command2; + my @deps; + foreach my $bi (@buildinfo) { + my ($source,$command,$trigger,@deps)=split(/\;/,$bi); + $tword=''; $tword=' alwaysrun' if $trigger eq 'always run'; + $command=~s/\/([^\/]*)$//; + $command2="cd $command; sh ./$1;\\"; + my $depstring; + foreach my $dep (@deps) { + $depstring.="\telif !(test -r $command/$dep);\\\n"; + $depstring.="\t\tthen echo ". + "\"**** LON-CAPA WARNING **** missing the file: ". + "$command/$dep\";\\\n"; + } + $binfo.="$source: $tword\n". + "\t\@if !(echo \"\");\\\n\t\tthen echo ". + "\"**** LON-CAPA WARNING **** Strange shell. ". + "Check your path settings.\";\\\n". + $depstring. + "\telse \\\n\t\t$command2\n\tfi\n\n"; + } + return 'all: '.join(' ',@buildall)."\n\n". + $text. + $binfo."\n". + "alwaysrun:\n\n"; + } else { return ''; } @@ -681,6 +724,12 @@ sub format_file { '**** CVS source file does not exist: '.$sourceroot.'/'. $source.'"'."\n"; } + elsif ($mode eq 'build' && $build) { + push @buildall,$sourceroot.'/'.$source; + push @buildinfo,$sourceroot.'/'.$source.';'.$build.';'. + $dependencies; +# return '# need to build '.$source."; + } else { return ''; } @@ -795,7 +844,7 @@ sub format_build { my $text=&trim($parser->get_text('/build')); if ($text) { $parser->get_tag('/build'); - $build=$text; + $build=$sourceroot.'/'.$text.';'.$tokeninfo[2]{'trigger'}; } return ''; } @@ -817,7 +866,8 @@ sub format_dependencies { my $text=&trim($parser->get_text('/dependencies')); if ($text) { $parser->get_tag('/dependencies'); - $dependencies=$text; + $dependencies=join(';', + (map {s/^\s*//;s/\s$//;$_} split(/\;/,$text))); } return ''; }