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 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: m4-ccas --m4=M4 CC ... file.asm ...
36 # Process file.asm with the given M4 plus any -D arguments, then
37 # assemble with the given CC plus all arguments.
39 # The M4 command must be in a single --m4= argument, and will be split
40 # on whitespace. When CC is invoked file.asm is replaced with a
41 # temporary .s file which is the M4 output.
43 # To allow parallel builds, the temp file name is based on the .asm
44 # file name, which will be the output object filename for all uses we
56 M4
=`echo "$i" | sed 's/^--m4=//'`
63 if test -n "$ASM"; then
64 echo "Only one .asm file permitted"
67 BASENAME
=`echo "$i" | sed -e 's/\.asm$//' -e 's/^.*[\\/:]//'`
82 if test -z "$M4"; then
83 echo "No --m4 specified"
87 if test -z "$ASM"; then
88 echo "No .asm specified"
92 # Libtool adds it's own -o when sending output to .libs/foo.o, but not
93 # when just wanting foo.o in the current directory. We need an
94 # explicit -o in both cases since we're assembling tmp-foo.s.
96 if test $SEEN_O = no
; then
97 CC
="$CC -o $BASENAME.o"
100 echo "$M4 $DEFS $ASM >$TMP"
101 $M4 $DEFS $ASM >$TMP ||
exit
106 # Comment this out to preserve .s intermediates