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 either:
12 # * the GNU Lesser General Public License as published by the Free
13 # Software Foundation; either version 3 of the License, or (at your
14 # option) any later version.
18 # * the GNU General Public License as published by the Free Software
19 # Foundation; either version 2 of the License, or (at your option) any
22 # or both in parallel, as here.
24 # The GNU MP Library is distributed in the hope that it will be useful, but
25 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
26 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
29 # You should have received copies of the GNU General Public License and the
30 # GNU Lesser General Public License along with the GNU MP Library. If not,
31 # see https://www.gnu.org/licenses/.
34 # Usage: cpp-cc --cpp=CPP CC ... file.S ...
36 # Process file.S with the given CPP command plus any -D options in the
37 # rest of the arguments, then assemble with the given CC plus all
40 # The CPP command must be in a single --cpp= argument, and will be
41 # split on whitespace. It should include -I options required.
43 # When CC is invoked, file.S is replaced with a temporary .s file
44 # which is the CPP output.
46 # Any lines starting with "#" are removed from the CPP output, usually
47 # these will be #line and #file markers from CPP, but they might also
48 # be comments from the .S.
50 # To allow parallel builds, the temp file name is based on the .S file
51 # name, which will be the output object filename for all uses we put
63 CPP
=`echo "$i" | sed 's/^--cpp=//'`
71 echo "Only one .S file permitted"
74 BASENAME
=`echo "$i" | sed -e 's/\.S$//' -e 's/^.*[\\/:]//'`
90 if test -z "$CPP"; then
91 echo "No --cpp specified"
96 echo "No .S specified"
100 # Libtool adds it's own -o when sending output to .libs/foo.o, but not
101 # when just wanting foo.o in the current directory. We need an
102 # explicit -o in both cases since we're assembling tmp-foo.s.
104 if test $SEEN_O = no
; then
105 CC
="$CC -o $BASENAME.o"
108 echo "$CPP $CPPDEFS $S >$TMP_I"
109 $CPP $CPPDEFS $S >$TMP_I ||
exit
111 echo "grep -v '^#' $TMP_I >$TMP_S"
112 grep -v '^#' $TMP_I >$TMP_S
117 # Comment this out to preserve .s intermediates