3 # A helper script for Makeasm.am .asm.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: m4-ccas --m4=M4 CC ... file.asm ...
25 # Process file.asm with the given M4 plus any -D arguments, then
26 # assemble with the given CC plus all arguments.
28 # The M4 command must be in a single --m4= argument, and will be split
29 # on whitespace. When CC is invoked file.asm is replaced with a
30 # temporary .s file which is the M4 output.
32 # To allow parallel builds, the temp file name is based on the .asm
33 # file name, which will be the output object filename for all uses we
45 M4=`echo "$i" | sed 's/^--m4=//'`
52 if test -n "$ASM"; then
53 echo "Only one .asm file permitted"
56 BASENAME=`echo "$i" | sed -e 's/\.asm$//' -e 's/^.*[\\/:]//'`
71 if test -z "$M4"; then
72 echo "No --m4 specified"
76 if test -z "$ASM"; then
77 echo "No .asm specified"
81 # Libtool adds it's own -o when sending output to .libs/foo.o, but not
82 # when just wanting foo.o in the current directory. We need an
83 # explicit -o in both cases since we're assembling tmp-foo.s.
85 if test $SEEN_O = no; then
86 CC="$CC -o $BASENAME.o"
89 echo "$M4 $DEFS $ASM >$TMP"
90 $M4 $DEFS $ASM >$TMP || exit
95 # Comment this out to preserve .s intermediates