1998-05-15 15:56:13 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
1999-01-10 08:18:32 +08:00
|
|
|
if [ -z "$4" ] ; then
|
|
|
|
echo "Usage: mergedirs <src-dir> <src-dir-rel> <obj-dir> <list-of-dirs>"
|
1998-05-15 15:56:13 +08:00
|
|
|
exit 1
|
|
|
|
fi
|
1999-01-24 05:08:36 +08:00
|
|
|
cpp=${CPP:-gcc -E}
|
1999-01-10 08:18:32 +08:00
|
|
|
SRCDIR=$1
|
|
|
|
shift
|
|
|
|
SRCREL=$1
|
|
|
|
case $SRCDIR in
|
|
|
|
/*) ;;
|
|
|
|
*) SRCREL="../$SRCREL" ;;
|
|
|
|
esac
|
|
|
|
shift
|
1998-05-15 15:56:13 +08:00
|
|
|
OBJDIR=$1
|
|
|
|
LIBDIR=$OBJDIR/lib
|
1998-11-28 03:31:41 +08:00
|
|
|
CONFDIR=$OBJDIR/conf
|
1998-05-15 15:56:13 +08:00
|
|
|
shift
|
1998-11-28 03:31:41 +08:00
|
|
|
|
1999-01-15 22:42:55 +08:00
|
|
|
echo "Merging system-dependent modules ($@)"
|
1998-05-15 15:56:13 +08:00
|
|
|
MODULES=`for a in $@ ; do
|
1999-01-24 05:08:36 +08:00
|
|
|
cat sysdep/autoconf.h $SRCDIR/$a/Modules |
|
|
|
|
$cpp -U unix - |
|
|
|
|
sed "/^[ ]*\$/d;/^#/d;s@\\(.*\\)@\\1 $a/\\1@"
|
1998-05-15 15:56:13 +08:00
|
|
|
done |
|
|
|
|
sort +0 -1 -u |
|
|
|
|
cut -d ' ' -f 2`
|
1998-11-28 03:31:41 +08:00
|
|
|
rm -rf $LIBDIR $CONFDIR
|
|
|
|
mkdir -p $LIBDIR $CONFDIR
|
1998-05-15 15:56:13 +08:00
|
|
|
for a in $MODULES ; do
|
|
|
|
b=`basename $a`
|
1998-11-28 03:31:41 +08:00
|
|
|
case $b in
|
1999-01-10 08:18:32 +08:00
|
|
|
*.h) ln -s $SRCREL/$a $LIBDIR/$b
|
1998-11-28 03:31:41 +08:00
|
|
|
;;
|
|
|
|
*.c) OBJ=`echo $b | sed 's/\.c$/\.o/'`
|
|
|
|
OBJS="$OBJS $OBJ"
|
|
|
|
SRCS="$SRCS \\
|
1999-01-10 08:18:32 +08:00
|
|
|
$b"
|
|
|
|
ln -s $SRCREL/$a $LIBDIR/$b
|
1998-11-28 03:31:41 +08:00
|
|
|
;;
|
1999-01-10 08:18:32 +08:00
|
|
|
*.Y) CONFS="$CONFS\$(srcdir)/$a "
|
|
|
|
ln -s $SRCREL/$a $CONFDIR/$b
|
1998-11-28 03:31:41 +08:00
|
|
|
;;
|
|
|
|
*) echo "$b: Unknown file type"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
1998-05-15 15:56:13 +08:00
|
|
|
done
|
1998-11-28 03:31:41 +08:00
|
|
|
|
1998-05-15 15:56:13 +08:00
|
|
|
cat >$LIBDIR/Makefile <<EOF
|
1999-01-10 08:18:32 +08:00
|
|
|
source=$SRCS
|
|
|
|
lib-dest=birdlib.a
|
|
|
|
root-rel=../
|
1998-05-15 15:56:13 +08:00
|
|
|
|
1999-01-10 08:18:32 +08:00
|
|
|
include ../Rules
|
1998-05-15 15:56:13 +08:00
|
|
|
EOF
|
1998-11-28 03:31:41 +08:00
|
|
|
|
1999-01-10 08:18:32 +08:00
|
|
|
sed <$SRCDIR/conf/Makefile >$CONFDIR/Makefile "s|@CONFS@|$CONFS|"
|
|
|
|
CONFS=`cd $SRCDIR ; ls conf/*.[chl]`
|
|
|
|
for a in $CONFS ; do
|
|
|
|
ln -s $SRCREL/$a $CONFDIR/
|
|
|
|
done
|