Properly initialize a rgctx template. Fixes bxc #1147.
[mono-project.git] / mcs / build / gensources.sh
blob61639e54a297cc6f7aa7b00bad3a9b00a026ed0f
1 #! /bin/sh
3 outfile=$1
4 incfile=$2
5 excfile=$3
7 process_includes_1() {
8 sed -e '/^[ \t]*$/d' -e '/^[ \t]*#/d' $1 > $2
9 if cmp -s $1 $2; then
10 false
11 else
12 sed -n 's,^[ \t]*#include ,,p' $1 |
13 while read inc; do
14 cat $inc >> $2
15 echo $outfile: $inc >> $outfile.makefrag
16 echo $inc: >> $outfile.makefrag
17 done
21 process_includes() {
22 i=$1; o=$2; t=${2}.tmp
23 while process_includes_1 $i $o; do
24 mv $o $t
25 i=$t
26 done
27 rm -f $t
30 rm -f $outfile.makefrag
32 process_includes $incfile $outfile.inc
34 sort -u $outfile.inc > $outfile.inc_s
35 rm -f $outfile.inc
37 if test -z "$excfile"; then
38 mv $outfile.inc_s $outfile
39 else
40 process_includes $excfile $outfile.exc
42 sort -u $outfile.exc > $outfile.exc_s
43 rm -f $outfile.exc
45 sort -m $outfile.inc_s $outfile.exc_s | uniq -u > $outfile
46 rm -f $outfile.inc_s $outfile.exc_s