diff options
author | Martin Mares <mj@ucw.cz> | 1999-01-10 01:18:32 +0100 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 1999-01-10 01:18:32 +0100 |
commit | 49e7e5ee0b2848f5bf120a962e2e7eb11b86566a (patch) | |
tree | 56e7c215f49ab59792b5cf0194fa5045a66943c7 /tools/mergedirs | |
parent | 2f9bcf9713523f6fefecd143cc2aa2a8dda7f27f (diff) | |
download | bird-49e7e5ee0b2848f5bf120a962e2e7eb11b86566a.tar bird-49e7e5ee0b2848f5bf120a962e2e7eb11b86566a.zip |
New makefiles. Includes support for out-of-source-tree builds.
Diffstat (limited to 'tools/mergedirs')
-rwxr-xr-x | tools/mergedirs | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/tools/mergedirs b/tools/mergedirs index 3a085fd..25fc6bf 100755 --- a/tools/mergedirs +++ b/tools/mergedirs @@ -1,10 +1,17 @@ #!/bin/sh -if [ -z "$2" ] ; then - echo "Usage: mergedirs <obj-dir> <list-of-dirs>" +if [ -z "$4" ] ; then + echo "Usage: mergedirs <src-dir> <src-dir-rel> <obj-dir> <list-of-dirs>" exit 1 fi -TOPDIR=`pwd` +SRCDIR=$1 +shift +SRCREL=$1 +case $SRCDIR in + /*) ;; + *) SRCREL="../$SRCREL" ;; + esac +shift OBJDIR=$1 LIBDIR=$OBJDIR/lib CONFDIR=$OBJDIR/conf @@ -12,26 +19,25 @@ shift echo "Merging system-dependent modules" MODULES=`for a in $@ ; do - sed <$a/Modules "s@\\(.*\\)@\\1 $a/\\1@" + sed <$SRCDIR/$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 + *.h) ln -s $SRCREL/$a $LIBDIR/$b ;; *.c) OBJ=`echo $b | sed 's/\.c$/\.o/'` OBJS="$OBJS $OBJ" SRCS="$SRCS \\ - \$(TOPDIR)/$a" - ln -s $TOPDIR/$a $LIBDIR/$b + $b" + ln -s $SRCREL/$a $LIBDIR/$b ;; - *.Y) CONFS="$CONFS\$(TOPDIR)/$a " - ln -s $TOPDIR/$a $CONFDIR/$b + *.Y) CONFS="$CONFS\$(srcdir)/$a " + ln -s $SRCREL/$a $CONFDIR/$b ;; *) echo "$b: Unknown file type" exit 1 @@ -40,12 +46,15 @@ for a in $MODULES ; do done cat >$LIBDIR/Makefile <<EOF -OBJS=$OBJS -SRCS=$SRCS -LIB=birdlib.a +source=$SRCS +lib-dest=birdlib.a +root-rel=../ -include \$(TOPDIR)/Rules +include ../Rules EOF -sed <$TOPDIR/conf/Makefile >$CONFDIR/Makefile "s|@CONFS@|$CONFS|" -ln -s $TOPDIR/conf/*.[chl] $CONFDIR/ +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 |