[BACK]Return to cpp-ccas CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / gmp / mpn

Annotation of OpenXM_contrib/gmp/mpn/cpp-ccas, Revision 1.1.1.1

1.1       ohara       1: #!/bin/sh
                      2: #
                      3: # A helper script for Makeasm.am .S.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: cpp-cc --cpp=CPP CC ... file.S ...
                     26: #
                     27: # Process file.S with the given CPP command plus any -D options in the
                     28: # rest of the arguments, then assemble with the given CC plus all
                     29: # arguments.
                     30: #
                     31: # The CPP command must be in a single --cpp= argument, and will be
                     32: # split on whitespace.  It should include -I options required.
                     33: #
                     34: # When CC is invoked, file.S is replaced with a temporary .s file
                     35: # which is the CPP output.
                     36: #
                     37: # Any lines starting with "#" are removed from the CPP output, usually
                     38: # these will be #line and #file markers from CPP, but they might also
                     39: # be comments from the .S.
                     40: #
                     41: # To allow parallel builds, the temp file name is based on the .S file
                     42: # name, which will be the output object filename for all uses we put
                     43: # this script to.
                     44:
                     45: CPP=
                     46: CPPDEFS=
                     47: CC=
                     48: S=
                     49: SEEN_O=no
                     50:
                     51: for i in "$@"; do
                     52:   case $i in
                     53:     --cpp=*)
                     54:       CPP=`echo "$i" | sed 's/^--cpp=//'`
                     55:       ;;
                     56:     -D*)
                     57:       CPPDEFS="$CPPDEFS $i"
                     58:       CC="$CC $i"
                     59:       ;;
                     60:     *.S)
                     61:       if test -n "$S"; then
                     62:         echo "Only one .S file permitted"
                     63:         exit 1
                     64:       fi
                     65:       BASENAME=`echo "$i" | sed -e 's/\.S$//' -e 's/^.*[\\/:]//'`
                     66:       S=$i
                     67:       TMP_I=tmp-$BASENAME.i
                     68:       TMP_S=tmp-$BASENAME.s
                     69:       CC="$CC $TMP_S"
                     70:       ;;
                     71:     -o)
                     72:       SEEN_O=yes
                     73:       CC="$CC $i"
                     74:       ;;
                     75:     *)
                     76:       CC="$CC $i"
                     77:       ;;
                     78:   esac
                     79: done
                     80:
                     81: if test -z "$CPP"; then
                     82:   echo "No --cpp specified"
                     83:   exit 1
                     84: fi
                     85:
                     86: if test -z "$S"; then
                     87:   echo "No .S specified"
                     88:   exit 1
                     89: fi
                     90:
                     91: # Libtool adds it's own -o when sending output to .libs/foo.o, but not
                     92: # when just wanting foo.o in the current directory.  We need an
                     93: # explicit -o in both cases since we're assembling tmp-foo.s.
                     94: #
                     95: if test $SEEN_O = no; then
                     96:   CC="$CC -o $BASENAME.o"
                     97: fi
                     98:
                     99: echo "$CPP $CPPDEFS $S >$TMP_I"
                    100: $CPP $CPPDEFS $S >$TMP_I || exit
                    101:
                    102: echo "grep -v '^#' $TMP_I >$TMP_S"
                    103: grep -v '^#' $TMP_I >$TMP_S
                    104:
                    105: echo "$CC"
                    106: $CC || exit
                    107:
                    108: # Comment this out to preserve .s intermediates
                    109: rm -f $TMP

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>