Statistics
| Branch: | Revision:

iof-bird-daemon / tools / mergedirs @ d2ed2579

History | View | Annotate | Download (939 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
CONFDIR=$OBJDIR/conf
11
shift
12

    
13
echo "Merging system-dependent modules"
14
MODULES=`for a in $@ ; do
15
		sed <$a/Modules "s@\\(.*\\)@\\1 $a/\\1@"
16
		done |
17
	sort +0 -1 -u |
18
	cut -d ' ' -f 2`
19
rm -rf $LIBDIR $CONFDIR
20
mkdir -p $LIBDIR $CONFDIR
21
for a in $MODULES ; do
22
	echo $a
23
	b=`basename $a`
24
	case $b in
25
		*.h)	ln -s $TOPDIR/$a $LIBDIR/$b
26
			;;
27
		*.c)	OBJ=`echo $b | sed 's/\.c$/\.o/'`
28
			OBJS="$OBJS $OBJ"
29
			SRCS="$SRCS \\
30
	\$(TOPDIR)/$a"
31
			ln -s $TOPDIR/$a $LIBDIR/$b
32
			;;
33
		*.Y)	CONFS="$CONFS\$(TOPDIR)/$a "
34
			ln -s $TOPDIR/$a $CONFDIR/$b
35
			;;
36
		*)	echo "$b: Unknown file type"
37
			exit 1
38
			;;
39
		esac
40
	done
41

    
42
cat >$LIBDIR/Makefile <<EOF
43
OBJS=$OBJS
44
SRCS=$SRCS
45
LIB=birdlib.a
46

    
47
include \$(TOPDIR)/Rules
48
EOF
49

    
50
sed <$TOPDIR/conf/Makefile >$CONFDIR/Makefile "s|@CONFS@|$CONFS|"
51
ln -s $TOPDIR/conf/*.[chl] $CONFDIR/