2002-04-09 22:55:38 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
2002-04-16 11:24:41 +08:00
|
|
|
TOPDIR=$1
|
|
|
|
INST_LIBS=$2
|
|
|
|
INST_INCLUDE=$3
|
|
|
|
INST_SRC=$4
|
2003-03-28 02:56:23 +08:00
|
|
|
INST_EXAMPLE_SRC=$5
|
2002-04-16 11:24:41 +08:00
|
|
|
INSTALLCMD=$6
|
|
|
|
COMPILER=$7
|
|
|
|
OPTF=$8
|
2002-04-09 22:55:38 +08:00
|
|
|
shift; shift; shift; shift; shift; shift; shift; shift;
|
2002-04-16 11:24:41 +08:00
|
|
|
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
|
2002-04-09 22:55:38 +08:00
|
|
|
|
2003-03-13 14:22:31 +08:00
|
|
|
[ "`uname`" = "Darwin" ] && MAKE=make || MAKE=gmake
|
|
|
|
|
2002-04-09 22:55:38 +08:00
|
|
|
|
2003-03-28 02:56:23 +08:00
|
|
|
copy_example_source()
|
2002-04-09 22:55:38 +08:00
|
|
|
{
|
2003-03-28 02:56:23 +08:00
|
|
|
for d in `ls $TOPDIR/examples/ | grep -v CVS`
|
2002-04-16 11:24:41 +08:00
|
|
|
do
|
2003-03-28 02:56:23 +08:00
|
|
|
if [ -d $TOPDIR/examples/$d ]
|
2002-04-16 11:24:41 +08:00
|
|
|
then
|
|
|
|
THISDIR=`pwd`
|
2003-03-28 02:56:23 +08:00
|
|
|
cd $TOPDIR/examples/$d
|
|
|
|
[ -d $INST_EXAMPLE_SRC/$d ] || mkdir -m 0755 -p $INST_EXAMPLE_SRC/$d
|
2003-03-13 10:53:40 +08:00
|
|
|
echo " installing $d"
|
2003-03-13 14:22:31 +08:00
|
|
|
for f in `$MAKE __instfiles | grep -v $MAKE`
|
2003-03-13 10:53:40 +08:00
|
|
|
do
|
2002-04-16 11:24:41 +08:00
|
|
|
src=`echo $f | cut -f1 -d"="`
|
|
|
|
dst=`echo $f | cut -f2 -d"="`
|
|
|
|
if [ -z "$dst" ] ; then dst=$src; fi
|
2003-03-28 02:56:23 +08:00
|
|
|
###echo $INSTALLCMD `pwd`/$src $INST_EXAMPLE_SRC/$d/$dst
|
|
|
|
$INSTALLCMD `pwd`/$src $INST_EXAMPLE_SRC/$d/$dst
|
2002-04-16 11:24:41 +08:00
|
|
|
done
|
|
|
|
cd $THISDIR
|
|
|
|
fi
|
2002-04-09 22:55:38 +08:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
generate_makedefs()
|
|
|
|
{
|
2002-04-09 23:51:20 +08:00
|
|
|
cat <<-EOF
|
2002-04-16 11:24:41 +08:00
|
|
|
|
2002-04-09 22:55:38 +08:00
|
|
|
TOPDIR ?= ../
|
|
|
|
THISDIR = .
|
|
|
|
INC = -I$INST_INCLUDE -I./
|
|
|
|
DEF = $DEF
|
2002-04-16 11:24:41 +08:00
|
|
|
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
|
2002-04-09 22:55:38 +08:00
|
|
|
VPATH = ..
|
2002-04-16 11:24:41 +08:00
|
|
|
|
2002-04-09 22:55:38 +08:00
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-04-16 11:24:41 +08:00
|
|
|
|
2002-04-09 22:55:38 +08:00
|
|
|
generate_makerules()
|
|
|
|
{
|
2002-04-09 23:51:20 +08:00
|
|
|
cat <<-EOF1 | sed 's/TAB/ /'
|
2002-04-09 22:55:38 +08:00
|
|
|
|
2002-04-16 11:24:41 +08:00
|
|
|
all : \$(EXEC) \$(LIB) \$(PLUGIN)
|
2002-04-09 22:55:38 +08:00
|
|
|
|
2002-04-16 11:24:41 +08:00
|
|
|
\$(EXEC) : Makedepend \$(OBJS)
|
|
|
|
TAB\$(C++) \$(LDFLAGS) \$(OBJS) \$(LIBS) -o \$@
|
2002-04-09 22:55:38 +08:00
|
|
|
|
2002-04-16 11:24:41 +08:00
|
|
|
\$(LIB) \$(PLUGIN) : \$(OBJS)
|
|
|
|
TAB\$(C++) \$(LDFLAGS) \$(SHARED) \$(OBJS) \$(LIBS) -o \$@
|
2002-04-09 22:55:38 +08:00
|
|
|
|
|
|
|
clean :
|
2002-04-16 11:24:41 +08:00
|
|
|
TABrm -f \$(OBJS) \$(MAKEDEPEND)
|
2002-04-09 22:55:38 +08:00
|
|
|
|
|
|
|
clobber : clean
|
2002-04-16 11:24:41 +08:00
|
|
|
TABrm -f \$(EXEC) \$(LIB) \$(PLUGIN)
|
2002-04-09 22:55:38 +08:00
|
|
|
|
|
|
|
|
2002-04-16 11:24:41 +08:00
|
|
|
Makedepend : \$(CXXFILES) \$(CFILES)
|
|
|
|
TAB\$(C++) \$(INC) $DEPARG \$? > \$@
|
2002-04-09 22:55:38 +08:00
|
|
|
|
|
|
|
|
|
|
|
.SUFFIXES: .cpp .o
|
|
|
|
.cpp.o:
|
2002-04-16 11:24:41 +08:00
|
|
|
TAB\$(C++) \$(CXXFLAGS) -c $<
|
2002-04-09 22:55:38 +08:00
|
|
|
|
|
|
|
sinclude Makedepend
|
|
|
|
|
|
|
|
EOF1
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[ -d $INST_SRC/Make ] || mkdir -m 0755 -p $INST_SRC/Make
|
|
|
|
|
2003-03-28 02:56:23 +08:00
|
|
|
echo =========== Installing Example Source Code =================
|
2002-04-09 22:55:38 +08:00
|
|
|
|
2002-04-16 11:24:41 +08:00
|
|
|
echo " generating make files ..."
|
2002-04-09 23:51:20 +08:00
|
|
|
generate_makedefs > $INST_SRC/Make/makedefs
|
|
|
|
generate_makerules > $INST_SRC/Make/makerules
|
2002-04-09 22:55:38 +08:00
|
|
|
|
2003-03-28 02:42:31 +08:00
|
|
|
echo " copying example files ..."
|
2003-03-28 02:56:23 +08:00
|
|
|
copy_example_source
|
2002-04-09 22:55:38 +08:00
|
|
|
|
|
|
|
exit 0
|