[+ AutoGen5 template -*- Mode: Shell-script -*- sh +][+COMMENT use 'autogen --trace=everything melt-build-script.def' to debug this See http://www.gnu.org/software/autogen/ +]#!/bin/bash [+ (. (dne "#@#@# " "#@! ")) +] # Generated shell script for MELT modules and MELT translator bootstrap # Copyright (C) 2012 Free Software Foundation # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # #@ [+ (. (tpl-file-line))+] generated by Autogen [+ (. autogen-version)+] using [+ (.(def-file))+] ## melt-build-script.tpl generates melt-build-script.sh which may ## create meltbuild-* files and directories. The invoking makefile ## may clean these meltbuild-* things. ## Ypu may want to set the GCCMELT_BUILD_NOTIFICATION environment variable ## to a shell script called with two arguments (a title, and a message) ## e.g. using notify-send or logger in such a script. shopt -s nullglob [+(. (define comefromcount 0))+] [+(. (define (fromline) (set! comefromcount (+ comefromcount 1)) (sprintf "%s/%d" (tpl-file-line "%s:%d") comefromcount) ))+] ## set the overallgoal [+(.(fromline))+] melt_overall_goal=$1 if [ -z "$melt_overall_goal" ]; then melt_overall_goal=gendoc fi ## source the builtin settings [+(.(fromline))+] generated from the MELT runtime . ./melt-build-settings.sh ## source the parameters [+(.(fromline))+] . ./melt-build-param.sh export GAWK=${GAWK:=gawk} export MD5SUM=${MD5SUM:=md5sum} ## internal variables for this script [+(.(fromline))+] ## GCCMELT_STAGE is an internal variable; it keeps the current MELT stage export GCCMELT_STAGE="" ## GCCMELT_BASE is an internal variable; it keeps the current MELT base export GCCMELT_BASE="" ## GCCMELT_SKIPEMITC is an internal variable; it skips the emission of C code when non-empty export GCCMELT_SKIPEMITC="" date +"/*empty file for MELT build %c*/" > meltbuild-empty-file.c [ -d meltbuild-workdir ] || mkdir meltbuild-workdir [ -d meltbuild-tempdir ] || mkdir meltbuild-tempdir ## our error function [+(.(fromline))+] function meltbuild_error () { echo MELT BUILD SCRIPT FAILURE: $@ > /dev/stderr exit 1 } ## symbolic linking function meltbuild_symlink () { ln -svf `realpath $1` $2 } ## our info function function meltbuild_info () { echo MELT BUILD SCRIPT INFO: $@ > /dev/stderr } ## our notice function - for more important things than info function meltbuild_notice () { meltnotititle=$1 shift (echo; echo; echo MELT BUILD SCRIPT NOTICE "$meltnotititle:" $@ ; echo ) > /dev/stderr if [ -n "$GCCMELT_BUILD_NOTIFICATION" ]; then $GCCMELT_BUILD_NOTIFICATION "$meltnotititle:" "$*" fi } ## utility to build MELT specific arguments in meltbuild_emit function meltbuild_arg () { local meltarg=$1 if [ -z "$GCCMELT_IS_PLUGIN" ]; then echo " -fmelt-$meltarg" else echo " -fplugin-arg-melt-$meltarg" fi } if [ ! -f "$GCCMELT_RUNTIME_DEPENDENCY" ]; then meltbuild_error [+(.(fromline))+] missing MELT runtime dependency "$GCCMELT_RUNTIME_DEPENDENCY" fi if [ -z "$GCCMELT_CC1" ]; then meltbuild_error [+(.(fromline))+] missing GCCMELT_CC1 fi if [ ! -f meltrunsup.h ]; then meltbuild_symlink $GCCMELT_MELTSOURCEDIR/generated/meltrunsup.h meltrunsup.h meltbuild_info [+(.(fromline))+] symlinking meltrunsup.h header fi GCCMELT_RUNTIME_DEPENDENCY_MD5SUM=$($MD5SUM "$GCCMELT_RUNTIME_DEPENDENCY" | cut -b 1-32) case $melt_overall_goal in translator) ;; applications) ;; modlists) ;; checkruntime) ;; gendoc) ;; regenerate) ;; *) meltbuild_error [+(.(fromline))+] bad MELT overall goal "$melt_overall_goal:" \ expecting translator, applications, modlists, checkruntime or gendoc or regenerate esac ################################################################ ################ stage zero GCCMELT_ZERO_FLAVOR=${GCCMELT_STAGE_ZERO#meltbuild-stage0-} ## The base name of the MELT translator files [+ (. (fromline))+] GCCMELT_TRANSLATOR_BASE=([+FOR melt_translator_file " \\\n"+] [+base+][+ENDFOR melt_translator_file+] ) case $GCCMELT_ZERO_FLAVOR in optimized) ;; dynamic) ;; debugnoline) ;; quicklybuilt) ;; *) meltbuild_error [+(.(fromline))+] bad zero flavor $GCCMELT_ZERO_FLAVOR ;; esac ## our stage0 [+(.(fromline))+] [ -d $GCCMELT_STAGE_ZERO ] || mkdir $GCCMELT_STAGE_ZERO function meltbuild_do_stage_zero () { meltbuild_notice STAGE0+ [+(.(fromline))+] starting stage zero [+FOR melt_translator_file+] meltbuild_info making stage0 [+base+] [+(.(fromline))+] ## stage0 [+(.(fromline))+] symlink descriptor file [+base+] if [ ! -f "$GCCMELT_STAGE_ZERO/[+base+]+meltdesc.c" ]; then meltbuild_symlink $GCCMELT_MELTSOURCEDIR/generated/[+base+]+meltdesc.c $GCCMELT_STAGE_ZERO/ fi ## stage0 [+(.(fromline))+] symlink melt/generated source code [+base+] if [ ! -f "$GCCMELT_STAGE_ZERO/[+base+].c" ]; then meltbuild_symlink $GCCMELT_MELTSOURCEDIR/generated/[+base+].c $GCCMELT_STAGE_ZERO/ for f in $GCCMELT_MELTSOURCEDIR/generated/[+base+]+[0-9][0-9].c ; do meltbuild_symlink $f $GCCMELT_STAGE_ZERO/`basename $f` done fi ## stage0 [+(.(fromline))+] symlink stamp [+base+] if [ ! -f "$GCCMELT_STAGE_ZERO/[+base+]+melttime.h" ]; then meltbuild_symlink $GCCMELT_MELTSOURCEDIR/generated/[+base+]+melttime.h $GCCMELT_STAGE_ZERO/[+base+]+melttime.h fi MELT_ZERO_GENERATED_[+varsuf+]_CUMULMD5=$($GAWK -F\" '/extern/{next} /melt_cumulated_hexmd5/{print $2}' $GCCMELT_MELTSOURCEDIR/generated/[+base+]+meltdesc.c) ## manually generate the stage0 [+base+]+meltbuild.mk file [+(.(fromline))+] MELT_ZERO_GENERATED_[+varsuf+]_BUILDMK=$GCCMELT_STAGE_ZERO/[+base+]+meltbuild.mk date +"# file $MELT_ZERO_GENERATED_[+varsuf+]_BUILDMK script-generated %c" > $MELT_ZERO_GENERATED_[+varsuf+]_BUILDMK-tmp$$ echo "# generated " [+(.(fromline))+] >> $MELT_ZERO_GENERATED_[+varsuf+]_BUILDMK-tmp$$ echo "MELTGEN_MODULENAME=$GCCMELT_STAGE_ZERO/[+base+]" >> $MELT_ZERO_GENERATED_[+varsuf+]_BUILDMK-tmp$$ echo "MELTGEN_MODULEIDENT=melt_stage_zero_[+varsuf+]" >> $MELT_ZERO_GENERATED_[+varsuf+]_BUILDMK-tmp$$ echo '# zerostage objects of [+base+] [+(.(fromline))+]' >> $MELT_ZERO_GENERATED_[+varsuf+]_BUILDMK-tmp$$ echo $GCCMELT_STAGE_ZERO/[+base+].$MELT_ZERO_GENERATED_[+varsuf+]_CUMULMD5.descriptor.meltpic.o: $GCCMELT_STAGE_ZERO/[+base+]+meltdesc.c >> $MELT_ZERO_GENERATED_[+varsuf+]_BUILDMK-tmp$$ for f in $GCCMELT_STAGE_ZERO/[+base+].c $GCCMELT_STAGE_ZERO/[+base+]+[0-9][0-9].c; do echo >> $MELT_ZERO_GENERATED_[+varsuf+]_BUILDMK-tmp$$ echo $GCCMELT_STAGE_ZERO/`basename $f .c`._NOMDFIVESUM_.$GCCMELT_ZERO_FLAVOR.meltpic.o: $f >> $MELT_ZERO_GENERATED_[+varsuf+]_BUILDMK-tmp$$ done echo >> $MELT_ZERO_GENERATED_[+varsuf+]_BUILDMK-tmp$$ echo '# zerostage module of [+base+] [+(.(fromline))+]' >> $MELT_ZERO_GENERATED_[+varsuf+]_BUILDMK-tmp$$ echo $GCCMELT_STAGE_ZERO/[+base+].meltmod-$MELT_ZERO_GENERATED_[+varsuf+]_CUMULMD5.$GCCMELT_ZERO_FLAVOR.so: \\ >> $MELT_ZERO_GENERATED_[+varsuf+]_BUILDMK-tmp$$ echo " " $GCCMELT_STAGE_ZERO/[+base+].$MELT_ZERO_GENERATED_[+varsuf+]_CUMULMD5.descriptor.meltpic.o \\ >> $MELT_ZERO_GENERATED_[+varsuf+]_BUILDMK-tmp$$ for f in $GCCMELT_STAGE_ZERO/[+base+]+[0-9][0-9].c; do echo " " $GCCMELT_STAGE_ZERO/`basename $f .c`._NOMDFIVESUM_.$GCCMELT_ZERO_FLAVOR.meltpic.o \\ >> $MELT_ZERO_GENERATED_[+varsuf+]_BUILDMK-tmp$$ done echo " " $GCCMELT_STAGE_ZERO/[+base+]._NOMDFIVESUM_.$GCCMELT_ZERO_FLAVOR.meltpic.o >> $MELT_ZERO_GENERATED_[+varsuf+]_BUILDMK-tmp$$ echo >> $MELT_ZERO_GENERATED_[+varsuf+]_BUILDMK-tmp$$ echo MELTGENMOD_CUMULATED_MD5SUM_melt_stage_zero_[+varsuf+]=$MELT_ZERO_GENERATED_[+varsuf+]_CUMULMD5 >> $MELT_ZERO_GENERATED_[+varsuf+]_BUILDMK-tmp$$ echo MELTGENMOD_NAKED_NAME_melt_stage_zero_[+varsuf+]=[+base+] >> $MELT_ZERO_GENERATED_[+varsuf+]_BUILDMK-tmp$$ echo '#end of generated file ' $MELT_ZERO_GENERATED_[+varsuf+]_BUILDMK >> $MELT_ZERO_GENERATED_[+varsuf+]_BUILDMK-tmp$$ ## mv $MELT_ZERO_GENERATED_[+varsuf+]_BUILDMK-tmp$$ $MELT_ZERO_GENERATED_[+varsuf+]_BUILDMK meltbuild_info [+(.(fromline))+] generated stagezero makedep $MELT_ZERO_GENERATED_[+varsuf+]_BUILDMK ls -l $MELT_ZERO_GENERATED_[+varsuf+]_BUILDMK > /dev/stderr $GCCMELT_MAKE -f $GCCMELT_MODULE_MK melt_module \ GCCMELT_FROM=stagezero-[+(.(fromline))+] \ GCCMELT_COMPILER="$GCCMELT_COMPILER" \ GCCMELTGEN_BUILD=$GCCMELT_STAGE_ZERO/ \ GCCMELT_MODULE_WORKSPACE=meltbuild-workdir \ GCCMELT_MODULE_FLAVOR=$GCCMELT_ZERO_FLAVOR \ GCCMELT_CFLAGS="$GCCMELT_COMPILER_FLAGS" \ GCCMELT_MODULE_SOURCEBASE=$GCCMELT_STAGE_ZERO/[+base+] \ GCCMELT_CUMULATED_MD5=$MELT_ZERO_GENERATED_[+varsuf+]_CUMULMD5 \ GCCMELT_MODULE_BINARYBASE=$GCCMELT_STAGE_ZERO/[+base+] \ GCCMELT_MODULE_DEPENDENCIES="$GCCMELT_CC1_DEPENDENCIES" \ || meltbuild_error [+(.(fromline))+] stage0 [+base+] did not build "(with $GCCMELT_MAKE -f $GCCMELT_MODULE_MK)" compiler $GCCMELT_COMPILER cflags $GCCMELT_COMPILER_FLAGS meltbuild_info [+(.(fromline))+] stage0 [+base+] module ls -l "$GCCMELT_STAGE_ZERO/[+base+].meltmod-$MELT_ZERO_GENERATED_[+varsuf+]_CUMULMD5.$GCCMELT_ZERO_FLAVOR.so" > /dev/stderr \ || meltbuild_error [+(.(fromline))+] stage0 [+base+] fail to build \ "$GCCMELT_STAGE_ZERO/[+base+].meltmod-$MELT_ZERO_GENERATED_[+varsuf+]_CUMULMD5.$GCCMELT_ZERO_FLAVOR.so" meltbuild_info [+(.(fromline))+] successfully build stage0 [+base+] # end stage0 [+(.(fromline))+] base [+base+] [+ENDFOR melt_translator_file+] } ################ end of function meltbuild_do_stage_zero [+(.(fromline))+] ################################################################ ## stage0 stamp file [+(.(fromline))+] melt_stagezero_stamp=$GCCMELT_STAGE_ZERO/$GCCMELT_STAGE_ZERO.stamp ## test if stage0 should be skipped then do it [+(.(fromline))+] if [ ! -f "$melt_stagezero_stamp" -o "$melt_stagezero_stamp" -ot "$GCCMELT_RUNTIME_DEPENDENCY" ]; then meltbuild_do_stage_zero melt_stagezero_stamptemp=$melt_stagezero_stamp-tmp$$ echo MELT stagezero stampfile $GCCMELT_STAGE_ZERO.stamp for MELT $MELTGCCBUILTIN_VERSION_STRING from [+(.(fromline))+] > $melt_stagezero_stamptemp echo $GCCMELT_RUNTIME_DEPENDENCY_MD5SUM $GCCMELT_RUNTIME_DEPENDENCY >> $melt_stagezero_stamptemp [+FOR melt_translator_file+] # stagezero stamp [+(.(fromline))+] base [+base+] $MD5SUM $GCCMELT_STAGE_ZERO/[+base+].c $GCCMELT_STAGE_ZERO/[+base+]+[0-9][0-9].c >> $melt_stagezero_stamptemp $MD5SUM $GCCMELT_STAGE_ZERO/[+base+].meltmod-$MELT_ZERO_GENERATED_[+varsuf+]_CUMULMD5.$GCCMELT_ZERO_FLAVOR.so >> $melt_stagezero_stamptemp [+ENDFOR melt_translator_file+] $GCCMELT_MOVE_IF_CHANGE $melt_stagezero_stamptemp $melt_stagezero_stamp else meltbuild_info [+(.(fromline))+] skipped stage0 because of stamp file $melt_stagezero_stamp fi meltbuild_info [+(.(fromline))+] times after stagezero at `date '+%x %H:%M:%S'`: ; times > /dev/stderr ################################################################ ## function to run MELT to emit C code [+(.(fromline))+] function meltbuild_emit () { local meltfrom=$1 local meltmode=$2 local meltbase=$3 local meltstage=$4 local meltprevstage=$5 local meltinit=$6 local meltinclude=$7 local meltargs=$meltstage/$meltbase.args local meltsrc=$(realpath $GCCMELT_MELTSOURCEDIR/$meltbase.melt) meltbuild_info meltfrom=$meltfrom meltmode=$meltmode meltbase=$meltbase meltstage=$meltstage meltprevstage=$meltprevstage meltinit=$meltinit meltinclude=$meltinclude meltsrc=$meltsrc local meltsum local meltprevf if [ -z "$meltmode" ]; then meltbuild_error $meltfrom no MELT mode at stage $meltstage fi if [ ! -f "$meltsrc" ]; then meltbuild_error $meltfrom no MELT file $meltsrc at stage $meltstage base $meltbase fi if [ -z "$meltinit" ]; then meltbuild_error $meltfrom no MELT init at stage $meltstage base $meltbase fi meltsum=$($MD5SUM $meltsrc | $GAWK '{print $1}') meltbuild_info $meltfrom emit C code for $meltbase of $meltstage echo -Wno-shadow -frandom-seed=$meltsum > $meltargs-$$-tmp ## various arguments echo " -DGCCMELT_FROM_ARG=\"$meltfrom\"" >> $meltargs-$$-tmp meltbuild_arg mode=$meltmode >> $meltargs-$$-tmp meltbuild_arg arg=$meltsrc >> $meltargs-$$-tmp meltbuild_arg output=$meltstage/$meltbase >> $meltargs-$$-tmp meltbuild_arg "module-make-command='$GCCMELT_MAKE'" >> $meltargs-$$-tmp meltbuild_arg module-makefile=$GCCMELT_MODULE_MK >> $meltargs-$$-tmp meltbuild_arg "module-cflags='$GCCMELT_INCLUDES -I. -I$meltstage -I$meltprevstage $GCCMELT_COMPILER_FLAGS'" >> $meltargs-$$-tmp meltbuild_arg init=$meltinit >> $meltargs-$$-tmp meltbuild_arg workdir=meltbuild-workdir >> $meltargs-$$-tmp meltbuild_arg tempdir=meltbuild-tempdir >> $meltargs-$$-tmp meltbuild_arg source-path=$meltstage:$meltprevstage:. >> $meltargs-$$-tmp meltbuild_arg module-path=$meltstage:$meltprevstage:. >> $meltargs-$$-tmp meltbuild_arg bootstrapping >> $meltargs-$$-tmp meltbuild_arg generate-work-link >> $meltargs-$$-tmp meltbuild_arg generated-c-file-list=$meltstage/$meltbase.cfilist >> $meltargs-$$-tmp ## final empty file echo meltbuild-empty-file.c >> $meltargs-$$-tmp mv $meltargs-$$-tmp $meltargs meltbuild_info $meltfrom argument file $meltargs is cat $meltargs < /dev/null > /dev/stderr if [ -z "$GCCMELT_SKIPEMITC" ]; then $GCCMELT_CC1_PREFIX $GCCMELT_CC1 @$meltargs || meltbuild_error $meltfrom failed with arguments @$meltargs ## remove obsolete secondary C files left previously in $meltstage for meltcsecfil in $meltstage/$meltbase+[0-9][0-9].c ; do if grep -q `basename $meltcsecfil` "$meltstage/$meltbase.cfilist" ; then : # at [+(.(fromline))+] else meltbuild_info $meltfrom removing obsolete $meltcsecfil rm -f "$meltcsecfil" fi done else meltbuild_info $meltfrom skips emission of C code with @$meltargs stage $meltstage prevstage $meltprevstage skipreason $GCCMELT_SKIPEMITC ls -l $meltprevstage/$meltbase* for meltprevf in $meltprevstage/$meltbase.c $meltprevstage/$meltbase+[0-9][0-9].c $meltprevstage/$meltbase+meltdesc.c $meltprevstage/$meltbase+melttime.h $meltprevstage/$meltbase+meltbuild.mk ; do meltbuild_symlink $meltprevf $meltstage/`basename $meltprevf` done meltbuild_info $meltfrom symlinked previous stage $meltprevstage/$meltbase fi GCCMELT_STAGE=$meltstage GCCMELT_BASE=$meltbase } ################################ end function meltbuild_emit ################################################################ ################################################################ #################@ before our stages [+(.(fromline))+] ### Our stages [+FOR melt_stage " "+][+stagdir+][+ENDFOR meltstage+] ### are incrementally built, with the former modules of ### the current stage and the later modules of the previous stages ### used to emit the source of the current module in the current stage. ### This is a kind of "diagonalization". ################################################################ #### function to do a stage [+(.(fromline))+] function meltbuild_do_stage () { local meltfrom=$1 local meltcurstagedir=$2 local meltcurflavor=$3 local meltprevstagedir=$4 local meltprevflavor=$5 [+FOR melt_translator_file+] local meltchecksum_[+varsuf+] [+ENDFOR melt_translator_file+] local meltstamp local meltstamptmp #### meltbuild_do_stage [+(.(fromline))+] meltbuild_notice "$meltcurstagedir+" starting stage $meltcurstagedir flavor $meltcurflavor from $meltfrom #### meltbuild_do_stage [+(.(fromline))+] meltbuild_info $meltfrom starting stage $meltcurstagedir flavor $meltcurflavor previous $meltprevstagedir previous flavor $meltprevflavor [ -d $meltcurstagedir ] || mkdir $meltcurstagedir if [ ! -d "$meltprevstagedir" -o ! -f "$meltprevstagedir/$meltprevstagedir.stamp" ]; then meltbuild_error $meltfrom previous stage "$meltprevstagedir/" without stamp file $meltprevstagedir/$meltprevstagedir.stamp fi [+FOR melt_translator_file+][+ (define outbase (get "base")) (define outindex (for-index)) +] #in meltbuild_do_stage [+(.(fromline))+] base [+base+] meltbuild_info [+(.(fromline))+] from $meltfrom generating C code of [+base+] in $meltcurstagedir #in meltbuild_do_stage [+(.(fromline))+] emit C code for [+base+] meltbuild_emit [+(.(fromline))+]-$meltfrom \ [+IF (= outindex 0)+]translateinit[+ELSE+]translatefile[+ENDIF+] \ [+base+] \ "$meltcurstagedir" \ "$meltprevstagedir" \ [+FOR melt_translator_file ":"+][+ (define inindex (for-index)) (define depstage (if (< inindex outindex) "$meltcurstagedir" "$meltprevstagedir")) (define depflavor (if (< inindex outindex) "$meltcurflavor" "$meltprevflavor")) +][+(. depstage)+]/[+base+].[+ (. depflavor)+][+ENDFOR melt_translator_file+] \ "[+FOR includeload " "+][+includeload+][+ENDFOR includeload+]" #in meltbuild_do_stage [+(.(fromline))+] checksum C code for [+base+] meltchecksum_cumul_[+varsuf+]=$(cat "$meltcurstagedir"/[+base+].c "$meltcurstagedir"/[+base+]+[0-9][0-9].c | $MD5SUM | cut -b 1-32) #in meltbuild_do_stage [+(.(fromline))+] perhaps compiling C code for [+base+] if [ -z "$GCCMELT_SKIPEMITC" ]; then meltbuild_info [+(.(fromline))+]-$meltfrom compiling module [+base+] in "$meltcurstagedir" $GCCMELT_MAKE -f $GCCMELT_MODULE_MK melt_module \ GCCMELT_FROM="[+(.(fromline))+]-$meltfrom" \ GCCMELT_MODULE_WORKSPACE=meltbuild-workdir \ GCCMELT_MODULE_FLAVOR="$meltcurflavor" \ GCCMELT_COMPILER="$GCCMELT_COMPILER" \ GCCMELT_CFLAGS="$GCCMELT_COMPILER_FLAGS" \ GCCMELT_MODULE_SOURCEBASE="$meltcurstagedir/[+base+]" \ GCCMELT_MODULE_BINARYBASE="$meltcurstagedir/[+base+]" \ || meltbuild_error [+(.(fromline))+]-$meltfrom in "$meltcurstagedir/" failed to make "($GCCMELT_MAKE -f $GCCMELT_MODULE_MK)" module [+base+] compiler "$GCCMELT_COMPILER" cflags "$GCCMELT_COMPILER_FLAGS" else meltbuild_info [+(.(fromline))+]-$meltfrom NOT compiling module [+base+] "in" \ "$meltcurstagedir/" but symlinking previous "$meltprevstagedir/" module [+base+] \ checksum $meltchecksum_cumul_[+varsuf+] skipemitc=$GCCMELT_SKIPEMITC. meltbuild_symlink "$meltprevstagedir/[+base+].meltmod-$meltchecksum_cumul_[+varsuf+].$meltprevflavor.so" \ "$meltcurstagedir/[+base+].meltmod-$meltchecksum_cumul_[+varsuf+].$meltcurflavor.so" fi #in meltbuild_do_stage [+(.(fromline))+] done base [+base+] [+ENDFOR melt_translator_file+] #in meltbuild_do_stage [+(.(fromline))+] generating the stampfile meltstamp=$meltcurstagedir/$meltcurstagedir.stamp meltstamptmp=$meltstamp-tmp$$ echo "///timestamp file $meltstamp" > $meltstamptmp echo $GCCMELT_RUNTIME_DEPENDENCY_MD5SUM $GCCMELT_RUNTIME_DEPENDENCY >> $meltstamptmp [+FOR melt_translator_file+] $MD5SUM $meltcurstagedir/[+base+].c $meltcurstagedir/[+base+]+[0-9][0-9].c >> $meltstamptmp $MD5SUM "$meltcurstagedir/[+base+].meltmod-$meltchecksum_cumul_[+varsuf+].$meltcurflavor.so" >> $meltstamptmp [+ENDFOR melt_translator_file+] echo "///end timestamp file $meltstamp" $GCCMELT_MOVE_IF_CHANGE $meltstamptmp $meltstamp #in meltbuild_do_stage [+(.(fromline))+] ending meltbuild_info $meltfrom done stage $meltcurstagedir flavor $meltcurflavor previous $meltprevstagedir previous flavor $meltprevflavor timestamp $meltstamp } #### end meltbuild_do_stage [+(.(fromline))+] ################################################################ ##### possibly run all our stages [+(.(fromline))+] [+FOR melt_build_stage+] #@ [+(.(fromline))+] stagedir [+stagdir+] GCCMELT_SKIPEMITC= if [ ! -f [+stagdir+]/[+stagdir+].stamp -o [+stagdir+]/[+stagdir+].stamp -ot $GCCMELT_RUNTIME_DEPENDENCY \ [+FOR melt_translator_file+] -o [+stagdir+]/[+stagdir+].stamp -ot $GCCMELT_MELTSOURCEDIR/[+base+].melt \ [+ENDFOR melt_translator_file+] ]; then meltbuild_info [+(.(fromline))+] building stage [+stagdir+] ## building stage [+stagdir+] previous [+stagprevdir+] [+(.(fromline))+] meltbuild_do_stage [+(.(fromline))+] [+stagdir+] quicklybuilt [+stagprevdir+] [+stagprevflavor+] else meltbuild_info [+(.(fromline))+] skipping stage [+stagdir+] fi ## [+(.(fromline))+] GCCMELT_LASTSTAGE=[+stagdir+] [+ENDFOR melt_build_stage+] ################################################################ GCCMELT_LASTSTAGE=$GCCMELT_STAGE meltbuild_info [+(.(fromline))+] last stage $GCCMELT_LASTSTAGE ################################################################ ################################################################ ###########@ before generating meltbuild-sources [+(.(fromline))+] #### the meltbuild-sources is the final sources directory, to be #### installed. They are generated from the last stage, using the #### modules inside it. Notice that in contrast from the intermediate #### stages no "diagonalization" is involved. [ -d meltbuild-sources ] || mkdir meltbuild-sources #@ from [+(.(fromline))+] compiling the modules [ -d meltbuild-modules ] || mkdir meltbuild-modules ################################################################ function meltbuild_emit_translator_sources () { [+FOR melt_translator_file+] ## meltbuild_emit_source [+(.(fromline))+] base [+base+] meltbuild_info [+(.(fromline))+] generating C code of [+base+] in meltbuild-sources meltbuild_emit [+(.(fromline))+] \ [+IF (= (for-index) 0)+]translateinit[+ELSE+]translatefile[+ENDIF+] \ [+base+] \ meltbuild-sources \ "$GCCMELT_LASTSTAGE" \ [+FOR melt_translator_file ":"+]$GCCMELT_LASTSTAGE/[+base+].quicklybuilt[+ENDFOR melt_translator_file+] \ "[+FOR includeload " "+][+includeload+][+ENDFOR includeload+]" [+ENDFOR melt_translator_file+] } # end of function meltbuild_emit_translator_sources ################ function meltbuild_compile_translator_modules () { [+FOR flavor IN quicklybuilt optimized debugnoline+] # in meltbuild_compile_translator_sources [+flavor+] [+(.(fromline))+] meltbuild_info [+(.(fromline))+] compiling translator [+flavor+] [+FOR melt_translator_file+] #@ [+(.(fromline))+] flavor [+flavor+] base [+base+] $GCCMELT_MAKE -f $GCCMELT_MODULE_MK melt_module \ GCCMELT_FROM=[+(.(fromline))+] \ GCCMELT_MODULE_WORKSPACE=meltbuild-workdir \ GCCMELT_MODULE_FLAVOR=[+flavor+] \ GCCMELT_COMPILER="$GCCMELT_COMPILER" \ GCCMELT_CFLAGS="$GCCMELT_COMPILER_FLAGS" \ GCCMELT_MODULE_SOURCEBASE=meltbuild-sources/[+base+] \ GCCMELT_MODULE_BINARYBASE=meltbuild-modules/[+base+] \ || meltbuild_error [+(.(fromline))+] in meltbuild-modules failed to compile translator [+base+] [+flavor+] make "($GCCMELT_MAKE -f $GCCMELT_MODULE_MK)" compiler "$GCCMELT_COMPILER" cflags $GCCMELT_COMPILER_FLAGS [+ENDFOR melt_translator_file+] [+ENDFOR flavor+] } # end of function meltbuild_compile_translator_modules ################################################################ #################@ [+(.(fromline))+] function meltbuild_symlink_melt_translator_sources () { [+FOR melt_translator_file+][+ (define outbase (get "base")) (define outindex (for-index)) +] ### symlinking the MELT translator code in meltbuild-sources for [+base+] from [+ (. (fromline))+] meltbuild_info [+(.(fromline))+] putting MELT translator code of [+base+] in meltbuild-sources meltbuild_symlink $GCCMELT_MELTSOURCEDIR/[+base+].melt meltbuild-sources/[+base+].melt [+FOR includeload "\n"+]meltbuild_symlink [+includeload+] meltbuild-sources/[+includeload+][+ENDFOR includeload+] [+ENDFOR melt_translator_file+] } # end of meltbuild_symlink_melt_translator_sources ################@ [+(.(fromline))+] melt_final_translator_stamp=meltbuild-final-translator.stamp if [ ! -f $melt_final_translator_stamp -o $melt_final_translator_stamp -ot $GCCMELT_RUNTIME_DEPENDENCY \ [+FOR melt_translator_file+] -o $melt_final_translator_stamp -ot $GCCMELT_MELTSOURCEDIR/[+base+].melt \ [+ENDFOR melt_translator_file+] -o $melt_final_translator_stamp -ot $GCCMELT_LASTSTAGE/$GCCMELT_LASTSTAGE.stamp ]; then meltbuild_notice 'Emit Translator Source' [+(.(fromline))+] emit then translate the MELT translator meltbuild_info [+(.(fromline))+] emit then translate the compile translator for $melt_final_translator_stamp meltbuild_emit_translator_sources meltbuild_symlink_melt_translator_sources meltbuild_compile_translator_modules melt_final_translator_stamptemp=$melt_final_translator_stamp-tmp$$ echo "///MELT translator timestamp file $melt_final_translator_stamp" > $melt_final_translator_stamptemp echo $GCCMELT_RUNTIME_DEPENDENCY_MD5SUM $GCCMELT_RUNTIME_DEPENDENCY >> $melt_final_translator_stamptemp [+FOR melt_translator_file+] #@ [+(.(fromline))+] $MD5SUM meltbuild-sources/[+base+].melt >> $melt_final_translator_stamptemp [+FOR includeload+] $MD5SUM meltbuild-sources/[+includeload+] >> $melt_final_translator_stamptemp [+ENDFOR includeload+] $MD5SUM meltbuild-sources/[+base+].c meltbuild-sources/[+base+]+[0-9][0-9].c >> $melt_final_translator_stamptemp melt_translator_[+varsuf+]_cumulmd5=$(cat meltbuild-sources/[+base+].c meltbuild-sources/[+base+]+[0-9][0-9].c | $MD5SUM | cut -b 1-32) [+ENDFOR melt_translator_file+] echo "///end timestamp file $melt_final_translator_stamp" $GCCMELT_MOVE_IF_CHANGE $melt_final_translator_stamptemp $melt_final_translator_stamp else meltbuild_info [+(.(fromline))+] skip final translation of translator stamp $melt_final_translator_stamp fi ################################################################ #@ [+(.(fromline))+] if [ "$melt_overall_goal" = "translator" ]; then meltbuild_info [+(.(fromline))+] done translation overall goal with stamp $melt_final_translator_stamp exit 0 fi ################ #@ [+(.(fromline))+] before application xtramelt* modules ################################################################ meltbuild_info [+(.(fromline))+] before applications GCCMELT_SKIPEMITC=$GCCMELT_SKIPEMITC. meltbuild_info [+(.(fromline))+] times before applications at `date '+%x %H:%M:%S'`: ; times > /dev/stderr melt_final_application_stamp=meltbuild-final-application.stamp function meltbuild_do_applications () { meltbuild_notice 'doing applications' [+(.(fromline))+] doing applications [+FOR melt_application_file+] [+ (define apbase (get "base")) (define apindex (for-index)) +] ## meltbuild_do_applications [+base+] [+(.(fromline))+] if [ ! -f meltbuild-sources/[+base+].melt ]; then meltbuild_symlink $GCCMELT_MELTSOURCEDIR/[+base+].melt meltbuild-sources/[+base+].melt fi ## meltbuild_do_applications [+base+] [+(.(fromline))+] if [ ! -f meltbuild-sources/[+base+].c -o ! -f meltbuild-sources/[+base+]+meltdesc.c \ -o meltbuild-sources/[+base+]+meltdesc.c -ot meltbuild-final-translator.stamp \ -o meltbuild-sources/[+base+]+meltdesc.c -ot meltbuild-sources/[+base+].melt \ [+FOR melt_application_file+][+IF (< (for-index) apindex)+] -o meltbuild-sources/[+base+]+meltdesc.c -ot meltbuild-sources/[+(. apbase)+]+meltdesc.c \ [+ENDIF+][+ENDFOR melt_application_file+] ]; then meltbuild_info [+(.(fromline))+] emit application C code for [+base+] meltbuild_emit [+(.(fromline))+] \ translatefile \ [+base+] \ meltbuild-sources \ meltbuild-modules \ [+FOR melt_translator_file ":"+][+base+].optimized[+ENDFOR melt_translator_file+][+FOR melt_application_file+][+IF (< (for-index) apindex)+]:[+base+].quicklybuilt[+ENDIF+][+ENDFOR melt_application_file+] \ "[+FOR includeload " "+][+includeload+][+ENDFOR includeload+]" \ || meltbuild_error [+(.(fromline))+] failed to generate C code of application [+base+] else meltbuild_info [+(.(fromline))+] DONT emit application C code for [+base+] fi local meltapp_[+varsuf+]_cumulmd5=$(cat meltbuild-sources/[+base+].c meltbuild-sources/[+base+]+[0-9][0-9].c | $MD5SUM | cut -b 1-32) [+FOR flavor IN quicklybuilt optimized debugnoline+] if [ ! -f meltbuild-modules/[+base+].meltmod-$meltapp_[+varsuf+]_cumulmd5.[+flavor+].so \ -o meltbuild-modules/[+base+].meltmod-$meltapp_[+varsuf+]_cumulmd5.[+flavor+].so -ot meltbuild-final-translator.stamp \ -o meltbuild-modules/[+base+].meltmod-$meltapp_[+varsuf+]_cumulmd5.[+flavor+].so -ot meltbuild-sources/[+base+].c \ -o meltbuild-modules/[+base+].meltmod-$meltapp_[+varsuf+]_cumulmd5.[+flavor+].so -ot meltbuild-sources/[+base+]+meltdesc.c ]; then meltbuild_info [+(.(fromline))+] compiling application module for [+base+] [+flavor+] $GCCMELT_MAKE -f $GCCMELT_MODULE_MK melt_module \ GCCMELT_FROM=[+(.(fromline))+] \ GCCMELT_MODULE_WORKSPACE=meltbuild-workdir \ GCCMELT_MODULE_FLAVOR=[+flavor+] \ GCCMELT_COMPILER="$GCCMELT_COMPILER" \ GCCMELT_CFLAGS="$GCCMELT_COMPILER_FLAGS" \ GCCMELT_MODULE_SOURCEBASE=meltbuild-sources/[+base+] \ GCCMELT_MODULE_BINARYBASE=meltbuild-modules/[+base+] \ || meltbuild_error [+(.(fromline))+] in meltbuild-modules failed to compile application [+base+] [+flavor+] "($GCCMELT_MAKE -f $GCCMELT_MODULE_MK)" compiler $GCCMELT_COMPILER_FLAGS cflags $GCCMELT_COMPILER_FLAGS else meltbuild_info [+(.(fromline))+] not compiling application module for [+base+] [+flavor+] fi [+ENDFOR flavor+] [+ENDFOR melt_application_file+] ## meltbuild_do_applications [+base+] [+(.(fromline))+] local meltappstamptemp=$melt_final_application_stamp-tmp$$ echo "///MELT application time stamp $melt_final_application_stamp" > $meltappstamptemp echo $GCCMELT_RUNTIME_DEPENDENCY_MD5SUM $GCCMELT_RUNTIME_DEPENDENCY >> $meltappstamptemp [+FOR melt_application_file+] $MD5SUM meltbuild-sources/[+base+].melt >> $meltappstamptemp $MD5SUM meltbuild-sources/[+base+].c meltbuild-sources/[+base+]+[0-9][0-9].c >> $meltappstamptemp [+FOR flavor IN quicklybuilt optimized debugnoline+] $MD5SUM meltbuild-modules/[+base+].meltmod-$meltapp_[+varsuf+]_cumulmd5.[+flavor+].so >> $meltappstamptemp [+ENDFOR flavor+] [+ENDFOR melt_application_file+] echo "///end stamp $melt_final_application_stamp" >> $meltappstamptemp $GCCMELT_MOVE_IF_CHANGE $meltappstamptemp $melt_final_application_stamp meltbuild_info [+(.(fromline))+] times after applications at `date '+%x %H:%M:%S'`: ; times > /dev/stderr } ## end meltbuild_do_applications [+(.(fromline))+] if [ ! -f "$melt_final_application_stamp" \ -o "$melt_final_application_stamp" -ot "$melt_final_translator_stamp" \ [+FOR melt_application_file+] -o "$melt_final_application_stamp" -ot "$GCCMELT_MELTSOURCEDIR/[+base+].melt" \ [+ENDFOR melt_application_file+] ]; then meltbuild_info [+(.(fromline))+] building MELT applications meltbuild_do_applications else meltbuild_info [+(.(fromline))+] not building MELT applications because of applstamp "$melt_final_application_stamp" fi ################################################################ #@ [+(.(fromline))+] if [ "$melt_overall_goal" = "applications" ]; then meltbuild_info [+(.(fromline))+] done applications overall goal with stamp $melt_final_translator_stamp meltbuild_notice 'Done applications' [+(.(fromline))+] applications overall goal exit 0 fi ################################################################ ################################################################ ### the modules lists [+ (. (fromline))+] [+FOR flavor in quicklybuilt optimized debugnoline+] if [ ! -f "meltbuild-sources/$MELTGCCBUILTIN_DEFAULT_MODLIS.[+flavor+].modlis" \ -o "meltbuild-sources/$MELTGCCBUILTIN_DEFAULT_MODLIS.[+flavor+].modlis" -ot $melt_final_translator_stamp \ -o "meltbuild-sources/$MELTGCCBUILTIN_DEFAULT_MODLIS.[+flavor+].modlis" -ot $melt_final_application_stamp ]; then # [+ (. (fromline))+] module list [+flavor+] meltbuild_info [+(.(fromline))+] generating module list "meltbuild-sources/$MELTGCCBUILTIN_DEFAULT_MODLIS.[+flavor+].modlis" melt_modlis_temp="meltbuild-sources/$MELTGCCBUILTIN_DEFAULT_MODLIS.[+flavor+].modlis-tmp$$" echo "# MELT module list file $MELTGCCBUILTIN_DEFAULT_MODLIS.[+flavor+].modlis" >> $melt_modlis_temp echo "# MELT translator modules:" >> $melt_modlis_temp [+FOR melt_translator_file+] echo [+base+].[+flavor+] >> $melt_modlis_temp [+ENDFOR melt_translator_file+] #@ [+ (. (fromline))+] echo "# MELT application modules:" >> $melt_modlis_temp [+FOR melt_application_file+] echo [+base+].[+flavor+] >> $melt_modlis_temp [+ENDFOR melt_application_file+] $GCCMELT_MOVE_IF_CHANGE $melt_modlis_temp "meltbuild-sources/$MELTGCCBUILTIN_DEFAULT_MODLIS.[+flavor+].modlis" # [+ (. (fromline))+] warmelt module list [+flavor+] melt_modlis_temp="meltbuild-sources/warmelt.[+flavor+].modlis-tmp$$" echo "# MELT translator modules:" >> $melt_modlis_temp [+FOR melt_translator_file+] echo [+base+].[+flavor+] >> $melt_modlis_temp [+ENDFOR melt_translator_file+] $GCCMELT_MOVE_IF_CHANGE $melt_modlis_temp "meltbuild-sources/warmelt.[+flavor+].modlis" else meltbuild_info [+(.(fromline))+] keeping module list "meltbuild-sources/$MELTGCCBUILTIN_DEFAULT_MODLIS.[+flavor+].modlis" fi [+ENDFOR flavor+] #@ [+ (. (fromline))+] if [ ! -f "meltbuild-sources/$MELTGCCBUILTIN_DEFAULT_MODLIS.modlis" ]; then meltbuild_symlink "meltbuild-sources/$MELTGCCBUILTIN_DEFAULT_MODLIS.optimized.modlis" "meltbuild-sources/$MELTGCCBUILTIN_DEFAULT_MODLIS.modlis" fi ################################################################ #@ [+(.(fromline))+] module lists if [ "$melt_overall_goal" = "modlists" ]; then meltbuild_info [+(.(fromline))+] done modlists overall goal with stamp $melt_final_application_stamp exit 0 fi ################################################################ #@ [+(.(fromline))+] runtime self check ## [+(.(fromline))+] FIXME: should skip that when cross-compiler MELT plugin.. meltcheckruntime_stamp=meltbuild-checkruntime.stamp if [ ! -f $meltcheckruntime_stamp -o $meltcheckruntime_stamp -ot "$GCCMELT_RUNTIME_ARGS" \ -o $meltcheckruntime_stamp -ot "$GCCMELT_RUNTIME_C" \ -o $meltcheckruntime_stamp -ot $melt_final_application_stamp ]; then #@ [+(.(fromline))+] checkruntime if [ -f melt-no-check-runtime -o -n "$MELTGCC_NO_CHECK_RUNTIME" -o ! -f melt-runtime.i ]; then meltbuild_info [+(.(fromline))+] skipping check of MELT runtime else meltcheckruntime_args=meltbuild-checkruntime.args meltcheckruntime_argstemp=$meltcheckruntime_args-tmp$$ echo ' -DGCCMELT_FROM_ARG="[+(.(fromline))+]"' > $meltcheckruntime_argstemp meltbuild_arg mode=meltframe >> $meltcheckruntime_argstemp meltbuild_arg workdir=meltbuild-workdir >> $meltcheckruntime_argstemp meltbuild_arg tempdir=meltbuild-tempdir >> $meltcheckruntime_argstemp meltbuild_arg source-path=meltbuild-sources >> $meltcheckruntime_argstemp meltbuild_arg module-path=meltbuild-modules >> $meltcheckruntime_argstemp meltbuild_arg "module-cflags=\"$GCCMELT_COMPILER_FLAGS\"" >> $meltcheckruntime_argstemp meltbuild_arg bootstrapping >> $meltcheckruntime_argstemp echo ' -o /dev/null' >> $meltcheckruntime_argstemp echo melt-runtime.i >> $meltcheckruntime_argstemp $GCCMELT_MOVE_IF_CHANGE $meltcheckruntime_argstemp $meltcheckruntime_args [ -f "$meltcheckruntime_args" ] || meltbuild_error [+(.(fromline))+] missing check runtime args "$meltcheckruntime_args" meltbuild_info [+(.(fromline))+] $meltcheckruntime_args is cat $meltcheckruntime_args < /dev/null > /dev/stderr if [ -n "$MELTGCCBUILTIN_BUILD_WITH_CXX" ]; then $GCCMELT_CC1_PREFIX $GCCMELT_CC1PLUS @$meltcheckruntime_args \ || meltbuild_error [+(.(fromline))+] failed $GCCMELT_CC1PLUS with arguments @$meltcheckruntime_args else $GCCMELT_CC1_PREFIX $GCCMELT_CC1 @$meltcheckruntime_args \ || meltbuild_error [+(.(fromline))+] failed $GCCMELT_CC1 with arguments @$meltcheckruntime_args fi meltbuild_info [+(.(fromline))+] done check runtime with $meltcheckruntime_args fi #@ [+(.(fromline))+] checkhello meltcheckhelloworld_args=meltbuild-checkhelloworld.args meltcheckhelloworld_argstemp=$meltcheckhelloworld_args-tmp$$ echo ' -DGCCMELT_FROM_ARG="[+(.(fromline))+]"' > $meltcheckhelloworld_argstemp meltbuild_arg mode=runfile >> $meltcheckhelloworld_argstemp meltbuild_arg workdir=meltbuild-workdir >> $meltcheckhelloworld_argstemp meltbuild_arg module-makefile=$GCCMELT_MODULE_MK >> $meltcheckhelloworld_argstemp meltbuild_arg tempdir=meltbuild-tempdir >> $meltcheckhelloworld_argstemp meltbuild_arg source-path=meltbuild-sources >> $meltcheckhelloworld_argstemp meltbuild_arg module-path=meltbuild-modules >> $meltcheckhelloworld_argstemp meltbuild_arg "module-cflags=\"$GCCMELT_COMPILER_FLAGS\"" >> $meltcheckhelloworld_argstemp date +'(code_chunk hello%j #{puts("hello world from MELT %F @" __TIME__"\n")}#)' > meltbuild-hello.melt-tmp$$ $GCCMELT_MOVE_IF_CHANGE meltbuild-hello.melt-tmp$$ meltbuild-hello.melt meltbuild_arg arg=meltbuild-hello.melt >> $meltcheckhelloworld_argstemp echo ' meltbuild-empty-file.c -o /dev/null' >> $meltcheckhelloworld_argstemp cat $GCCMELT_HELLOWORLD_ARGS < /dev/null >> $meltcheckhelloworld_argstemp $GCCMELT_MOVE_IF_CHANGE $meltcheckhelloworld_argstemp $meltcheckhelloworld_args [ -f "$meltcheckhelloworld_args" ] || meltbuild_error [+(.(fromline))+] missing check helloworld args "$meltcheckhelloworld_args" meltbuild_info [+(.(fromline))+] $meltcheckhelloworld_args is cat $meltcheckhelloworld_args < /dev/null > /dev/stderr $GCCMELT_CC1_PREFIX $GCCMELT_CC1 @$meltcheckhelloworld_args \ || meltbuild_error [+(.(fromline))+] running helloworld failed with arguments @$meltcheckhelloworld_args meltbuild_info [+(.(fromline))+] done check helloworld with $meltcheckhelloworld_args #@ [+(.(fromline))+] runtime stamp meltcheckruntime_stamptemp=$meltcheckruntime_stamp-tmp$$ [ -f "$GCCMELT_RUNTIME_C" ] || meltbuild_error [+(.(fromline))+] missing MELT runtime C file $GCCMELT_RUNTIME_C echo "/// MELT check runtime timestamp file $meltcheckruntime_stamp" > $meltcheckruntime_stamptemp echo $GCCMELT_RUNTIME_DEPENDENCY_MD5SUM $GCCMELT_RUNTIME_DEPENDENCY >> $meltcheckruntime_stamptemp $MD5SUM $GCCMELT_RUNTIME_C < /dev/null >> $meltcheckruntime_stamptemp $MD5SUM meltbuild-hello.melt < /dev/null >> $meltcheckruntime_stamptemp [ -f "$melt_final_translator_stamp" ] || meltbuild_error [+(.(fromline))+] missing final translator stamp "$melt_final_translator_stamp" [ -f "$melt_final_application_stamp" ] || meltbuild_error [+(.(fromline))+] missing final application stamp "$melt_final_application_stamp" grep meltbuild-modules/ "$melt_final_translator_stamp" "$melt_final_application_stamp" < /dev/null >> $meltcheckruntime_stamptemp echo "///end timestamp file $meltcheckruntime_stamp" >> $meltcheckruntime_stamptemp $GCCMELT_MOVE_IF_CHANGE $meltcheckruntime_stamptemp $meltcheckruntime_stamp meltbuild_info [+(.(fromline))+] done check runtime $meltcheckruntime_stamp else meltbuild_info [+(.(fromline))+] keeping runtime checks $meltcheckruntime_stamp fi if [ "$melt_overall_goal" = "checkruntime" ]; then meltbuild_info [+(.(fromline))+] done checkruntime overall goal with stamp $meltcheckruntime_stamp exit 0 fi ################################################################ ################################################################ #@ [+(.(fromline))+] if [ "$melt_overall_goal" = "regenerate" ]; then meltbuild_notice regenerating runtime support [+(.(fromline))+] [ -d meltbuild-sources/generated ] || mkdir meltbuild-sources/generated meltregen_args=meltbuild-regen.args meltregen_argstemp="$meltregen_args-tmp$$" echo ' -DGCCMELT_FROM_ARG="[+(.(fromline))+]"' > $meltregen_argstemp meltbuild_arg mode=runtypesupport >> $meltregen_argstemp meltbuild_arg output=meltbuild-sources/generated/meltrunsup >> $meltregen_argstemp meltbuild_arg workdir=meltbuild-workdir >> $meltregen_argstemp meltbuild_arg tempdir=meltbuild-tempdir >> $meltregen_argstemp meltbuild_arg source-path=meltbuild-sources >> $meltregen_argstemp meltbuild_arg module-path=meltbuild-modules >> $meltregen_argstemp meltbuild_arg bootstrapping >> $meltregen_argstemp echo meltbuild-empty-file.c >> $meltregen_argstemp $GCCMELT_MOVE_IF_CHANGE $meltregen_argstemp $meltregen_args meltbuild_info [+(.(fromline))+] $meltregen_args is cat $meltregen_args < /dev/null > /dev/stderr $GCCMELT_CC1_PREFIX $GCCMELT_CC1 @$meltregen_args \ || meltbuild_error [+(.(fromline))+] failed with arguments @$meltregen_args meltbuild_info [+(.(fromline))+] done regenerate overall goal exit 0 fi ################################################################ ### the generated documentation meltgendoc.texi [+ (. (fromline))+] if [ ! -f meltgendoc.texi [+FOR melt_translator_file " \\\n"+] -o meltbuild-sources/[+base+].melt -nt meltgendoc.texi [+ENDFOR melt_translator_file+] \ [+FOR melt_application_file " \\\n"+] -o meltbuild-sources/[+base+].melt -nt meltgendoc.texi [+ENDFOR melt_application_file+] ]; then meltbuild_info [+(.(fromline))+] generating meltgendoc.texi meltgen_args=meltbuild-gendoc.args-tmp$$ echo ' -DGCCMELT_FROM_ARG="[+(.(fromline))+]"' > $meltgen_args meltbuild_arg mode=makedoc >> $meltgen_args meltbuild_arg output=meltgendoc.texi >> $meltgen_args meltbuild_arg init=@$MELTGCCBUILTIN_DEFAULT_MODLIS.quicklybuilt >> $meltgen_args meltbuild_arg workdir=meltbuild-workdir >> $meltgen_args meltbuild_arg tempdir=meltbuild-tempdir >> $meltgen_args meltbuild_arg source-path=meltbuild-sources >> $meltgen_args meltbuild_arg module-path=meltbuild-modules >> $meltgen_args meltbuild_arg bootstrapping >> $meltgen_args meltbuild_arg arglist=[+FOR melt_translator_file ","+][+base+].melt[+ENDFOR melt_translator_file+],[+FOR melt_application_file ","+][+base+].melt[+ENDFOR melt_application_file+] >> $meltgen_args echo meltbuild-empty-file.c >> $meltgen_args $GCCMELT_MOVE_IF_CHANGE $meltgen_args meltbuild-gendoc.args meltbuild_info [+(.(fromline))+] meltbuild-gendoc.args is cat meltbuild-gendoc.args < /dev/null > /dev/stderr $GCCMELT_CC1_PREFIX $GCCMELT_CC1 @meltbuild-gendoc.args \ || meltbuild_error [+(.(fromline))+] failed with arguments @meltbuild-gendoc.args else meltbuild_info [+(.(fromline))+] keeping meltgendoc.texi fi ################ meltbuild_info [+(.(fromline))+] successfully done with times at `date '+%x %H:%M:%S'`: ; times > /dev/stderr ################################################################ #@ [+(.(fromline))+] if [ "$melt_overall_goal" = "gendoc" ]; then meltbuild_info [+(.(fromline))+] done gendoc overall goal with stamp $melt_final_translator_stamp exit 0 fi ## #@ [+(.(fromline))+] if we get here something is wrong in this script meltbuild_error [+(.(fromline))+] unexpected MELT overall goal "$melt_overall_goal" buggy melt-build-script.tpl #@ eof [+(.(fromline))+] end of generated melt-build-script.sh