* guile-snarf.awk.in: Tweak to work with Sun/HP awk, removed some
[bpt/guile.git] / libguile / guile-doc-snarf.in
CommitLineData
3dc81fba
GB
1#!/bin/sh
2# Extract the initialization actions for builtin things.
3
dd3c73d2 4fullfilename=$1; shift
3dc81fba 5
aff882a8 6# strip path to source directory
dd3c73d2 7filename=`basename $fullfilename`
aff882a8 8
3dc81fba
GB
9# we need to be sure that the .x file exists
10# since the .c/.cc file may include it
11# (the old guile-snarf did not have this problem
12# because the makefile redirects output to the .x file
13# which creates the file before the inclusion occurs)
14# --12/12/99 gjb
11a5232f
GB
15no_ext=`echo $filename | /bin/sed 's/\.[^.]*$//g'`
16dot_doc=${no_ext}.doc
3dc81fba
GB
17
18temp="/tmp/snarf.$$"
19trap "rm -f $temp" 0 1 2 15
20
11a5232f 21## Let the user override the preprocessor & awk autoconf found.
3dc81fba 22test -n "${CPP+set}" || CPP="@CPP@"
11a5232f 23test -n "${AWK+set}" || AWK="@AWK@"
3dc81fba 24
0f981281 25## Must run guile-func-name-check on the unpreprocessed source
dd3c73d2 26guile-func-name-check "$fullfilename"
0f981281 27
3dc81fba
GB
28## We must use a temporary file here, instead of a pipe, because we
29## need to know if CPP exits with a non-zero status.
30${CPP} -DSCM_MAGIC_SNARFER "$@" > ${temp} || exit $?
11a5232f 31< ${temp} ${AWK} -f `dirname $0`/guile-snarf.awk `basename ${dot_doc}`