3 # A helper script for Makeasm.am .S.lo rule.
5 # Copyright 2001 Free Software Foundation, Inc.
7 # This file is part of the GNU MP Library.
9 # The GNU MP Library is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU Lesser General Public License as published by
11 # the Free Software Foundation; either version 3 of the License, or (at your
12 # option) any later version.
14 # The GNU MP Library is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17 # License for more details.
19 # You should have received a copy of the GNU Lesser General Public License
20 # along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
23 # Usage: cpp-cc --cpp=CPP CC ... file.S ...
25 # Process file.S with the given CPP command plus any -D options in the
26 # rest of the arguments, then assemble with the given CC plus all
29 # The CPP command must be in a single --cpp= argument, and will be
30 # split on whitespace. It should include -I options required.
32 # When CC is invoked, file.S is replaced with a temporary .s file
33 # which is the CPP output.
35 # Any lines starting with "#" are removed from the CPP output, usually
36 # these will be #line and #file markers from CPP, but they might also
37 # be comments from the .S.
39 # To allow parallel builds, the temp file name is based on the .S file
40 # name, which will be the output object filename for all uses we put
52 CPP=`echo "$i" | sed 's/^--cpp=//'`
60 echo "Only one .S file permitted"
63 BASENAME=`echo "$i" | sed -e 's/\.S$//' -e 's/^.*[\\/:]//'`
79 if test -z "$CPP"; then
80 echo "No --cpp specified"
85 echo "No .S specified"
89 # Libtool adds it's own -o when sending output to .libs/foo.o, but not
90 # when just wanting foo.o in the current directory. We need an
91 # explicit -o in both cases since we're assembling tmp-foo.s.
93 if test $SEEN_O = no; then
94 CC="$CC -o $BASENAME.o"
97 echo "$CPP $CPPDEFS $S >$TMP_I"
98 $CPP $CPPDEFS $S >$TMP_I || exit
100 echo "grep -v '^#' $TMP_I >$TMP_S"
101 grep -v '^#' $TMP_I >$TMP_S
106 # Comment this out to preserve .s intermediates