OpenSceneGraph/Make/instdemosrc
2003-03-13 06:22:31 +00:00

122 lines
2.6 KiB
Bash
Executable File

#!/bin/sh
TOPDIR=$1
INST_LIBS=$2
INST_INCLUDE=$3
INST_SRC=$4
INST_DEMO_SRC=$5
INSTALLCMD=$6
COMPILER=$7
OPTF=$8
shift; shift; shift; shift; shift; shift; shift; shift;
DEPARG=$1
LINKARGS=$2
OSG_LIBS=$3
FREETYPE_LIB=$4
GLUT_LIB=$5
GL_LIBS=$6
X_LIBS=$7
SOCKET_LIBS=$8
shift; shift; shift; shift; shift; shift; shift; shift;
OTHER_LIBS=$1
TIFF_LIB=$2
[ "`uname`" = "Darwin" ] && MAKE=make || MAKE=gmake
copy_demo_source()
{
for d in `ls $TOPDIR/src/Demos/ | grep -v CVS`
do
if [ -d $TOPDIR/src/Demos/$d ]
then
THISDIR=`pwd`
cd $TOPDIR/src/Demos/$d
[ -d $INST_DEMO_SRC/$d ] || mkdir -m 0755 -p $INST_DEMO_SRC/$d
echo " installing $d"
for f in `$MAKE __instfiles | grep -v $MAKE`
do
src=`echo $f | cut -f1 -d"="`
dst=`echo $f | cut -f2 -d"="`
if [ -z "$dst" ] ; then dst=$src; fi
###echo $INSTALLCMD `pwd`/$src $INST_DEMO_SRC/$d/$dst
$INSTALLCMD `pwd`/$src $INST_DEMO_SRC/$d/$dst
done
cd $THISDIR
fi
done
}
generate_makedefs()
{
cat <<-EOF
TOPDIR ?= ../
THISDIR = .
INC = -I$INST_INCLUDE -I./
DEF = $DEF
CXXFLAGS = \$(ARCHARGS) $OPTF \$(DEF) \$(INC)
LDFLAGS = \$(ARCHARGS) $OPTF -L$INST_LIBS $LINKARGS
OBJS = \$(C++FILES:.cpp=.o) \$(CXXFILES:.cpp=.o) \$(CFILES:.c=.o)
C++ = $COMPILER
OSG_LIBS = $OSG_LIBS
FREETYPE_LIB = $FREETYPE_LIB
GLUT_LIB = $GLUT_LIB
GL_LIBS = $GL_LIBS
X_LIBS = $X_LIBS
SOCKET_LIBS = $SOCKET_LIBS
OTHER_LIBS = $OTHER_LIBS
TIFF_LIB = $TIFF_LIB
VPATH = ..
EOF
}
generate_makerules()
{
cat <<-EOF1 | sed 's/TAB/ /'
all : \$(EXEC) \$(LIB) \$(PLUGIN)
\$(EXEC) : Makedepend \$(OBJS)
TAB\$(C++) \$(LDFLAGS) \$(OBJS) \$(LIBS) -o \$@
\$(LIB) \$(PLUGIN) : \$(OBJS)
TAB\$(C++) \$(LDFLAGS) \$(SHARED) \$(OBJS) \$(LIBS) -o \$@
clean :
TABrm -f \$(OBJS) \$(MAKEDEPEND)
clobber : clean
TABrm -f \$(EXEC) \$(LIB) \$(PLUGIN)
Makedepend : \$(CXXFILES) \$(CFILES)
TAB\$(C++) \$(INC) $DEPARG \$? > \$@
.SUFFIXES: .cpp .o
.cpp.o:
TAB\$(C++) \$(CXXFLAGS) -c $<
sinclude Makedepend
EOF1
}
[ -d $INST_SRC/Make ] || mkdir -m 0755 -p $INST_SRC/Make
echo =========== Installing Demo Source Code =================
echo " generating make files ..."
generate_makedefs > $INST_SRC/Make/makedefs
generate_makerules > $INST_SRC/Make/makerules
echo " copying demo files ..."
copy_demo_source
exit 0