libguile/Makefile.am (snarfcppopts): Remove CFLAGS
[bpt/guile.git] / libguile / guile-snarf-docs.in
1 #!/bin/sh
2 # guile-snarf-docs --- Extract the doc stuff for builtin things.
3 ##
4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001,
5 # 2006, 2010 Free Software Foundation, Inc.
6 #
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU Lesser General Public License as
9 # published by the Free Software Foundation; either version 3, or (at
10 # your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # Lesser General Public License for more details.
16 #
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this software; see the file COPYING.LESSER. If
19 # not, write to the Free Software Foundation, Inc., 51 Franklin
20 # Street, Fifth Floor, Boston, MA 02110-1301 USA
21 ##
22 # Usage: guile-snarf-docs -o DOC SRC -- [CPPSNARFOPTS...]
23 ##
24
25 filter='./guile_filter_doc_snarfage@EXEEXT@'
26
27 ## Let the user override the preprocessor autoconf found.
28 test -n "${CPP+set}" || CPP="@CPP@"
29
30 ## Likewise for AWK.
31 test -n "${AWK+set}" || AWK="@AWK@"
32
33 bummer ()
34 {
35 echo 'Bad command-line' $1
36 exit 1
37 }
38
39 test "x$1" = x-o || bummer
40 shift
41
42 test "x$1" = x && bummer ': missing DOC'
43 output="$1"
44 temout="$output"T
45 shift
46
47 test "x$1" && test -r "$1" || bummer ': missing SRC'
48 input="$1"
49 shift
50
51 test "x$1" = x-- || bummer
52 shift
53
54 # Before snarfing, do the function name check.
55 ${AWK} -f '@srcdir@/guile-func-name-check' "$input" || exit 1
56
57 # Snarfing takes two steps: cpp and tokenization.
58 # If cpp fails, don't bother with tokenization.
59 if ${CPP} -DSCM_MAGIC_SNARF_DOCS "$@" "$input" > "$temout" ; then
60 $filter --filter-snarfage < "$temout" > "$output"
61 rv=0
62 else
63 rv=1
64 fi
65 rm -f "$temout"
66 exit $rv
67
68 # guile-snarf-docs ends here