1998-05-15 07:56:13 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
1999-01-10 00:18:32 +00:00
|
|
|
if [ -z "$4" ] ; then
|
|
|
|
echo "Usage: mergedirs <src-dir> <src-dir-rel> <obj-dir> <list-of-dirs>"
|
1998-05-15 07:56:13 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2014-12-05 08:25:38 +00:00
|
|
|
cpp=${CPP:-cc -E}
|
1999-01-10 00:18:32 +00:00
|
|
|
SRCDIR=$1
|
|
|
|
shift
|
|
|
|
SRCREL=$1
|
|
|
|
case $SRCDIR in
|
|
|
|
/*) ;;
|
|
|
|
*) SRCREL="../$SRCREL" ;;
|
|
|
|
esac
|
|
|
|
shift
|
1998-05-15 07:56:13 +00:00
|
|
|
OBJDIR=$1
|
|
|
|
LIBDIR=$OBJDIR/lib
|
1998-11-27 19:31:41 +00:00
|
|
|
CONFDIR=$OBJDIR/conf
|
1998-05-15 07:56:13 +00:00
|
|
|
shift
|
1998-11-27 19:31:41 +00:00
|
|
|
|
1999-01-15 14:42:55 +00:00
|
|
|
echo "Merging system-dependent modules ($@)"
|
1998-05-15 07:56:13 +00:00
|
|
|
MODULES=`for a in $@ ; do
|
1999-03-02 16:39:41 +00:00
|
|
|
cat $SRCDIR/sysdep/config.h $SRCDIR/$a/Modules |
|
1999-10-29 10:08:09 +00:00
|
|
|
$cpp -U unix -D MACROS_ONLY -I $OBJDIR - |
|
1999-01-23 21:08:36 +00:00
|
|
|
sed "/^[ ]*\$/d;/^#/d;s@\\(.*\\)@\\1 $a/\\1@"
|
1998-05-15 07:56:13 +00:00
|
|
|
done |
|
2004-09-08 16:06:07 +00:00
|
|
|
sort -k1,1 -u |
|
1998-05-15 07:56:13 +00:00
|
|
|
cut -d ' ' -f 2`
|
1998-11-27 19:31:41 +00:00
|
|
|
rm -rf $LIBDIR $CONFDIR
|
|
|
|
mkdir -p $LIBDIR $CONFDIR
|
1998-05-15 07:56:13 +00:00
|
|
|
for a in $MODULES ; do
|
|
|
|
b=`basename $a`
|
1998-11-27 19:31:41 +00:00
|
|
|
case $b in
|
1999-01-10 00:18:32 +00:00
|
|
|
*.h) ln -s $SRCREL/$a $LIBDIR/$b
|
1998-11-27 19:31:41 +00:00
|
|
|
;;
|
|
|
|
*.c) OBJ=`echo $b | sed 's/\.c$/\.o/'`
|
|
|
|
OBJS="$OBJS $OBJ"
|
|
|
|
SRCS="$SRCS \\
|
1999-01-10 00:18:32 +00:00
|
|
|
$b"
|
|
|
|
ln -s $SRCREL/$a $LIBDIR/$b
|
1998-11-27 19:31:41 +00:00
|
|
|
;;
|
1999-01-10 00:18:32 +00:00
|
|
|
*.Y) CONFS="$CONFS\$(srcdir)/$a "
|
|
|
|
ln -s $SRCREL/$a $CONFDIR/$b
|
1998-11-27 19:31:41 +00:00
|
|
|
;;
|
|
|
|
*) echo "$b: Unknown file type"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
1998-05-15 07:56:13 +00:00
|
|
|
done
|
1998-11-27 19:31:41 +00:00
|
|
|
|
1998-05-15 07:56:13 +00:00
|
|
|
cat >$LIBDIR/Makefile <<EOF
|
1999-01-10 00:18:32 +00:00
|
|
|
source=$SRCS
|
|
|
|
lib-dest=birdlib.a
|
|
|
|
root-rel=../
|
2015-03-13 17:23:31 +00:00
|
|
|
dir-name=lib
|
|
|
|
dynamic-dir=1
|
1998-05-15 07:56:13 +00:00
|
|
|
|
1999-01-10 00:18:32 +00:00
|
|
|
include ../Rules
|
1998-05-15 07:56:13 +00:00
|
|
|
EOF
|
1998-11-27 19:31:41 +00:00
|
|
|
|
1999-01-10 00:18:32 +00: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
|