10 sed -e '/^[ \t]*$/d' -e '/^[ \t]*#/d' $1 > $2
14 sed -n 's,^[ \t]*#include ,,p' $1 |
17 echo $outfile: $inc >> $outfile.makefrag
18 echo $inc: >> $outfile.makefrag
24 i=$1; o=$2; t=${2}.tmp
25 while process_includes_1 $i $o; do
34 if ! test -f "$file"; then return; fi
35 if ! test -z "$(tail -c 1 "$file")"; then echo "$file: missing newline at end of file."; exit 1; fi
38 check_newline_eof $incfile
39 check_newline_eof $excfile
40 check_newline_eof $extfile
41 check_newline_eof $extexcfile
43 rm -f $outfile.makefrag
45 process_includes $incfile $outfile.inc
47 if test x$extfile != x -a -f "$extfile"; then
48 process_includes $extfile $outfile.ext.inc
49 cat $outfile.ext.inc >> $outfile.inc
50 rm -f $outfile.ext.inc
53 sort -u $outfile.inc > $outfile.inc_s
57 if test -n "$excfile" -a -f "$excfile"; then
58 process_includes $excfile $outfile.exc
61 if test -n "$extexcfile"; then
62 process_includes $extexcfile $outfile.ext_exc
63 cat $outfile.ext_exc >> $outfile.exc
64 rm -f $outfile.ext_exc
67 if test -f $outfile.exc; then
68 # So what we're doing below with uniq -u is that we take
69 # lines that have not been duplicated. This computes the
70 # symmetric difference between the files. This is not
71 # what we want. If a file is in the excludes but not in
72 # the sources, we want that file not to show up. By duplicating the
73 # excludes, we ensure that we won't end up in this failure state.
74 sort -u $outfile.exc > $outfile.exc_s
77 cat $outfile.exc_s >> $outfile.exc_s_dup
78 cat $outfile.exc_s >> $outfile.exc_s_dup
80 rm -f $outfile.exc $outfile.exc_s
82 cat $outfile.inc_s $outfile.exc_s_dup | sort | uniq -u > $outfile
83 rm -f $outfile.inc_s $outfile.exc_s_dup
85 mv $outfile.inc_s $outfile