#!/bin/sh
# This is an almost complete copy of the propagate script
# coming along with the qt-0.99 source distribution.  I've modified
# it to make the examples and tutorial suitable for a
# debian installation. 
# THIS SCRIPT ISN'T INTENDED TO MODIFY THE ORIGINAL SOURCE,
# it replaces the original script when installing examples
# and tutorials under /usr/doc/examples/qt1
# Heiko <heiko@lotte.sax.de>

MAKEFILES=`(find . -name Makefile -print ; echo ./Makefile) | sort | uniq -u`;

QTDIR=`( cd ../.. ; pwd )`

for a in $MAKEFILES ; do
    M=`dirname $a`/Makefile
    N=${M}.new
    cat > $N <<EOF
####### This section is automatically generated from
#######    `pwd`/Makefile

INCDIR	=	/usr/X11R6/include/X11/qt
CFLAGS	=	${CFLAGS}
LFLAGS	=	-L/usr/X11R6/lib ${LFLAGS}
CC	=	${CC}
MOC	=	/usr/X11R6/bin/moc

####### End of automatically generated section
#
EOF
    sed -ne '/# *\$Source.*\$/,$ p' < $M >> $N
    rm -f $M
    mv $N $M
    echo edited $M
done

