mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-11-09 12:48:43 +00:00
52 lines
939 B
Bash
Executable File
52 lines
939 B
Bash
Executable File
#!/bin/sh
|
|
|
|
if [ -z "$2" ] ; then
|
|
echo "Usage: mergedirs <obj-dir> <list-of-dirs>"
|
|
exit 1
|
|
fi
|
|
TOPDIR=`pwd`
|
|
OBJDIR=$1
|
|
LIBDIR=$OBJDIR/lib
|
|
CONFDIR=$OBJDIR/conf
|
|
shift
|
|
|
|
echo "Merging system-dependent modules"
|
|
MODULES=`for a in $@ ; do
|
|
sed <$a/Modules "s@\\(.*\\)@\\1 $a/\\1@"
|
|
done |
|
|
sort +0 -1 -u |
|
|
cut -d ' ' -f 2`
|
|
rm -rf $LIBDIR $CONFDIR
|
|
mkdir -p $LIBDIR $CONFDIR
|
|
for a in $MODULES ; do
|
|
echo $a
|
|
b=`basename $a`
|
|
case $b in
|
|
*.h) ln -s $TOPDIR/$a $LIBDIR/$b
|
|
;;
|
|
*.c) OBJ=`echo $b | sed 's/\.c$/\.o/'`
|
|
OBJS="$OBJS $OBJ"
|
|
SRCS="$SRCS \\
|
|
\$(TOPDIR)/$a"
|
|
ln -s $TOPDIR/$a $LIBDIR/$b
|
|
;;
|
|
*.Y) CONFS="$CONFS\$(TOPDIR)/$a "
|
|
ln -s $TOPDIR/$a $CONFDIR/$b
|
|
;;
|
|
*) echo "$b: Unknown file type"
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
cat >$LIBDIR/Makefile <<EOF
|
|
OBJS=$OBJS
|
|
SRCS=$SRCS
|
|
LIB=birdlib.a
|
|
|
|
include \$(TOPDIR)/Rules
|
|
EOF
|
|
|
|
sed <$TOPDIR/conf/Makefile >$CONFDIR/Makefile "s|@CONFS@|$CONFS|"
|
|
ln -s $TOPDIR/conf/*.[chl] $CONFDIR/
|