Annotation of OpenXM_contrib/gmp/mpn/m4-ccas, Revision 1.1
1.1 ! ohara 1: #!/bin/sh
! 2: #
! 3: # A helper script for Makeasm.am .asm.lo rule.
! 4:
! 5: # Copyright 2001 Free Software Foundation, Inc.
! 6: #
! 7: # This file is part of the GNU MP Library.
! 8: #
! 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 2.1 of the License, or (at your
! 12: # option) any later version.
! 13: #
! 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.
! 18: #
! 19: # You should have received a copy of the GNU Lesser General Public License
! 20: # along with the GNU MP Library; see the file COPYING.LIB. If not, write to
! 21: # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
! 22: # MA 02111-1307, USA.
! 23:
! 24:
! 25: # Usage: m4-ccas --m4=M4 CC ... file.asm ...
! 26: #
! 27: # Process file.asm with the given M4 plus any -D arguments, then
! 28: # assemble with the given CC plus all arguments.
! 29: #
! 30: # The M4 command must be in a single --m4= argument, and will be split
! 31: # on whitespace. When CC is invoked file.asm is replaced with a
! 32: # temporary .s file which is the M4 output.
! 33: #
! 34: # To allow parallel builds, the temp file name is based on the .asm
! 35: # file name, which will be the output object filename for all uses we
! 36: # put this script to.
! 37:
! 38: M4=
! 39: CC=
! 40: DEFS=
! 41: ASM=
! 42: SEEN_O=no
! 43:
! 44: for i in "$@"; do
! 45: case $i in
! 46: --m4=*)
! 47: M4=`echo "$i" | sed 's/^--m4=//'`
! 48: ;;
! 49: -D*)
! 50: DEFS="$DEFS $i"
! 51: CC="$CC $i"
! 52: ;;
! 53: *.asm)
! 54: if test -n "$ASM"; then
! 55: echo "Only one .asm file permitted"
! 56: exit 1
! 57: fi
! 58: BASENAME=`echo "$i" | sed -e 's/\.asm$//' -e 's/^.*[\\/:]//'`
! 59: TMP=tmp-$BASENAME.s
! 60: ASM=$i
! 61: CC="$CC $TMP"
! 62: ;;
! 63: -o)
! 64: SEEN_O=yes
! 65: CC="$CC $i"
! 66: ;;
! 67: *)
! 68: CC="$CC $i"
! 69: ;;
! 70: esac
! 71: done
! 72:
! 73: if test -z "$M4"; then
! 74: echo "No --m4 specified"
! 75: exit 1
! 76: fi
! 77:
! 78: if test -z "$ASM"; then
! 79: echo "No .asm specified"
! 80: exit 1
! 81: fi
! 82:
! 83: # Libtool adds it's own -o when sending output to .libs/foo.o, but not
! 84: # when just wanting foo.o in the current directory. We need an
! 85: # explicit -o in both cases since we're assembling tmp-foo.s.
! 86: #
! 87: if test $SEEN_O = no; then
! 88: CC="$CC -o $BASENAME.o"
! 89: fi
! 90:
! 91: echo "$M4 $DEFS $ASM >$TMP"
! 92: $M4 $DEFS $ASM >$TMP || exit
! 93:
! 94: echo "$CC"
! 95: $CC || exit
! 96:
! 97: # Comment this out to preserve .s intermediates
! 98: rm -f $TMP
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>