beta-0.89.2
[luatex.git] / source / libs / gmp / gmp-src / mpn / m4-ccas
blob16d80c6f51bdba6ee1c0500eb6c78243feca21ab
1 #!/bin/sh
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.
16 # or
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
20 # later version.
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
27 # for more details.
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
45 # put this script to.
47 M4=
48 CC=
49 DEFS=
50 ASM=
51 SEEN_O=no
53 for i in "$@"; do
54 case $i in
55 --m4=*)
56 M4=`echo "$i" | sed 's/^--m4=//'`
58 -D*)
59 DEFS="$DEFS $i"
60 CC="$CC $i"
62 *.asm)
63 if test -n "$ASM"; then
64 echo "Only one .asm file permitted"
65 exit 1
67 BASENAME=`echo "$i" | sed -e 's/\.asm$//' -e 's/^.*[\\/:]//'`
68 TMP=tmp-$BASENAME.s
69 ASM=$i
70 CC="$CC $TMP"
72 -o)
73 SEEN_O=yes
74 CC="$CC $i"
77 CC="$CC $i"
79 esac
80 done
82 if test -z "$M4"; then
83 echo "No --m4 specified"
84 exit 1
87 if test -z "$ASM"; then
88 echo "No .asm specified"
89 exit 1
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
103 echo "$CC"
104 $CC || exit
106 # Comment this out to preserve .s intermediates
107 rm -f $TMP