X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fbuild%2Fgensources.sh;h=14a0a01db59d07b4503b9a5d1ae8882e25442524;hb=dfac8517b91687f11479801fa0a2191585b1ad4c;hp=816b8296f6cbb27cab3fef6e21df39208dc1158d;hpb=c99f71cd84ecaf1679d6293da19e04768cbed1f3;p=mono.git diff --git a/mcs/build/gensources.sh b/mcs/build/gensources.sh index 816b8296f6c..14a0a01db59 100644 --- a/mcs/build/gensources.sh +++ b/mcs/build/gensources.sh @@ -4,6 +4,7 @@ outfile=$1 incfile=$2 excfile=$3 extfile=$4 +extexcfile=$5 process_includes_1() { sed -e '/^[ \t]*$/d' -e '/^[ \t]*#/d' $1 > $2 @@ -32,23 +33,45 @@ rm -f $outfile.makefrag process_includes $incfile $outfile.inc -if test x$extfile != x -a -f $extfile; then - cat $extfile >> $outfile.inc +if test x$extfile != x -a -f "$extfile"; then + process_includes $extfile $outfile.ext.inc + cat $outfile.ext.inc >> $outfile.inc + rm -f $outfile.ext.inc fi sort -u $outfile.inc > $outfile.inc_s rm -f $outfile.inc -if test -z "$excfile"; then - mv $outfile.inc_s $outfile -else + +if test -n "$excfile" -a -f "$excfile"; then process_includes $excfile $outfile.exc +fi + +if test -n "$extexcfile"; then + process_includes $extexcfile $outfile.ext_exc + cat $outfile.ext_exc >> $outfile.exc + rm -f $outfile.ext_exc +fi + +if test -f $outfile.exc; then + # So what we're doing below with uniq -u is that we take + # lines that have not been duplicated. This computes the + # symmetric difference between the files. This is not + # what we want. If a file is in the excludes but not in + # the sources, we want that file not to show up. By duplicating the + # excludes, we ensure that we won't end up in this failure state. + sort -u $outfile.exc > $outfile.exc_s - sort -u $outfile.exc > $outfile.exc_s - rm -f $outfile.exc + # Duplicate excludes + cat $outfile.exc_s >> $outfile.exc_s_dup + cat $outfile.exc_s >> $outfile.exc_s_dup - sort -m $outfile.inc_s $outfile.exc_s | uniq -u > $outfile - rm -f $outfile.inc_s $outfile.exc_s + rm -f $outfile.exc $outfile.exc_s + + cat $outfile.inc_s $outfile.exc_s_dup | sort | uniq -u > $outfile + rm -f $outfile.inc_s $outfile.exc_s_dup +else + mv $outfile.inc_s $outfile fi