File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / bird / tools / mergedirs
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Aug 22 12:33:54 2017 UTC (6 years, 10 months ago) by misho
Branches: bird, MAIN
CVS tags: v1_6_8p3, v1_6_3p0, v1_6_3, HEAD
bird 1.6.3

    1: #!/bin/sh
    2: 
    3: if [ -z "$4" ] ; then
    4: 	echo "Usage: mergedirs <src-dir> <src-dir-rel> <obj-dir> <list-of-dirs>"
    5: 	exit 1
    6: 	fi
    7: cpp=${CPP:-cc -E}
    8: SRCDIR=$1
    9: shift
   10: SRCREL=$1
   11: case $SRCDIR in
   12: 	/*) ;;
   13: 	*) SRCREL="../$SRCREL" ;;
   14: 	esac
   15: shift
   16: OBJDIR=$1
   17: LIBDIR=$OBJDIR/lib
   18: CONFDIR=$OBJDIR/conf
   19: shift
   20: 
   21: echo "Merging system-dependent modules ($@)"
   22: MODULES=`for a in $@ ; do
   23: 		cat $SRCDIR/sysdep/config.h $SRCDIR/$a/Modules |
   24: 		$cpp -U unix -D MACROS_ONLY -I $OBJDIR - |
   25: 		sed "/^[ ]*\$/d;/^#/d;s@\\(.*\\)@\\1 $a/\\1@"
   26: 		done |
   27: 	sort -k1,1 -u |
   28: 	cut -d ' ' -f 2`
   29: rm -rf $LIBDIR $CONFDIR
   30: mkdir -p $LIBDIR $CONFDIR
   31: for a in $MODULES ; do
   32: 	b=`basename $a`
   33: 	case $b in
   34: 		*.h)	ln -s $SRCREL/$a $LIBDIR/$b
   35: 			;;
   36: 		*.c)	OBJ=`echo $b | sed 's/\.c$/\.o/'`
   37: 			OBJS="$OBJS $OBJ"
   38: 			SRCS="$SRCS \\
   39: 	$b"
   40: 			ln -s $SRCREL/$a $LIBDIR/$b
   41: 			;;
   42: 		*.Y)	CONFS="$CONFS\$(srcdir)/$a "
   43: 			ln -s $SRCREL/$a $CONFDIR/$b
   44: 			;;
   45: 		*)	echo "$b: Unknown file type"
   46: 			exit 1
   47: 			;;
   48: 		esac
   49: 	done
   50: 
   51: cat >$LIBDIR/Makefile <<EOF
   52: source=$SRCS
   53: lib-dest=birdlib.a
   54: root-rel=../
   55: 
   56: include ../Rules
   57: EOF
   58: 
   59: sed <$SRCDIR/conf/Makefile >$CONFDIR/Makefile "s|@CONFS@|$CONFS|"
   60: CONFS=`cd $SRCDIR ; ls conf/*.[chl]`
   61: for a in $CONFS ; do
   62: 	ln -s $SRCREL/$a $CONFDIR/
   63: done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>