X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=opcodes%2Fcgen.sh;h=f65fcd489a5268c99a20164f46bd2b6d2047b8b7;hb=84c7196942dfedcaead5f5b93ac8bed25e5b035d;hp=5a340b6e527f0a2c1693c9da38520a6645985ace;hpb=9c2de72926b9239c771c4f9c6169e1bac3e576ce;p=deliverable%2Fbinutils-gdb.git diff --git a/opcodes/cgen.sh b/opcodes/cgen.sh index 5a340b6e52..f65fcd489a 100644 --- a/opcodes/cgen.sh +++ b/opcodes/cgen.sh @@ -1,23 +1,23 @@ #! /bin/sh # CGEN generic assembler support code. # -# Copyright 2001 Free Software Foundation, Inc. +# Copyright 2000, 2003, 2005, 2007, 2009 Free Software Foundation, Inc. # -# This file is part of the GNU Binutils and GDB, the GNU debugger. +# This file is part of the GNU opcodes library. # -# This program is free software; you can redistribute it and/or modify +# This library is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) +# the Free Software Foundation; either version 3, or (at your option) # any later version. # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# It is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +# License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +# 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ # # Generate CGEN opcode files: arch-desc.[ch], arch-opc.[ch], # arch-asm.c, arch-dis.c, arch-opinst.c, arch-ibld.[ch]. @@ -47,7 +47,7 @@ set -e action=$1 srcdir=$2 -cgen=$3 +cgen="$3" cgendir=$4 cgenflags=$5 arch=$6 @@ -70,89 +70,92 @@ lowercase='abcdefghijklmnopqrstuvwxyz' uppercase='ABCDEFGHIJKLMNOPQRSTUVWXYZ' ARCH=`echo ${arch} | tr "${lowercase}" "${uppercase}"` +# Allow parallel makes to run multiple cgen's without colliding. +tmp=tmp-$$ + extrafile_args="" for ef in .. $extrafiles do case $ef in ..) ;; - opinst) extrafile_args="-Q tmp-opinst.c1 $extrafile_args" ;; + opinst) extrafile_args="-Q ${tmp}-opinst.c1 $extrafile_args" ;; esac done case $action in opcodes) # Remove residual working files. - rm -f tmp-desc.h tmp-desc.h1 - rm -f tmp-desc.c tmp-desc.c1 - rm -f tmp-opc.h tmp-opc.h1 - rm -f tmp-opc.c tmp-opc.c1 - rm -f tmp-opinst.c tmp-opinst.c1 - rm -f tmp-ibld.h tmp-ibld.h1 - rm -f tmp-ibld.c tmp-ibld.in1 - rm -f tmp-asm.c tmp-asm.in1 - rm -f tmp-dis.c tmp-dis.in1 + rm -f ${tmp}-desc.h ${tmp}-desc.h1 + rm -f ${tmp}-desc.c ${tmp}-desc.c1 + rm -f ${tmp}-opc.h ${tmp}-opc.h1 + rm -f ${tmp}-opc.c ${tmp}-opc.c1 + rm -f ${tmp}-opinst.c ${tmp}-opinst.c1 + rm -f ${tmp}-ibld.h ${tmp}-ibld.h1 + rm -f ${tmp}-ibld.c ${tmp}-ibld.in1 + rm -f ${tmp}-asm.c ${tmp}-asm.in1 + rm -f ${tmp}-dis.c ${tmp}-dis.in1 # Run CGEN. - ${cgen} -s ${cgendir}/cgen-opc.scm \ + ${cgen} ${cgendir}/cgen-opc.scm \ -s ${cgendir} \ ${cgenflags} \ -f "${options}" \ -m all \ -a ${archfile} \ -OPC ${opcfile} \ - -H tmp-desc.h1 \ - -C tmp-desc.c1 \ - -O tmp-opc.h1 \ - -P tmp-opc.c1 \ - -L tmp-ibld.in1 \ - -A tmp-asm.in1 \ - -D tmp-dis.in1 \ + -H ${tmp}-desc.h1 \ + -C ${tmp}-desc.c1 \ + -O ${tmp}-opc.h1 \ + -P ${tmp}-opc.c1 \ + -L ${tmp}-ibld.in1 \ + -A ${tmp}-asm.in1 \ + -D ${tmp}-dis.in1 \ ${extrafile_args} # Customise generated files for the particular architecture. - sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" < tmp-desc.h1 > tmp-desc.h - ${rootdir}/move-if-change tmp-desc.h ${srcdir}/${prefix}-desc.h + sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" < ${tmp}-desc.h1 > ${tmp}-desc.h + ${rootdir}/move-if-change ${tmp}-desc.h ${srcdir}/${prefix}-desc.h sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" \ - -e "s/@prefix@/${prefix}/" < tmp-desc.c1 > tmp-desc.c - ${rootdir}/move-if-change tmp-desc.c ${srcdir}/${prefix}-desc.c + -e "s/@prefix@/${prefix}/" < ${tmp}-desc.c1 > ${tmp}-desc.c + ${rootdir}/move-if-change ${tmp}-desc.c ${srcdir}/${prefix}-desc.c - sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" < tmp-opc.h1 > tmp-opc.h - ${rootdir}/move-if-change tmp-opc.h ${srcdir}/${prefix}-opc.h + sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" < ${tmp}-opc.h1 > ${tmp}-opc.h + ${rootdir}/move-if-change ${tmp}-opc.h ${srcdir}/${prefix}-opc.h sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" \ - -e "s/@prefix@/${prefix}/" < tmp-opc.c1 > tmp-opc.c - ${rootdir}/move-if-change tmp-opc.c ${srcdir}/${prefix}-opc.c + -e "s/@prefix@/${prefix}/" < ${tmp}-opc.c1 > ${tmp}-opc.c + ${rootdir}/move-if-change ${tmp}-opc.c ${srcdir}/${prefix}-opc.c case $extrafiles in *opinst*) sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" \ - -e "s/@prefix@/${prefix}/" < tmp-opinst.c1 >tmp-opinst.c - ${rootdir}/move-if-change tmp-opinst.c ${srcdir}/${prefix}-opinst.c + -e "s/@prefix@/${prefix}/" < ${tmp}-opinst.c1 >${tmp}-opinst.c + ${rootdir}/move-if-change ${tmp}-opinst.c ${srcdir}/${prefix}-opinst.c ;; esac - cat ${srcdir}/cgen-ibld.in tmp-ibld.in1 | \ + cat ${srcdir}/cgen-ibld.in ${tmp}-ibld.in1 | \ sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" \ - -e "s/@prefix@/${prefix}/" > tmp-ibld.c - ${rootdir}/move-if-change tmp-ibld.c ${srcdir}/${prefix}-ibld.c + -e "s/@prefix@/${prefix}/" > ${tmp}-ibld.c + ${rootdir}/move-if-change ${tmp}-ibld.c ${srcdir}/${prefix}-ibld.c - sed -e "/ -- assembler routines/ r tmp-asm.in1" ${srcdir}/cgen-asm.in \ + sed -e "/ -- assembler routines/ r ${tmp}-asm.in1" ${srcdir}/cgen-asm.in \ | sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" \ - -e "s/@prefix@/${prefix}/" > tmp-asm.c - ${rootdir}/move-if-change tmp-asm.c ${srcdir}/${prefix}-asm.c + -e "s/@prefix@/${prefix}/" > ${tmp}-asm.c + ${rootdir}/move-if-change ${tmp}-asm.c ${srcdir}/${prefix}-asm.c - sed -e "/ -- disassembler routines/ r tmp-dis.in1" ${srcdir}/cgen-dis.in \ + sed -e "/ -- disassembler routines/ r ${tmp}-dis.in1" ${srcdir}/cgen-dis.in \ | sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" \ - -e "s/@prefix@/${prefix}/" > tmp-dis.c - ${rootdir}/move-if-change tmp-dis.c ${srcdir}/${prefix}-dis.c + -e "s/@prefix@/${prefix}/" > ${tmp}-dis.c + ${rootdir}/move-if-change ${tmp}-dis.c ${srcdir}/${prefix}-dis.c # Remove temporary files. - rm -f tmp-desc.h1 tmp-desc.c1 - rm -f tmp-opc.h1 tmp-opc.c1 - rm -f tmp-opinst.c1 - rm -f tmp-ibld.h1 tmp-ibld.in1 - rm -f tmp-asm.in1 tmp-dis.in1 + rm -f ${tmp}-desc.h1 ${tmp}-desc.c1 + rm -f ${tmp}-opc.h1 ${tmp}-opc.c1 + rm -f ${tmp}-opinst.c1 + rm -f ${tmp}-ibld.h1 ${tmp}-ibld.in1 + rm -f ${tmp}-asm.in1 ${tmp}-dis.in1 ;; *)