2002-04-07 02:47:10 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
#
|
|
|
|
|
# This source code is free software; you can redistribute it
|
|
|
|
|
# and/or modify it in source code form under the terms of the GNU
|
|
|
|
|
# Library General Public License as published by the Free Software
|
|
|
|
|
# Foundation; either version 2 of the License, 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 Library General Public License for more details.
|
|
|
|
|
#
|
|
|
|
|
# You should have received a copy of the GNU Library 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
|
|
|
|
|
#
|
2002-09-19 01:25:18 +02:00
|
|
|
#ident "$Id: iverilog-vpi.sh,v 1.7 2002/09/18 23:25:18 steve Exp $"
|
2002-04-07 02:47:10 +02:00
|
|
|
|
|
|
|
|
# These are the variables used for compiling files
|
|
|
|
|
CC=gcc
|
2002-05-10 05:54:46 +02:00
|
|
|
CXX=gcc
|
2002-07-04 01:20:12 +02:00
|
|
|
CFLAGS="@PIC@ -O -I@INCLUDEDIR@"
|
2002-04-07 02:47:10 +02:00
|
|
|
|
|
|
|
|
# These are used for linking...
|
|
|
|
|
LD=gcc
|
|
|
|
|
LDFLAGS="@SHARED@"
|
2002-07-04 01:20:12 +02:00
|
|
|
LDLIBS="-L@LIBDIR@ -lveriuser -lvpi"
|
2002-04-07 02:47:10 +02:00
|
|
|
|
2002-05-10 05:54:46 +02:00
|
|
|
CCSRC=
|
|
|
|
|
CXSRC=
|
2002-04-07 02:47:10 +02:00
|
|
|
OBJ=
|
|
|
|
|
LIB=
|
|
|
|
|
OUT=
|
|
|
|
|
|
|
|
|
|
# --
|
|
|
|
|
# parse the command line switches. This collects the source files
|
|
|
|
|
# and precompiled object files, and maybe user libraries. As we are
|
|
|
|
|
# going, guess an output file name.
|
|
|
|
|
for parm
|
|
|
|
|
do
|
|
|
|
|
case $parm
|
|
|
|
|
in
|
|
|
|
|
|
2002-09-19 01:25:18 +02:00
|
|
|
*.c) CCSRC="$CCSRC $parm"
|
2002-04-07 02:47:10 +02:00
|
|
|
if [ x$OUT = x ]; then
|
|
|
|
|
OUT=`basename $parm .c`
|
|
|
|
|
fi
|
|
|
|
|
;;
|
|
|
|
|
|
2002-09-19 01:25:18 +02:00
|
|
|
*.cc) CXSRC="$CXSRC $parm"
|
2002-05-10 05:54:46 +02:00
|
|
|
if [ x$OUT = x ]; then
|
|
|
|
|
OUT=`basename $parm .cc`
|
|
|
|
|
fi
|
|
|
|
|
;;
|
|
|
|
|
|
2002-04-07 02:47:10 +02:00
|
|
|
*.o) OBJ="$OBJ $parm"
|
|
|
|
|
if [ x$OUT = x ]; then
|
|
|
|
|
OUT=`basename $parm .o`
|
|
|
|
|
fi
|
|
|
|
|
;;
|
|
|
|
|
|
2002-07-05 19:17:20 +02:00
|
|
|
--name=*)
|
|
|
|
|
OUT=`echo $parm | cut -b8-`
|
|
|
|
|
;;
|
|
|
|
|
|
2002-04-07 02:47:10 +02:00
|
|
|
-l*) LIB="$LIB $parm"
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
if [ x$OUT = x ]; then
|
2002-07-04 01:20:12 +02:00
|
|
|
echo "Usage: $0 [src and obj files]..."
|
2002-04-07 02:47:10 +02:00
|
|
|
exit 0
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Put the .vpi on the result file.
|
|
|
|
|
OUT=$OUT".vpi"
|
|
|
|
|
|
2002-05-15 03:25:25 +02:00
|
|
|
compile_errors=0
|
|
|
|
|
|
2002-04-07 02:47:10 +02:00
|
|
|
# Compile all the source files into object files
|
|
|
|
|
for src
|
2002-05-10 05:54:46 +02:00
|
|
|
in $CCSRC
|
2002-04-07 02:47:10 +02:00
|
|
|
do
|
|
|
|
|
base=`basename $src .c`
|
|
|
|
|
obj=$base".o"
|
|
|
|
|
|
|
|
|
|
echo "Compiling $src..."
|
2002-07-04 01:20:12 +02:00
|
|
|
$CC -c -o $obj $CFLAGS $src || compile_errors=`expr $compile_errors + 1`
|
2002-04-07 02:47:10 +02:00
|
|
|
OBJ="$OBJ $obj"
|
|
|
|
|
done
|
|
|
|
|
|
2002-05-10 05:54:46 +02:00
|
|
|
for src
|
|
|
|
|
in $CXSRC
|
|
|
|
|
do
|
|
|
|
|
base=`basename $src .cc`
|
|
|
|
|
obj=$base".o"
|
|
|
|
|
|
|
|
|
|
echo "Compiling $src..."
|
2002-07-04 01:20:12 +02:00
|
|
|
$CXX -c -o $obj $CFLAGS $src || compile_errors=`expr $compile_errors + 1`
|
2002-05-10 05:54:46 +02:00
|
|
|
OBJ="$OBJ $obj"
|
|
|
|
|
done
|
|
|
|
|
|
2002-05-15 03:25:25 +02:00
|
|
|
if test $compile_errors -gt 0
|
|
|
|
|
then
|
|
|
|
|
echo "Some ($compile_errors) files failed to compile."
|
|
|
|
|
exit $compile_errors
|
|
|
|
|
fi
|
|
|
|
|
|
2002-04-07 02:47:10 +02:00
|
|
|
echo "Making $OUT from $OBJ..."
|
2002-05-15 03:25:25 +02:00
|
|
|
exec $LD -o $OUT $LDFLAGS $OBJ $LDLIBS
|