Revision d2ed2579 tools/mergedirs

View differences:

tools/mergedirs
7 7
TOPDIR=`pwd`
8 8
OBJDIR=$1
9 9
LIBDIR=$OBJDIR/lib
10
CONFDIR=$OBJDIR/conf
10 11
shift
12

  
11 13
echo "Merging system-dependent modules"
12 14
MODULES=`for a in $@ ; do
13 15
		sed <$a/Modules "s@\\(.*\\)@\\1 $a/\\1@"
14 16
		done |
15 17
	sort +0 -1 -u |
16 18
	cut -d ' ' -f 2`
17
rm -rf $LIBDIR
18
mkdir -p $LIBDIR
19
rm -rf $LIBDIR $CONFDIR
20
mkdir -p $LIBDIR $CONFDIR
19 21
for a in $MODULES ; do
20 22
	echo $a
21 23
	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 \\
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 \\
27 30
	\$(TOPDIR)/$a"
28
		fi
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
29 40
	done
41

  
30 42
cat >$LIBDIR/Makefile <<EOF
31 43
OBJS=$OBJS
32 44
SRCS=$SRCS
......
34 46

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

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

Also available in: Unified diff