10 sed -e '/^[ \t]*$/d' -e '/^[ \t]*#/d' -e '/*/d' $1 > $2
14 sed -n 's,^[ \t]*#include ,,p' $1 |
17 echo $outfile: $inc >> $outfile.makefrag
18 echo $inc: >> $outfile.makefrag
22 sed -n '/*/p' $1 |
grep -v '#' |
24 # quick syntax to exclude files:
25 # ../../../MyDir/*.cs:FileToExclude1.cs,FileToExclude2.cs
26 wc=`echo $wildc | cut -d \: -f 1` # ../../../MyDir/*.cs
27 qexc
=`echo $wildc | cut -d \: -f 2` # FileToExclude1.cs,FileToExclude2.cs
29 if test "$wc" = "$qexc"; then
30 # no quick excludes - just expand the wildcard
33 wcdir
=`echo $wildc | cut -d \* -f 1` # ../../../MyDir/
34 # Enumerate files from 'FileToExclude1.cs,FileToExclude2.cs'
35 # and save to $outfile.exc
39 echo "$wcdir$i" >> $outfile.exc
49 i
=$1; o
=$2; t
=${2}.tmp
50 while process_includes_1
$i $o; do
59 if ! test -f "$file"; then return; fi
60 if ! test -z "$(tail -c 1 "$file")"; then echo "$file: missing newline at end of file."; exit 1; fi
63 check_newline_eof
$incfile
64 check_newline_eof
$excfile
65 check_newline_eof
$extfile
66 check_newline_eof
$extexcfile
68 rm -f $outfile.makefrag
70 process_includes
$incfile $outfile.inc
72 if test x
$extfile != x
-a -f "$extfile"; then
73 process_includes
$extfile $outfile.ext.inc
74 cat $outfile.ext.inc
>> $outfile.inc
75 rm -f $outfile.ext.inc
78 sort -u $outfile.inc
> $outfile.inc_s
82 if test -n "$excfile" -a -f "$excfile"; then
83 process_includes
$excfile $outfile.exc
86 if test -n "$extexcfile"; then
87 process_includes
$extexcfile $outfile.ext_exc
88 cat $outfile.ext_exc
>> $outfile.exc
89 rm -f $outfile.ext_exc
92 if test -f $outfile.exc
; then
93 # So what we're doing below with uniq -u is that we take
94 # lines that have not been duplicated. This computes the
95 # symmetric difference between the files. This is not
96 # what we want. If a file is in the excludes but not in
97 # the sources, we want that file not to show up. By duplicating the
98 # excludes, we ensure that we won't end up in this failure state.
99 sort -u $outfile.exc
> $outfile.exc_s
102 cat $outfile.exc_s
>> $outfile.exc_s_dup
103 cat $outfile.exc_s
>> $outfile.exc_s_dup
105 rm -f $outfile.exc
$outfile.exc_s
107 cat $outfile.inc_s
$outfile.exc_s_dup |
sort |
uniq -u > $outfile
108 rm -f $outfile.inc_s
$outfile.exc_s_dup
110 mv $outfile.inc_s
$outfile