Gobligine/setup

1167 lines
32 KiB
Text
Raw Normal View History

2003-03-14 15:36:37 -07:00
#!/bin/sh
2000-03-25 15:38:54 -07:00
## ___________ _________ _____ __
## \_ _____/______ ____ ____ \_ ___ \____________ _/ ____\/ |_
## | __) \_ __ \_/ __ \_/ __ \/ \ \/\_ __ \__ \\ __\\ __|
2000-03-25 15:38:54 -07:00
## | \ | | \/\ ___/\ ___/\ \____| | \// __ \| | | |
## \___ / |__| \___ >\___ >\______ /|__| (____ /__| |__|
## \/ \/ \/ \/ \/
## ______________________ ______________________
## T H E W A R B E G I N S
## FreeCraft - A free fantasy real time strategy game engine
##
2000-03-25 15:38:54 -07:00
## setup - Configure Rules.make (GNU MAKE rules).
##
2003-02-08 19:37:39 -07:00
## (c) Copyright 2000-2003 by Dan Hensley, Nehal Mistry.
## Optimization section by Patrick McFarland.
2000-03-25 15:38:54 -07:00
##
2001-05-30 09:24:09 -06:00
## FreeCraft is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published
2002-05-13 12:31:43 -06:00
## by the Free Software Foundation; only version 2 of the License.
2001-05-30 09:24:09 -06:00
##
## FreeCraft is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
2000-03-25 15:38:54 -07:00
## $Id$
##
2002-05-13 12:31:43 -06:00
##-----------------------------------------------------------------------------
## HERE ARE SOME USER-CONFIGURABLE VARIABLES
2000-03-25 15:38:54 -07:00
EXTRA_CFLAGS="$CFLAGS -DUNIT_ON_MAP -DNEW_AI -DUSE_LIBMODPLUG -DUSE_HP_FOR_XP"
EXTRA_LDFLAGS="$LDFLAGS"
2001-10-21 07:38:10 -06:00
## These could be used for experimental versions
## ---------------------------------------------
## SLOW_INPUT If you have problems that events aren't fetched.
## BPP8_* Only for X11 8bpp common palette:
## BPP8_NORMAL disables default, like other Xbpp (delivers errors)
## BPP8_WINSAFE Uses a windows safe palette instead.
## BPP8_IRGB Uses a palette based on 4x4x4 RGB in 4 intensities
## There are some still not well tested code parts or branches.
2002-05-13 12:31:43 -06:00
## UNIT_ON_MAP Fast lookup of units
## UNITS_ON_MAP Faster lookup of units
## NEW_AI New better improved AI code
## USE_TILECACHE Faster tile drawing, costs memory.
## USE_SMART_TILECACHE Faster tile drawing, slow with hardware video memory.
2001-10-21 07:38:10 -06:00
## USE_HP_FOR_XP Use hit-points for XP calculations.
2002-05-13 12:31:43 -06:00
## USE_LIBMODPLUG Use modplug audio player support.
## USE_FLAC Use flac audio player support (asked by setup).
## USE_OGG Use ogg audio player support (asked by setup).
## USE_MAD Use mad mp3 audio player support (asked by setup).
2001-04-08 06:12:35 -06:00
## These aren't working yet:
2002-05-13 12:31:43 -06:00
## NEW_MAPDRAW Stephans new map draw code (value>1 shows update)
## USE_FFMPEG Use ffmpeg video player support.
2002-05-13 12:31:43 -06:00
## NEW_FOW New fog of war code, should work correct
## NEW_SHIPS New correct ship movement.
## HIERARCHIC_PATHFINDER Use hierarchic pathfinder
## USE_LUA Lua scripting support
##-----------------------------------------------------------------------------
# if your system/distribution lacks libpng, you may install the source
# in the freecraft directory and name that directory here!
# Default (tested) version is 1.0.12, anything above should also be ok.
# Adjust as required - ignored if the directory does not exist.
LOCAL_PNG="libpng-1.0.12"
# Please note that on most systems libpng also requires libz, so
# you might additionally need to install the following:
# if your system/distribution lacks libz, you may install the source
# in the freecraft directory and name that directory here!
# Default (tested) version is 1.1.4, anything above should also be ok.
# Adjust as required - ONLY USED IF SYSTEM HAS NO ZLIB INSTALLED BY DEFAULT!
LOCAL_ZLIB="zlib-1.1.4"
BEOS_CONFIGFILE=/boot/home/config/settings/FreeCraft/FreeCraft.cfg
##-----------------------------------------------------------------------------
## Everything below this line should only be changed by FreeCraft developers.
if [ "`echo $* | grep \"\-\-win32\"`" = "" ]; then
RULESFILE=Rules.make
DEPEND=depend
else
RULESFILE=Rules.make.WIN32
DEPEND=win32new
CROSS=" win32"
fi
if [ "`read -n 1 -t 0 2>&1 | grep e`x" = "x" ]; then
2003-02-08 13:12:12 -07:00
N="-n1 -s"
fi
2002-05-13 12:31:43 -06:00
cat << .. > $RULESFILE
## ___________ _________ _____ __
## \_ _____/______ ____ ____ \_ ___ \____________ _/ ____\/ |_
## | __) \_ __ \_/ __ \_/ __ \/ \ \/\_ __ \__ \\ __\\ __|
2002-05-13 12:31:43 -06:00
## | \ | | \/\ ___/\ ___/\ \____| | \// __ \| | | |
## \___ / |__| \___ >\___ >\______ /|__| (____ /__| |__|
## \/ \/ \/ \/ \/
## ______________________ ______________________
## T H E W A R B E G I N S
## FreeCraft - A free fantasy real time strategy game engine
##
..
2000-03-25 15:38:54 -07:00
# Compile commands
CC=gcc
2002-03-31 16:13:08 -07:00
CCLD=$CC
2000-03-25 15:38:54 -07:00
RM="rm -f"
2002-03-14 14:01:15 -07:00
if [ "`uname -a | grep -is bsd` x" != " x" ] ; then
MAKE=gmake
2002-05-01 13:19:00 -06:00
EXTRA_CFLAGS="$EXTRA_CFLAGS -DBSD"
2002-03-14 14:01:15 -07:00
else
MAKE=make
fi
if [ "`uname -a | grep -is bsd` x" != " x" ] ; then
DL=
else
DL=-ldl
fi
2000-03-25 15:38:54 -07:00
#------------------------------------------------------------------------------
# DON'T CHANGE ANYTHING FROM HERE DOWN UNLESS YOU KNOW WHAT YOU ARE DOING
2003-03-11 11:49:45 -07:00
VERSION="-DVERSION=\"1.18\""
2000-08-12 19:53:13 -06:00
UNIX=0
BEOS=0
WIN32=0
2001-02-21 18:59:53 -07:00
DARWIN=0
2000-03-25 15:38:54 -07:00
# Choose optimization level
#DEBUG_CFLAGS="-g -O0 -fsigned-char \$(PROFILE) -pipe -Wall -Werror \$(IFLAGS) \$(DFLAGS)"
DEBUG_CFLAGS="-g -O1 -fsigned-char -Wall -Werror \$(IFLAGS) \$(DFLAGS)"
2000-03-25 15:38:54 -07:00
#-- Production (default)
CFLAGS="-O2 -pipe -fsigned-char -fomit-frame-pointer -fconserve-space -fexpensive-optimizations -ffast-math \$(IFLAGS) \$(DFLAGS)"
#-- High Optimization
HIGHOPT="-O3 -pipe -fsigned-char -fomit-frame-pointer -foptimize-sibling-calls -ffast-math -fstrength-reduce -fthread-jumps -fcse-follow-jumps -fcse-skip-blocks -frerun-cse-after-loop -frerun-loop-opt -fgcse -fgcse-lm -fgcse-sm -fdelete-null-pointer-checks -fexpensive-optimizations -fschedule-insns2 -funroll-loops -frename-registers -fno-cprop-registers \$(IFLAGS) \$(DFLAGS)"
2000-03-25 15:38:54 -07:00
#------------------------------------------------------------------------------
# Function declarations
2003-03-14 15:36:37 -07:00
check_for_libs() {
2000-03-25 15:38:54 -07:00
TEMPFILE=temp$$
cat << " EOF" > $TEMPFILE.c
int main(){ int i; }
EOF
2003-02-25 17:31:12 -07:00
if test "`cc -o $TEMPFILE.a -w $TEMPFILE.c $LIBCHECK -L/usr/local/lib 2>&1` x" = " x" ; then
2000-03-25 15:38:54 -07:00
rm -f $TEMPFILE.[coa] > /dev/null 2>&1
2001-03-03 20:50:21 -07:00
return 0
2003-02-25 17:31:12 -07:00
elif test "`gcc -o $TEMPFILE.a -w $TEMPFILE.c $LIBCHECK -L/usr/local/lib 2>&1` x" = " x" ; then
2000-03-25 15:38:54 -07:00
rm -f $TEMPFILE.[coa] > /dev/null 2>&1
return 0
2001-03-03 20:50:21 -07:00
else
rm -f $TEMPFILE.[coa] > /dev/null 2>&1
return 1
2000-03-25 15:38:54 -07:00
fi
}
#------------------------------------------------------------------------------
# Parse input arguments
while test $# != 0 ; do
case $1 in
"-?"|"--help")
echo
2001-02-21 18:59:53 -07:00
echo "usage: setup [--static] [--unix] [--beos] [--win32] [--darwin] [--debug] [--profile]"
2000-03-25 15:38:54 -07:00
echo
echo "Setup will create a Rules.make file (or Rules.make.WIN32"
echo "if --win32 forced) that Freecraft needs to compile."
2000-03-25 15:38:54 -07:00
echo "Supported command-line arguments (you may use more than one at a time):"
echo " static : Compile Freecraft using static libraries (default dynamic)"
2000-08-12 19:53:13 -06:00
echo " unix : Force Unix/Linux compile options (default auto check)"
echo " beos : Force BeOS compile options (default auto check)"
2000-03-25 15:38:54 -07:00
echo " win32 : Force WIN32 compile options (default auto check)"
2001-02-21 18:59:53 -07:00
echo " darwin : Force Darwin compile options (default auto check)"
2000-03-25 15:38:54 -07:00
echo " debug : Compile with debug options (default no)"
echo " profile : Compile with profile support (default off)"
echo
exit
;;
2000-03-25 15:38:54 -07:00
"--static")
STATIC=-static
;;
2000-08-12 19:53:13 -06:00
"--unix")
UNIX=1
BEOS=0
2000-03-25 15:38:54 -07:00
WIN32=0
2001-02-21 18:59:53 -07:00
DARWIN=0
2000-03-25 15:38:54 -07:00
;;
2000-08-12 19:53:13 -06:00
"--beos")
UNIX=0
BEOS=1
WIN32=0
2001-02-21 18:59:53 -07:00
DARWIN=0
2000-08-12 19:53:13 -06:00
;;
2000-03-25 15:38:54 -07:00
"--win32")
2000-08-12 19:53:13 -06:00
UNIX=0
BEOS=0
2000-03-25 15:38:54 -07:00
WIN32=1
2001-02-21 18:59:53 -07:00
DARWIN=0
;;
"--darwin")
UNIX=0
BEOS=0
WIN32=0
DARWIN=1
2000-03-25 15:38:54 -07:00
;;
2000-08-12 19:53:13 -06:00
2000-03-25 15:38:54 -07:00
"--profile")
PROFILE=-pg
;;
2000-03-25 15:38:54 -07:00
"--debug")
CFLAGS=$DEBUG_CFLAGS
DEBUG=1
;;
2000-03-25 15:38:54 -07:00
*)
echo "Unknown command-line option '$1'"
exit
2000-03-25 15:38:54 -07:00
esac
2000-03-25 15:38:54 -07:00
shift
done
#
# Display banner
cat $RULESFILE
echo >> $RULESFILE
2002-05-13 12:31:43 -06:00
echo
2000-03-25 15:38:54 -07:00
#------------------------------------------------------------------------------
2000-08-12 19:53:13 -06:00
# Determine if this is for UNIX, BEOS, or WIN32
if [ "$UNIX" != "1" ] ; then
if [ "$BEOS" != "1" ] ; then
if [ "$WIN32" != "1" ] ; then
2001-02-21 18:59:53 -07:00
if [ "$DARWIN" != "1" ] ; then
2000-03-25 15:38:54 -07:00
2000-08-12 19:53:13 -06:00
if [ "$WIN32" = "0" ] ; then
if [ "`uname | grep -is cygwin` x" != " x" ] \
|| [ "`uname | grep -is MINGW` x" != " x" ] ; then
2000-08-12 19:53:13 -06:00
UNIX=0
BEOS=0
2000-03-25 15:38:54 -07:00
WIN32=1
2001-02-21 18:59:53 -07:00
DARWIN=0
2000-03-25 15:38:54 -07:00
echo "It appears that you are in a Cygwin/win32 environment..."
2001-02-21 18:59:53 -07:00
echo "Use --darwin, --unix or --beos to override"
2000-08-12 19:53:13 -06:00
fi
fi
if [ "$BEOS" = "0" ] ; then
if [ "`uname -a | grep -is beos` x" != " x" ] ; then
UNIX=0
BEOS=1
2000-03-25 15:38:54 -07:00
WIN32=0
2001-02-21 18:59:53 -07:00
DARWIN=0
2000-08-12 19:53:13 -06:00
echo "It appears that you are in a BeOS environment..."
2001-02-21 18:59:53 -07:00
echo "Use --darwin, --unix or --win32 to override"
fi
fi
if [ "$DARWIN" = "0" ] ; then
if [ "`uname -a | grep -is darwin` x" != " x" ] ; then
DARWIN=1
UNIX=0
BEOS=0
WIN32=0
CC=cc
2001-07-31 18:50:10 -06:00
CCLD=c++
2001-02-21 18:59:53 -07:00
CFLAGS="-O2 -pipe -fomit-frame-pointer -fconserve-space -fexpensive-optimizations -ffast-math \$(IFLAGS) \$(DFLAGS) -traditional-cpp"
HIGHOPT="$HIGHOPT -traditional-cpp"
DEBUG_CLAGS="$HIGHOPT -traditional-cpp"
2001-02-21 18:59:53 -07:00
echo "It appears that you are in a Darwin environment..."
echo "Use --beos, --win32 or --unix to override"
2000-03-25 15:38:54 -07:00
fi
fi
2000-08-12 19:53:13 -06:00
if [ "$UNIX" = "0" ] ; then
if [ "$BEOS" = "0" ] ; then
if [ "$WIN32" = "0" ] ; then
2001-02-21 18:59:53 -07:00
if [ "$DARWIN" = "0" ] ; then
UNIX=1
BEOS=0
WIN32=0
DARWIN=0
echo "It appears that you are in a UNIX environment..."
echo "Use --beos or --win32 or --darwin to override"
fi
2000-08-12 19:53:13 -06:00
fi
fi
2000-08-12 19:53:13 -06:00
fi
2001-02-21 18:59:53 -07:00
fi
fi
fi
2000-08-12 19:53:13 -06:00
fi
echo
2000-03-25 15:38:54 -07:00
#------------------------------------------------------------------------------
# libpng support part
#------------------------------------------------------------------------------
echo -n "Checking for PNG library..."
# libpng most likely requires libz.a, so check for it first..
LIBCHECK="-lz"; check_for_libs
if test "$?" = 0 ; then
HAVE_LIBZ=1
PNG_EXTRA="-lz"
else
LIBCHECK="-lz -L./$LOCAL_ZLIB"; check_for_libs
if test "$?" = 0 ; then
HAVE_LIBZ=2
PNG_EXTRA="$LIBCHECK"
fi
fi
2002-03-14 14:01:15 -07:00
PNG_PATH="-L/usr/local/lib"
PNG_LOCAL=0
if test -d $LOCAL_PNG ; then
PNG_PATH="-L./\$LOCAL_PNG"
PNG_LOCAL=1
fi
LIBCHECK="$PNG_PATH -lpng $PNG_EXTRA"; check_for_libs
if test "$?" = 0 ; then
if test "$PNG_LOCAL" = 1 ; then
echo " OK (local: $LOCAL_PNG)";
else
echo " OK";
fi
else
# Newer libpng (1.2.5 up) may need pow() from libm
LIBCHECK="$PNG_PATH -lpng $PNG_EXTRA -lm"; check_for_libs
if test "$?" = 0 ; then
PNG_EXTRA="$PNG_EXTRA -lm"
if test "$PNG_LOCAL" = 1 ; then
echo " OK (local: $LOCAL_PNG)";
else
echo " OK";
fi
else
echo " NOT FOUND!";
echo
echo "...You do not appear to have a working PNG library installed!"
echo
echo "libpng is required for freecraft to compile. Please "
echo "refer to the LOCAL_PNG section in the setup script to "
echo "find out how to install a local copy to compile freecraft."
echo
echo "Please also note that the PNG library most likely also"
echo "requires the GZIP compression library. If you are sure"
echo "to have libpng installed, but this test still fails,"
echo "check out for libz. You may refer to the LOCAL_ZLIB"
echo "section of this script to find out how to install a local"
echo "local copy of the libz."
echo
2003-02-03 13:40:39 -07:00
exit 1
fi
fi
#------------------------------------------------------------------------------
# Compile commands
#------------------------------------------------------------------------------
2000-03-25 15:38:54 -07:00
echo "# Compile commands" >> $RULESFILE
echo "CC=$CC" >> $RULESFILE
2001-07-31 18:50:10 -06:00
echo "CCLD=$CCLD" >> $RULESFILE
2000-03-25 15:38:54 -07:00
echo "RM=$RM" >> $RULESFILE
echo "MAKE=$MAKE" >> $RULESFILE
echo >> $RULESFILE
2002-03-29 19:06:43 -07:00
#------------------------------------------------------------------------------
# Install part
#------------------------------------------------------------------------------
if [ "$WIN32" = "0" ] ; then
echo "# Prefix for 'make install'" >> $RULESFILE
2002-04-07 17:48:33 -06:00
echo "PREFIX=${PREFIX-/usr/local}" >> $RULESFILE
echo >> $RULESFILE
fi
2002-03-29 19:06:43 -07:00
2000-03-25 15:38:54 -07:00
#------------------------------------------------------------------------------
# SIOD support part
#------------------------------------------------------------------------------
echo "# Use SIOD support" >> $RULESFILE
2000-08-12 19:53:13 -06:00
if [ "$BEOS" != "1" ] ; then
2001-02-21 18:59:53 -07:00
if [ "$DARWIN" != "1" ] ; then
echo "CCL = -DUSE_CCL" >> $RULESFILE
2001-03-03 14:06:08 -07:00
echo "CCLLIB = -lm" >> $RULESFILE
2001-02-21 18:59:53 -07:00
else
echo "CCL = -DUSE_CCL" >> $RULESFILE
2001-03-03 20:50:21 -07:00
echo "CCLLIB = -dl" >> $RULESFILE
2001-02-21 18:59:53 -07:00
fi
2000-08-12 19:53:13 -06:00
else
echo "CCL = -DUSE_CCL -DUSE_BEOS" >> $RULESFILE
2000-08-12 19:53:13 -06:00
echo "CCLLIB =" >> $RULESFILE
fi
2000-03-25 15:38:54 -07:00
echo >> $RULESFILE
#------------------------------------------------------------------------------
# Video driver part
#------------------------------------------------------------------------------
# Check for various libraries
echo
2000-03-25 15:38:54 -07:00
echo "Checking for various video libraries..."
# Check for SDL >= 1.x
2003-05-08 18:34:32 -06:00
if [ "`uname -a | grep -is freebsd` x" != " x" ] ; then
2002-03-14 14:01:15 -07:00
SDL_CONFIG=sdl11-config
else
SDL_CONFIG=sdl-config
fi
2002-05-14 22:34:06 -06:00
if test "$($SDL_CONFIG --version 2>/dev/null)x" = "x" ; then
2000-03-25 15:38:54 -07:00
echo "...You do not appear to have SDL installed"
else
HAVESDL=1
fi
2000-08-12 19:53:13 -06:00
if [ "$BEOS" != "1" ] ; then
2002-05-25 14:17:07 -06:00
if [ "$DARWIN" != "1" ] && [ "$WIN32" != "1" ] ; then
2001-02-21 18:59:53 -07:00
# Check for SVGALIB
LIBCHECK="-lvga -lvgagl"
check_for_libs
if test "$?" = 0 ; then
HAVESVGA=1
else
echo "...You do not appear to have SVGALIB installed"
fi
2000-03-25 15:38:54 -07:00
fi
if test "$WIN32" = 0 ; then
echo
echo "VIDEO DRIVER OPTIONS"
2003-03-30 17:21:24 -07:00
echo " X - X11 Support"
2000-08-12 19:53:13 -06:00
if test "$HAVESDL" = 1 ; then
2003-03-30 17:21:24 -07:00
echo " S - SDL Support"
fi
if test "$HAVESVGA" = 1 ; then
2003-03-30 17:21:24 -07:00
echo " V - SVGALIB Support"
fi
if (test "$HAVESVGA" = 1 && test "$HAVESDL" = 1) ; then
2003-03-30 17:21:24 -07:00
echo " B - SDL/SVGALIB Support"
fi
echo
2003-02-17 17:16:23 -07:00
echo -n "Please enter selection: (s) "
read $N VIDSEL
echo
2000-03-25 15:38:54 -07:00
fi
2000-08-12 19:53:13 -06:00
else
if [ "$HAVESDL" = 1 ] ; then
VIDSEL="S"
else
echo "FreeCraft on BeOS currently only supports SDL for video"
echo "Please install SDL and try again."
exit -1
fi
fi
2000-03-25 15:38:54 -07:00
#
echo "# Video support" >> $RULESFILE
case $VIDSEL in
[vV])
echo "-> Using SVGALIB"
2000-03-25 15:38:54 -07:00
echo "VIDEO = -DUSE_SVGALIB" >> $RULESFILE
2002-03-14 14:01:15 -07:00
echo "VIDEOLIB = -lvga $DL" >> $RULESFILE
2000-03-25 15:38:54 -07:00
;;
2000-03-25 15:38:54 -07:00
[bB])
2003-02-17 20:11:53 -07:00
echo "-> Using SDL/SVGALIB"
2000-03-25 15:38:54 -07:00
USESDL=1
2002-03-14 14:01:15 -07:00
SDLLIB="\$(shell $SDL_CONFIG --libs)"
2000-03-25 15:38:54 -07:00
echo "SDL = -DUSE_SDL -DUSE_SDLA \$(SDL_CFLAGS)" >> $RULESFILE
2002-12-06 10:54:22 -07:00
echo "SDL_CFLAGS = \$(shell $SDL_CONFIG --cflags)" >> $RULESFILE
echo "SDLLIB = $SDLLIB" >> $RULESFILE
2000-03-25 15:38:54 -07:00
echo >> $RULESFILE
echo "VIDEO = \$(SDL)" >> $RULESFILE
2002-03-14 14:01:15 -07:00
echo "VIDEOLIB = \$(SDLLIB) -lvga -lvgagl $DL" >> $RULESFILE
2000-03-25 15:38:54 -07:00
echo
;;
2003-02-17 20:11:53 -07:00
[xX])
echo "-> Using X11"
echo "VIDEO = -DUSE_X11" >> $RULESFILE
echo "VIDEOLIB = -lXext -lX11 $DL" >> $RULESFILE
;;
*)
2003-02-17 17:16:23 -07:00
echo -n "-> Using SDL"
USESDL=1
SDLLIB="\$(shell $SDL_CONFIG --libs)"
echo "SDL = -DUSE_SDL -DUSE_SDLA \$(SDL_CFLAGS)" >> $RULESFILE
2003-02-17 17:16:23 -07:00
echo "SDL_CFLAGS = \$(shell $SDL_CONFIG --cflags)" >> $RULESFILE
if test "$STATIC x" != " x" ; then
SDLLIB="\$(shell $SDL_CONFIG --static-libs)"
fi
echo "SDLLIB = $SDLLIB" >> $RULESFILE
echo >> $RULESFILE
if [ "$WIN32" = "0" ]; then
echo "VIDEO = \$(SDL)" >> $RULESFILE
if [ "$BEOS" != "1" ] ; then
echo "VIDEOLIB = \$(SDLLIB) $DL" >> $RULESFILE
else
echo "VIDEOLIB = \$(SDLLIB)" >> $RULESFILE
fi
fi
2003-02-17 17:16:23 -07:00
echo
2000-03-25 15:38:54 -07:00
;;
2000-03-25 15:38:54 -07:00
esac
# Put in Cygwin/win32 stuff if necessary, and test for mingw32
if test "$WIN32" = "1" ; then
echo "VIDEO = -DUSE_WIN32 \$(SDL)" >> $RULESFILE
if test "`gcc -v 2>&1 | grep -is mingw32` x" = " x" ; then
echo "VIDEOLIB = \$(SDLLIB) -lwsock32 -lws2_32" >> $RULESFILE
2000-03-25 15:38:54 -07:00
else
echo "VIDEOLIB = \$(SDLLIB) -lwsock32 -lws2_32 -lmingwex -lgmon" >> $RULESFILE
2000-03-25 15:38:54 -07:00
fi
fi
echo >> $RULESFILE
2000-03-25 15:38:54 -07:00
#------------------------------------------------------------------------------
# Sound part
#------------------------------------------------------------------------------
echo
echo -n "Do you want to compile with sound? (y) "
read $N ANSWER
echo
2000-03-25 15:38:54 -07:00
case $ANSWER in
[nN])
echo "-> No sound support"
2000-03-25 15:38:54 -07:00
;;
*)
echo "-> Compiling with sound support"
2000-03-25 15:38:54 -07:00
echo "# Sound support" >> $RULESFILE
echo "DSOUND = -DWITH_SOUND" >> $RULESFILE
# Check for arts client
if [ "$WIN32" = "1" ]; then
test
elif [ "`artsc-config --version 2>/dev/null` x" = " x" ] ; then
echo
echo "-> You do not appear to have the arts client installed"
else
echo
echo -n "Do you want use arts daemon sound output? (n) "
read $N ANSWERA
echo
case $ANSWERA in
[yY])
HAVEARTS=1
2002-12-06 10:54:22 -07:00
echo "ARTSC = -DWITH_ARTSC \$(shell artsc-config --cflags)" >> $RULESFILE
echo "ARTSCLIB = \$(shell artsc-config --libs)" >> $RULESFILE
echo "-> Compiling with arts daemon support"
;;
*)
echo "-> No arts daemon support"
;;
esac
2003-04-15 11:21:51 -06:00
echo
fi
if (test "$USESDL" != 1 -a "$HAVEARTS" != 1) ; then
# Check for libpthread
2000-03-25 15:38:54 -07:00
LIBCHECK="-lpthread"
check_for_libs
if test "$?" = 0 ; then
2002-03-26 23:00:47 -07:00
echo
echo "THREAD = -D_REENTRANT -DUSE_THREAD" >> $RULESFILE
if [ "`uname -a | grep -is bsd x` " != " x" ] ; then
echo "THREADLIB = -pthread" >> $RULESFILE
else
echo "THREADLIB = -lpthread" >> $RULESFILE
fi
2000-03-25 15:38:54 -07:00
fi
fi
2002-05-14 22:13:31 -06:00
2002-05-20 16:34:40 -06:00
LIBCHECK="-lFLAC -lm"; check_for_libs
2002-05-14 22:13:31 -06:00
if test "$?" = 0 ; then
2002-03-26 22:27:33 -07:00
echo -n "Would you like FLAC support? (n) "
read $N ANSWER
echo
2002-03-26 22:27:33 -07:00
case $ANSWER in
[yY])
echo "FLAC = -DUSE_FLAC" >> $RULESFILE
echo "FLACLIB = -lFLAC" >> $RULESFILE
echo "-> Compiling with FLAC support"
2002-03-26 22:27:33 -07:00
;;
*)
echo "-> No FLAC support"
2002-03-26 22:27:33 -07:00
;;
esac
2002-05-14 22:13:31 -06:00
else
echo "-> libFLAC not found"
2002-05-14 22:13:31 -06:00
fi
2002-03-26 22:27:33 -07:00
echo
2002-05-14 22:13:31 -06:00
LIBCHECK="-lvorbisfile -lvorbis -logg"; check_for_libs
if test "$?" = 0 ; then
2002-03-26 22:27:33 -07:00
echo -n "Would you like OGG support? (n) "
read $N ANSWER
echo
2002-03-26 22:27:33 -07:00
case $ANSWER in
[yY])
echo "OGG = -DUSE_OGG" >> $RULESFILE
echo "OGGLIB = -lvorbisfile -lvorbis -logg" >> $RULESFILE
echo "-> Compiling with OGG support"
2002-03-26 22:27:33 -07:00
;;
*)
echo "-> No OGG support"
2002-03-26 22:27:33 -07:00
;;
esac
2002-05-14 22:13:31 -06:00
else
LIBCHECK="-lvorbisfile"; check_for_libs
echo -n "-> "
2002-05-20 14:05:35 -06:00
if test "$?" != 0 ; then
2002-05-14 22:13:31 -06:00
echo -n "libvorbisfile "
fi
LIBCHECK="-lvorbis"; check_for_libs
2002-05-20 14:05:35 -06:00
if test "$?" != 0 ; then
2002-05-14 22:13:31 -06:00
echo -n "libvorbis "
fi
LIBCHECK="-logg"; check_for_libs
2002-05-20 14:05:35 -06:00
if test "$?" != 0 ; then
2002-05-14 22:13:31 -06:00
echo -n "libogg "
fi
echo "not found"
fi
2002-03-26 22:27:33 -07:00
echo
2002-05-14 22:13:31 -06:00
LIBCHECK="-lmad"; check_for_libs
if test "$?" = 0 ; then
echo -n "Would you like MAD MP3 support? (n) "
read $N ANSWER
echo
2002-03-26 22:27:33 -07:00
case $ANSWER in
[yY])
echo "MAD = -DUSE_MAD" >> $RULESFILE
2002-03-27 13:45:02 -07:00
echo "MP3LIB = -lmad" >> $RULESFILE
echo "-> Compiling with MAD MP3 support"
2002-03-26 22:27:33 -07:00
;;
*)
echo "-> No MAD MP3 support"
2002-03-26 22:27:33 -07:00
;;
esac
2002-05-14 22:13:31 -06:00
else
echo "-> libmad not found"
2002-05-14 22:13:31 -06:00
fi
echo
2002-05-14 22:13:31 -06:00
2003-03-30 17:21:24 -07:00
echo "CD AUDIO OPTIONS"
echo " I - Internal/libcda driver (recommended)"
2002-05-14 22:34:06 -06:00
if test "$HAVESDL" = "1" ; then
2003-03-30 17:21:24 -07:00
echo " S - SDL driver (known to have problems with some drives)"
2002-05-14 22:34:06 -06:00
fi
if test "$UNIX" = "1" ; then
2003-03-30 17:21:24 -07:00
echo " C - CDDA driver"
fi
2003-03-30 17:21:24 -07:00
echo " N - None"
echo
echo -n "Please enter selection: (n) "
read $N CDMode
echo
case $CDMode in
[sS])
echo "-> Compiling with SDL cdrom support"
echo "SDLCD = -DUSE_SDLCD" >> $RULESFILE
if [ "$USESDL" != "1" ]; then
2002-12-06 10:54:22 -07:00
echo "SDLCD = $SDLCD \$(shell $SDL_CONFIG --cflags)" >> $RULESFILE
2003-05-13 19:18:55 -06:00
echo "FREECRAFT_LIBS = \$(shell $SDL_CONFIG --libs)" >> $RULESFILE
fi
;;
[iI])
echo "-> Compiling with internal (libcda) cdrom support"
echo "LIBCDA = -DUSE_LIBCDA" >> $RULESFILE
2003-03-30 17:21:24 -07:00
;;
[cC])
echo "-> Compiling with CDDA cdrom support"
echo "CDDA = -DUSE_CDDA" >> $RULESFILE
;;
*)
echo "-> No cdrom support"
;;
esac
2002-03-26 22:27:33 -07:00
;;
2000-03-25 15:38:54 -07:00
esac
2000-03-25 15:38:54 -07:00
echo >> $RULESFILE
echo
#------------------------------------------------------------------------------
# Compression options part
#------------------------------------------------------------------------------
# Check for compression libraries
echo "Checking for compression libraries..."
echo
# libbz2
LIBCHECK="-lbz2"; check_for_libs
if test "$?" = 0 ; then HAVE_LIBBZ2=1; fi
2001-07-01 11:01:12 -06:00
# libzzip
LIBCHECK="-lzzip"; check_for_libs
if test "$?" = 0 ; then HAVE_LIBZZIP=1; fi
2000-03-25 15:38:54 -07:00
# Determine default compression option based on what's available
if (test "$HAVE_LIBZ" = 1 -o "$HAVE_LIBZ" = 2 && test "$HAVE_LIBBZ2" = 1) ; then
2000-03-25 15:38:54 -07:00
DEF4=" (default)"; COMPDEF="O"
elif test "$HAVE_LIBBZ2" = 1 ; then
DEF3=" (default)"; COMPDEF="B"
elif test "$HAVE_LIBZ" = 1 -o "$HAVE_LIBZ" = 2 ; then
2000-03-25 15:38:54 -07:00
DEF2=" (default)"; COMPDEF="G"
else
DEF1=" (default)"; COMPDEF="N"
fi
# Display menu
echo "COMPRESSION OPTIONS"
echo " N - None"$DEF1
2000-03-25 15:38:54 -07:00
if test "$HAVE_LIBZ" = 1 ; then
echo " G - GZ"$DEF2
2000-03-25 15:38:54 -07:00
fi
if test "$HAVE_LIBZ" = 2 ; then
echo " G - GZ"$DEF2 " (local: $LOCAL_ZLIB)"
fi
2000-03-25 15:38:54 -07:00
if test "$HAVE_LIBBZ2" = 1 ; then
echo " B - Bzip2"$DEF3
2000-03-25 15:38:54 -07:00
fi
if (test "$HAVE_LIBZ" = 1 -o "$HAVE_LIBZ" = 2 && test "$HAVE_LIBBZ2" = 1) ; then
echo " O - Both GZ and Bzip2"$DEF4
2000-03-25 15:38:54 -07:00
fi
2001-07-01 11:01:12 -06:00
if (test "$HAVE_LIBZ" = 1 -o "$HAVE_LIBZ" = 2 && test "$HAVE_LIBBZ2" = 1 && test "$HAVE_LIBZZIP" = 1 ) ; then
echo " A- All ZZip and GZ and Bzip2"$DEF5
2001-07-01 11:01:12 -06:00
fi
2000-03-25 15:38:54 -07:00
echo
echo -n "Please enter selection ($COMPDEF): "
read $N COMPOPT
echo
2000-03-25 15:38:54 -07:00
if test "$COMPOPT x" = " x" ; then COMPOPT=$COMPDEF; fi
echo "# Compression support" >> $RULESFILE
case $COMPOPT in
[nN])
echo "-> Using no compression"
2000-03-25 15:38:54 -07:00
echo "ZDEFS =" >> $RULESFILE
echo "ZLIBS =" >> $RULESFILE
;;
2000-03-25 15:38:54 -07:00
[bB])
echo "-> Using Bzip2 compression"
2000-03-25 15:38:54 -07:00
echo "ZDEFS = -DUSE_BZ2LIB" >> $RULESFILE
echo "ZLIBS = -lbz2" >> $RULESFILE
;;
2000-03-25 15:38:54 -07:00
[oO])
echo "-> Using GZ and Bzip2 compression"
2000-03-25 15:38:54 -07:00
echo "ZDEFS = -DUSE_ZLIB -DUSE_BZ2LIB" >> $RULESFILE
echo "ZLIBS = -lz -lbz2" >> $RULESFILE
;;
2001-07-01 11:01:12 -06:00
[aA])
echo "-> Using GZ, Bzip2, ZZip compression"
2001-07-01 11:01:12 -06:00
echo "ZDEFS = -DUSE_ZZIPLIB -DUSE_ZLIB -DUSE_BZ2LIB" >> $RULESFILE
echo "ZLIBS = -lzzip -lz -lbz2" >> $RULESFILE
;;
*)
echo "-> Using GZ compression"
2000-03-25 15:38:54 -07:00
echo "ZDEFS = -DUSE_ZLIB" >> $RULESFILE
echo "ZLIBS = -lz" >> $RULESFILE
;;
2000-03-25 15:38:54 -07:00
esac
echo "" >> $RULESFILE
#------------------------------------------------------------------------------
# Optimization Section
#------------------------------------------------------------------------------
if [ "$DEBUG" != 1 ] ; then
echo
echo "Debug Support allows you to debug Freecraft more easily, but disables a lot of"
echo "optimization support, which may cause Freecraft to run much slower."
echo
echo -n "Would you like debug support? (n): "
read $N DEBUGASK
case $DEBUGASK in
[yY])
echo
echo "-> Debug support enabled"
CFLAGS=$DEBUG_CFLAGS
DEBUG=1
;;
[nN])
echo
echo "-> Debug support disabled."
;;
esac
fi
CCVERS=`$CC -dumpversion`
CCMAJOR=`echo $CCVERS | cut -d. -f 1`
CCMINOR=`echo $CCVERS | cut -d. -f 2`
CCREALLYMINOR=`echo $CCVERS | cut -d. -f 3`
if [ $CCMAJOR -gt 3 -o $CCMAJOR -eq 3 -a $CCMINOR -ge 2 ] ; then
if [ "$DEBUG" != 1 ] && [ "$WIN32" != 1 ]; then
2003-02-08 17:50:31 -07:00
echo
echo "OPTIMIZATION OPTIONS"
echo
echo Compiler is $CC $CCMAJOR.$CCMINOR.$CCREALLYMINOR
echo
echo "This autoconfiguring program allows you to tell GCC to use different"
echo "optimizations, based on how stable you want Freecraft. The higher the"
echo "optimization, the more unstable Freecraft is. High Optimization also"
echo "may cause Freecraft to fail to compile, but usually doesnt. High"
echo "Optimization will also increase compile times."
echo
echo "Which Optimization Mode do you wish to use?"
echo
echo " N - Normal Optimization, used in Production Binaries."
echo " H - High Optimization, not recommended."
echo
echo -n "Please enter selection (n): "
read $N OPTASK
case $OPTASK in
[hH])
echo
echo "-> Using high optimization."
CFLAGS="$HIGHOPT"
;;
*)
echo
echo "-> Using normal optimization."
;;
esac
case $OPTASK in
[hH])
echo
echo "Specific Processor Optimization:"
echo
echo "You can additionally optimize Freecraft, depending on what architecture"
echo "(target machine) you run. If you dont know, or your target"
echo "machine isnt listed, simply press enter."
echo
echo " I - Pentium, Pentium MMX, Pentium Pro Pentium 2, Pentium 3, Pentium 4,"
echo " Celeron"
echo " A - AMD K6, K6-2, K6-3, Athlon, Ahtlon Thunderbird, Athlon 4,"
echo " Athlon XP, Athlon MP, Duron"
echo
echo -n "Please enter selection: "
read $N TYPEASK
echo
case $TYPEASK in
[iI])
CFLAGS="$CFLAGS -fno-branch-count-reg"
echo
echo "Choose one:"
echo
echo " A - Pentium"
echo " B - Pentium MMX"
echo " C - Pentium Pro"
echo " D - Pentium 2 or Celeron/Celeron A"
echo " E - Pentium 3 or Celeron with Coppermine Core"
echo " F - Pentium 4"
echo
echo -n "To choose none, press enter: "
read $N PROCASK
case $PROCASK in
[aA])
CFLAGS="$CFLAGS -march=pentium -malign-double -mpreferred-stack-boundary=3"
;;
[bB])
CFLAGS="$CFLAGS -march=pentium-mmx -malign-double -mmmx -mpreferred-stack-boundary=3"
;;
[cC])
CFLAGS="$CFLAGS -march=pentiumpro -malign-double -mpreferred-stack-boundary=3"
;;
[dD])
CFLAGS="$CFLAGS -march=pentium2 -mmmx"
;;
[eE])
CFLAGS="$CFLAGS -march=pentium3 -mmmx -msse -mpreferred-stack-boundary=4 -mfpmath=sse,387"
;;
[fF])
CFLAGS="$CFLAGS -march=pentium4 -mmmx -msse -msse2 -mpreferred-stack-boundary=4 -mfpmath=sse,387"
;;
esac
echo
;;
[aA])
CFLAGS="$CFLAGS -fno-branch-count-reg"
echo
echo "Choose one:"
echo
echo " A - K6"
echo " B - K6-2"
echo " C - K6-3"
echo " D - Athlon or Duron (Choose this one if you dont know)"
echo " E - Athlon or Duron /w Thunderbird Core"
echo " F - Athlon 4"
echo " G - Athlon XP"
echo " H - Athlon MP"
echo
echo "To choose none, just press enter."
echo -n "Please enter selection: "
read $N PROCASK
case $PROCASK in
[aA])
CFLAGS="$CFLAGS -march=k6 -malign-double"
;;
[bB])
CFLAGS="$CFLAGS -march=k6-2 -m3dnow -mmmx -malign-double"
;;
[cC])
CFLAGS="$CFLAGS -march=k6-3 -m3dnow -mmmx -malign-double"
;;
[dD])
CFLAGS="$CFLAGS -march=athlon -m3dnow -mmmx -malign-double"
;;
[eE])
CFLAGS="$CFLAGS -march=athlon-tbird -m3dnow -mmmx -malign-double"
;;
[fF])
CFLAGS="$CFLAGS -march=athlon-4 -m3dnow -mmmx -msse -malign-double -mfpmath=sse,387 -mpreferred-stack-boundary=4"
;;
[gG])
CFLAGS="$CFLAGS -march=athlon-xp -m3dnow -mmmx -msse -malign-double -mfpmath=sse,387 -mpreferred-stack-boundary=4"
;;
[hH])
CFLAGS="$CFLAGS -march=athlon-mp -m3dnow -mmmx -msse -malign-double -mfpmath=sse,387 -mpreferred-stack-boundary=4"
;;
esac
;;
esac
;;
esac
fi
fi
if [ $CCMAJOR -ne 3 -o $CCMAJOR -eq 3 -a $CCMINOR -ne 2 ] ; then
if [ "$DEBUG" != 1 ] && [ "$WIN32" != 1 ]; then
echo
echo Compiler is $CC $CCMAJOR.$CCMINOR.$CCREALLYMINOR
echo
echo "Optimization Menu Disabled: Not running GCC 3.2.x"
echo "-> Using Normal Optimization"
fi
fi
#------------------------------------------------------------------------------
# End Optimization Setion
#------------------------------------------------------------------------------
2000-03-25 15:38:54 -07:00
###############################################################################
# Write required information to the file
# May be required on some (older) distributions for libpng and libz!
2000-03-25 15:38:54 -07:00
# extra linker flags and include directory
# -L/usr/lib
2000-03-25 15:38:54 -07:00
LOCAL_LDF=""
LOCAL_IF=""
if test "$HAVE_LIBZ" = 2 ; then
LOCAL_LDF=" -L\$(TOPDIR)/$LOCAL_ZLIB"
LOCAL_IF="-I\$(TOPDIR)/$LOCAL_ZLIB"
if test "$DARWIN" = 1 ; then
LOCAL_IF="-I\$(TOPDIR)/$LOCAL_ZLIB -I/usr/include -I/usr/include/machine"
fi
2001-02-21 18:59:53 -07:00
else
if test "$DARWIN" = 1 ; then
LOCAL_IF="-I/usr/include -I/usr/include/machine " $LOCAL_IF
fi
fi
LDF_PNG_PATH=""
IF_PNG_PATH=""
if test "$PNG_LOCAL" = 1 ; then
LDF_PNG_PATH="-L\$(TOPDIR)/$LOCAL_PNG "
IF_PNG_PATH="-I\$(TOPDIR)/$LOCAL_PNG "
2001-02-21 18:59:53 -07:00
fi
if [ "$WIN32" = "0" ] ; then
echo "XLDFLAGS = -L/usr/X11R6/lib -L/usr/local/lib $LDF_PNG_PATH $LOCAL_LDF" >> $RULESFILE
2003-04-02 18:49:50 -07:00
echo "XIFLAGS = -I/usr/X11R6/include $IF_PNG_PATH $LOCAL_IF" >> $RULESFILE
2003-03-13 11:11:08 -07:00
else
echo "XLDFLAGS" = >> $RULESFILE
echo "XIFLAGS" = >> $RULESFILE
fi
2000-03-25 15:38:54 -07:00
echo >> $RULESFILE
# Add the last bits
# below this, nothing should be changed!
echo "#####################################################################" >> $RULESFILE
echo "# Don't change anything below here unless you know what you're doing!" >> $RULESFILE
echo >> $RULESFILE
echo "VERSION= '$VERSION'" >> $RULESFILE
2000-03-25 15:38:54 -07:00
echo "PROFILE=$PROFILE" >> $RULESFILE
echo >> $RULESFILE
2000-08-12 19:53:13 -06:00
if [ "$BEOS" != 1 ] ; then
2001-02-21 18:59:53 -07:00
if [ "$DARWIN" != 1 ] ; then
# Libraries needed to build tools
echo "TOOLLIBS=\$(XLDFLAGS) -lpng -lz -lm \$(THREADLIB)" >> $RULESFILE
2000-08-12 19:53:13 -06:00
2001-02-21 18:59:53 -07:00
# Libraries needed to build freecraft
2003-05-13 19:18:55 -06:00
echo "FREECRAFT_LIBS=$FREECRAFT_LIBS \$(XLDFLAGS) -lpng -lz -lm \\" >> $RULESFILE
echo " \$(THREADLIB) \$(CCLLIB) \$(VIDEOLIB) \$(ZLIBS) \\" >> $RULESFILE
echo " \$(ARTSCLIB) \$(FLACLIB) \$(OGGLIB) \$(MP3LIB) \\" >> $RULESFILE
echo " $EXTRA_LDFLAGS -lz -lm" >> $RULESFILE
2001-02-21 18:59:53 -07:00
else
# Libraries needed to build tools
echo "TOOLLIBS=\$(XLDFLAGS) -lpng -lz \$(THREADLIB)" >> $RULESFILE
# Libraries needed to build freecraft
2003-05-13 19:18:55 -06:00
echo "FREECRAFT_LIBS=\$(XLDFLAGS) -lpng -lz \\" >> $RULESFILE
2001-02-21 18:59:53 -07:00
echo " \$(THREADLIB) \$(CCLLIB) \$(VIDEOLIB) \$(ZLIBS)" >> $RULESFILE
fi
2000-08-12 19:53:13 -06:00
else
# Libraries needed to build tools
echo "TOOLLIBS=\$(XLDFLAGS) -lpng -lz \$(THREADLIB)" >> $RULESFILE
# Libraries needed to build freecraft
2003-05-13 19:18:55 -06:00
echo "FREECRAFT_LIBS=\$(XLDFLAGS) -lpng -lz \\" >> $RULESFILE
2000-08-12 19:53:13 -06:00
echo " \$(THREADLIB) \$(CCLLIB) \$(VIDEOLIB) \$(ZLIBS)" >> $RULESFILE
fi
2000-03-25 15:38:54 -07:00
echo "DISTLIST=\$(TOPDIR)/distlist" >> $RULESFILE
echo "TAGS=\$(TOPDIR)/src/tags" >> $RULESFILE
echo >> $RULESFILE
# WIN32
if test "$WIN32" = 1 ; then
echo "# Win32" >> $RULESFILE
echo "EXE=.exe" >> $RULESFILE
2000-04-04 14:56:00 -06:00
echo "OUTFILE=\$(TOPDIR)/freecraft\$(EXE)" >> $RULESFILE
2000-03-25 15:38:54 -07:00
echo "ARCH=win32" >> $RULESFILE
echo "OE=o" >> $RULESFILE
2002-04-17 11:41:26 -06:00
echo "OBJDIR=winobj" >> $RULESFILE
2000-03-25 15:38:54 -07:00
else
# LINUX
echo "# Linux" >> $RULESFILE
echo "EXE=" >> $RULESFILE
2000-04-04 14:56:00 -06:00
echo "OUTFILE=\$(TOPDIR)/freecraft" >> $RULESFILE
2000-03-25 15:38:54 -07:00
echo "ARCH=linux" >> $RULESFILE
echo "OE=o" >> $RULESFILE
2002-04-17 11:41:26 -06:00
echo "OBJDIR=obj" >> $RULESFILE
2000-03-25 15:38:54 -07:00
fi
#------------------------------------------------------------------------------
# architecture-dependent objects
echo >> $RULESFILE
echo "#ARCHOBJS=stdmman.\$(OE) svgalib.\$(OE) unix_lib.\$(OE) bitm_lnx.\$(OE)" >> $RULESFILE
# include flags
echo "IFLAGS= -I\$(TOPDIR)/src/include \$(XIFLAGS) -I\$(TOPDIR)/src/movie/vp31/include" >> $RULESFILE
2000-03-25 15:38:54 -07:00
# define flags
if test "$DEBUG" = 1 ; then
echo "DEBUG= -DDEBUG #-DFLAG_DEBUG" >> $RULESFILE
fi
echo "DFLAGS= \$(THREAD) \$(CCL) \$(VERSION) \\" >> $RULESFILE
echo " \$(VIDEO) \$(ZDEFS) \$(DSOUND) \\" >> $RULESFILE
2003-04-13 11:08:10 -06:00
echo " \$(DEBUG) \$(SDLCD) \$(LIBCDA) \$(CDDA) \\" >> $RULESFILE
echo -n " \$(ARTSC) \$(FLAC) \$(OGG) \$(MAD) " >> $RULESFILE
2000-08-12 19:53:13 -06:00
echo "" >> $RULESFILE
2000-03-25 15:38:54 -07:00
2003-02-11 10:58:20 -07:00
echo "CFLAGS=$CFLAGS $STATIC $EXTRA_CFLAGS $PROFILE" >> $RULESFILE
2000-03-25 15:38:54 -07:00
## JOHNS: my ctags didn't support
#CTAGSFLAGS=-i defmpstuvFS -a -f
2000-03-25 15:38:54 -07:00
echo "CTAGSFLAGS=-i defptvS -a -f " >> $RULESFILE
echo >> $RULESFILE
#
# Locks versions with symbolic name
echo "# Locks versions with a symbolic name" >> $RULESFILE
echo "LOCKVER= rcs -q -n\$(NAME)" >> $RULESFILE
echo >> $RULESFILE
2003-03-04 19:36:12 -07:00
if [ -f .depend ]; then rm .depend; fi
2003-02-25 18:03:00 -07:00
2000-03-25 15:38:54 -07:00
#------------------------------------------------------------------------------
#
# Source code documentation
echo "# Source code documentation" >> $RULESFILE
echo "DOXYGEN= doxygen" >> $RULESFILE
echo "DOCIFY= docify" >> $RULESFILE
echo "DOCPP= doc++" >> $RULESFILE
# Still didn't work
#echo "DOCIFY= /root/doc++-3.3.11/src/docify" >> $RULESFILE
#echo "DOCPP= /root/doc++-3.3.11/src/doc++" >> $RULESFILE
echo >> $RULESFILE
echo "%.doc: %.c" >> $RULESFILE
echo " @\$(TOPDIR)/tools/aledoc \$< | \$(DOCIFY) > \$*-c.doc 2>/dev/null" >> $RULESFILE
echo "%.doc: %.h" >> $RULESFILE
echo " @\$(TOPDIR)/tools/aledoc \$< | \$(DOCIFY) > \$*-h.doc 2>/dev/null" >> $RULESFILE
#------------------------------------------------------------------------------
# Final comments
echo
echo "Done generating $RULESFILE."
2002-03-26 23:00:47 -07:00
echo
2000-03-25 15:38:54 -07:00
echo -n "Would you like to compile it now? (y) "
read $N ANSWER
echo
2000-03-25 15:38:54 -07:00
case $ANSWER in
[nN])
echo
echo "Done generating $RULESFILE. Type '$MAKE $DEPEND && $MAKE$CROSS' to compile freecraft."
2002-03-26 23:00:47 -07:00
echo
2000-03-25 15:38:54 -07:00
;;
*)
2002-03-31 16:13:08 -07:00
echo
$MAKE $DEPEND
$MAKE$CROSS
2000-03-25 15:38:54 -07:00
;;
2000-03-25 15:38:54 -07:00
esac