1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-02 04:40:29 +02:00

Do not clean input file. This would write to the $(srcdir) during a

VPATH build, which is not allowed.  It also isn't needed since it only
works when an output filename has been specified and in that case we
don't need to clean the input file because the output file will
already exist.
This commit is contained in:
Marius Vollmer 2002-04-08 17:05:56 +00:00
parent f9a3a966e2
commit ef6b53ce6e

View file

@ -21,21 +21,22 @@
# Commentary: # Commentary:
# Usage: guile-snarf [-o OUTFILE] INFILE [CPP-OPTIONS ...] # Usage: guile-snarf [-o OUTFILE] INFILE [CPP-OPTIONS ...]
# #
# Process INFILE using the C pre-processor and some other programs. # Process INFILE using the C pre-processor and some other programs.
# Write output to a file named OUTFILE or to the standard output when no # Write output to a file named OUTFILE or to the standard output when no
# OUTFILE has been specified or when OUTFILE is "-". When writing # OUTFILE has been specified or when OUTFILE is "-".
# to a file, ignore lines from the input matching the following grep(1) #
# regular expression:
#
# ^#include ".*OUTFILE"
#
# If there are errors during processing, delete OUTFILE and exit with # If there are errors during processing, delete OUTFILE and exit with
# non-zero status. # non-zero status.
# #
# During snarfing, the pre-processor macro SCM_MAGIC_SNARFER is # During snarfing, the pre-processor macro SCM_MAGIC_SNARFER is
# defined. # defined. You can use this to avoid including snarfer output files
# # that don't yet exist by writing code like this:
#
# #ifndef SCM_MAGIC_SNARFER
# #include "foo.x"
# #endif
#
# If env var CPP is set, use its value instead of the C pre-processor # If env var CPP is set, use its value instead of the C pre-processor
# determined at Guile configure-time: "@CPP@". # determined at Guile configure-time: "@CPP@".
@ -77,15 +78,7 @@ if [ x"$CPP" = x ] ; then cpp="@CPP@" ; else cpp="$CPP" ; fi
trap "rm -f $temp" 0 1 2 15 trap "rm -f $temp" 0 1 2 15
if [ ! "$outfile" = "-" ] ; then if [ ! "$outfile" = "-" ] ; then
self_blind_regexp='^#include ".*'`basename $outfile`'"' modern_snarf "$@" $infile > $outfile
clean_infile=$infile.clean.c # temp file in same dir as infile
# so that #include "foo" works
# (e.g., see libguile/eval.c).
# use .c to satisfy cpp heuristics.
# clean input file
trap "rm -f $cleanfile" 0 1 2 15
grep -v "$self_blind_regexp" $infile > $clean_infile
modern_snarf "$@" $clean_infile > $outfile
else else
modern_snarf "$@" $infile modern_snarf "$@" $infile
fi fi