Statistics
| Branch: | Revision:

iof-bird-daemon / tools / mergedirs @ 25697773

History | View | Annotate | Download (633 Bytes)

1
#!/bin/sh
2

    
3
if [ -z "$2" ] ; then
4
	echo "Usage: mergedirs <obj-dir> <list-of-dirs>"
5
	exit 1
6
	fi
7
TOPDIR=`pwd`
8
OBJDIR=$1
9
LIBDIR=$OBJDIR/lib
10
shift
11
echo "Merging system-dependent modules"
12
MODULES=`for a in $@ ; do
13
		sed <$a/Modules "s@\\(.*\\)@\\1 $a/\\1@"
14
		done |
15
	sort +0 -1 -u |
16
	cut -d ' ' -f 2`
17
rm -rf $LIBDIR
18
mkdir -p $LIBDIR
19
for a in $MODULES ; do
20
	echo $a
21
	b=`basename $a`
22
	ln -s $TOPDIR/$a $LIBDIR/$b
23
	OBJ=`echo $b | sed '/\.c$/!d;s/\.c$/\.o/'`
24
	if [ -n "$OBJ" ] ; then
25
		OBJS="$OBJS $OBJ"
26
		SRCS="$SRCS \\
27
	\$(TOPDIR)/$a"
28
		fi
29
	done
30
cat >$LIBDIR/Makefile <<EOF
31
OBJS=$OBJS
32
SRCS=$SRCS
33
LIB=birdlib.a
34

    
35
include \$(TOPDIR)/Rules
36
EOF