[AD] Expansion to fix.sh, and slight change to makefile.dj

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Hi,

I have two patches. The first one autodetects bash and, if found, uses
unix tools (rm, cp et al. as opposed to copy and del or whatever), since
if bash is run straight from Windows, copy and del don't work.

--- /home/cvs/libs/allegro/makefile.dj	Sun Jul  8 22:27:56 2001
+++ makefile.dj	Mon Jul  9 14:58:24 2001
@@ -20,7 +20,8 @@
   UNIX_TOOLS = 1
 endif
 
-ifdef BASH
+# autodetect bash
+ifneq ($(findstring bash,$(SHELL)),)
   UNIX_TOOLS = 1
 endif
 
The second patch expands fix.sh so that it now supports the options 
--warn (turns on WARNMODE=1 in the makefile), --i586 (turns on
PENTIUMONLY=1 in the makefile) and --i686 (turns on I686ONLY=1 in the
makefile). It is also very easy to add other important options, should
we need them.

I didn't touch fix.bat, because I don't know how to use batch files.

If you like this patch, please test it thoroughly (it works fine on
DJGPP, but I have little experience writing scripts).

--- /home/cvs/libs/allegro/fix.sh	Sun Jul  8 22:27:56 2001
+++ fix.sh	Mon Jul  9 14:56:30 2001
@@ -78,15 +78,23 @@
 proc_help()
 {
    echo ""
-   echo "Usage: ./fix.sh <platform> [--quick|--dtou|--utod|--utom|--mtou]"
+   echo "Usage: ./fix.sh <platform> [--quick|--dtou|--utod|--utom|--mtou] [options]"
    echo ""
    echo "Where platform is one of: bcc32, beos, djgpp, mingw32, msvc, qnx, rsxnt, unix"
-   echo "mac and watcom."
+   echo "mac or watcom."
+   echo ""
    echo "The --quick parameter turns of text file conversion, --dtou converts from"
    echo "DOS/Win32 format to Unix, --utod converts from Unix to DOS/Win32 format,"
    echo "--utom converts from Unix to Macintosh format and --mtou converts from"
    echo "Macintosh to Unix format. If no parameter is specified --dtou is assumed."
    echo ""
+   echo "Valid options are: --warn (turns on strict warnings), and (on Intel"
+   echo "platforms) the following flags:"
+   echo "   --i586   or   --pentium       The original Pentium"
+   echo "   --i686   or   --pentiumpro    Pentium Pro, II, III, IV, et al."
+   echo "This generates better code, but the Allegro library won't run on a"
+   echo "processor older than whatever you specify here."
+   echo ""
 }
 
 proc_fix()
@@ -96,6 +104,25 @@
    if [ "$AL_NOMAKE" != "1" ]; then
       echo "# generated by fix.sh" > makefile
       echo "MAKEFILE_INC = $AL_MAKEFILE" >> makefile
+
+      for param in $*; do
+         if [ "$param" == "--warn" ]; then
+             echo "WARNMODE := 1" >> makefile
+         fi
+         if [ "$param" == "--i586" ]; then
+             echo "PENTIUMONLY := 1" >> makefile
+         fi
+         if [ "$param" == "--pentium" ]; then
+             echo "PENTIUMONLY := 1" >> makefile
+         fi
+         if [ "$param" == "--i686" ]; then
+             echo "I686ONLY := 1" >> makefile
+         fi
+         if [ "$param" == "--pentiumpro" ]; then
+             echo "I686ONLY := 1" >> makefile
+         fi
+      done
+
       echo "include makefile.all" >> makefile
    fi
 
@@ -166,34 +193,34 @@
 
 if [ "$1" = "bcc32" ]; then
    proc_bcc32
-   proc_fix
+   proc_fix $*
 elif [ "$1" = "beos" ]; then
    proc_beos
-   proc_fix
+   proc_fix $*
 elif [ "$1" = "djgpp" ]; then
    proc_djgpp
-   proc_fix
+   proc_fix $*
 elif [ "$1" = "mingw32" ]; then
    proc_mingw32
-   proc_fix
+   proc_fix $*
 elif [ "$1" = "msvc" ]; then
    proc_msvc
-   proc_fix
+   proc_fix $*
 elif [ "$1" = "qnx" ]; then
    proc_qnx
-   proc_fix
+   proc_fix $*
 elif [ "$1" = "rsxnt" ]; then
    proc_rsxnt
-   proc_fix
+   proc_fix $*
 elif [ "$1" = "unix" ]; then
    proc_unix
-   proc_fix
+   proc_fix $*
 elif [ "$1" = "mac" ]; then
    proc_mac
-   proc_fix
+   proc_fix $*
 elif [ "$1" = "watcom" ]; then
    proc_watcom
-   proc_fix
+   proc_fix $*
 elif [ "$1" = "help" ]; then
    proc_help
    AL_NOCONV="1"
@@ -217,7 +244,7 @@
    echo "Converting files from Macintosh to Unix..."
    proc_mtou
 elif [ "$2" = "--quick" ]; then
-   echo "No text file conversion..."
+   echo "No text file conversion"
 else
    if [ "$AL_NOCONV" != "1" ]; then
       echo "Converting files from DOS/Win32 to Unix..."
Other candidates for inclusion in this are options like --debug,
--profile, --lib-only (doesn't make examples); that sort of thing.

Bye for now,
-- 
Laurence Withers, lwithers@xxxxxxxxxx
                http://www.lwithers.demon.co.uk/

Attachment: signature.asc
Description: PGP signature



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/