#!/bin/sh
#
# Copyright distributed.net 1998-1999 - All Rights Reserved
# For use in distributed.net projects only.
# Any other distribution or use of this source violates copyright.
#
# @(#)$Id: configure,v 1.222.2.50 1999/11/16 22:16:17 ivo Exp $

# *** Notes for v2.8001+ ***
#
# - Adding CSC to the target:
#   a) Add ${CSC_ANSI_SRCS} to your target's TARGET_ADDSRCS
#      (x86 clients also have nasm cores. See linux/freebsd.)
#   b) Add -DHAVE_CSC_CORES to your target's TARGET_CCFLAGS
#
# - OGR IS NOT READY YET, but the same would apply there too
#   (with $OGR_ANSI_SRCS and -DHAVE_OGR_CORES of course :)
#
# - If you wish to continue supporting DES, add -DHAVE_DES_CORES
#
# - If you wish to have the build automatically generate a .tar.gz ready
#   for upload, then add  TARGET_TARBALL="<os>-<cpu>-<limitations>" 
#   for example: TARGET_TARBALL="linux-x86-libc4" 
#
# - Avoid building separate MT and non-MT clients. MT is always preferred
#   (from the client's perspective), and the user can always force non-MT
#   by setting numcpu=0
#

#####################################################################
# Note to people making changes..  Do not put spaces around the '=' #
# signs in the variable definitions below.  Some sh implementations #
# will interpret such lines as statements rather than assignments.  #
#####################################################################

if [ -z "$1" ]; then
  echo "No platform specified on command line.";
  echo "Run with 'list' as an argument to see available platforms."
  exit 1
fi

#
# Binary's name
#
TARGET_BINNAME="dnetc"
TARGET_BINNAME_SUFFIX=""
BUILDNAME=$1

#
# Platform specific docfiles to be included in the tarball. You only need
# to specify platform specific files. Generic ones are added automatically.
#
TARGET_DOCFILES="docs/readme._ix" # override where appropriate
TARGET_GENMAN=1 # do we generate a man page or not

#
# Target specific tarball options. 
#
TARGET_TARBALL=""     # 'binnameNNN-' is auto prepended, ".tar.gz" is appended
TARGET_TARBALL_COMMENT="" # special comments for tarball.readme (if needed)
TARGET_ARCTYPE="tgz"  # or "zip"

#
# Common compiler options
#
OPTS_GCC='-fcaller-saves -fcse-follow-jumps -fcse-skip-blocks \
	  -fexpensive-optimizations -fomit-frame-pointer \
	  -frerun-cse-after-loop -fstrength-reduce -fthread-jumps \
	  -funroll-loops -fno-inline-functions -fno-exceptions \
	  -Wall'
OPTS_GCC272='-fomit-frame-pointer -fno-inline-functions \
	     -fno-exceptions -fno-rtti -Wall'
OPTS_XLC3='-O3 -qansialias -qlibansi'
OPTS_EGCS='-O2 -fstrict-aliasing -fno-exceptions -fomit-frame-pointer -Wall'
#OPTS_EGCS='-O2 -fno-exceptions -fomit-frame-pointer -Wall'

#
# Common platform compiler options
#

#-- Sparc

OPTS_CC_SPARC='-fast -xO4 -xtarget=ultra1/140 -DASM_SPARC'

# (sparc/v7 [SS1/2/IPX] gcc)
OPTS_GCC_SPARC1="$OPTS_GCC -O6 -mcypress -DASM_SPARC"
OPTS_GCC272_SPARC1="$OPTS_GCC272 -O6 -mcypress -DASM_SPARC"

# (sparc/v8 [SS5+]      gcc)
OPTS_GCC_SPARC="$OPTS_GCC -O6 -msupersparc -DASM_SPARC"
OPTS_GCC272_SPARC="$OPTS_GCC272 -O6 -msupersparc -DASM_SPARC"

# (sparc/v9 [Ultra]     gcc)
OPTS_GCC_ULTRA="$OPTS_GCC -O6 -msupersparc -DASM_SPARC"
OPTS_GCC272_ULTRA="$OPTS_GCC272 -O6 -msupersparc -DASM_SPARC"
OPTS_EGCS_ULTRA="OPTS_GCC -Os -mtune=ultrasparc -fforce-mem -mvis \
		-fstrict-aliasing -fcall-used-g4 -fcall-used-g5 -fcall-used-g6"
OPTS_GAS_ULTRA="-Av9a"
OPTS_AS_ULTRA="-xarch=v8plusa"

# (sparc/v8 [SS5+]     egcs)
OPTS_EGCS_NONULTRA_SPARC="$OPTS_EGCS -mtune=supersparc -DASM_SPARC"

#-- SUN 68k

OPTS_GCC_SUN68K="$OPTS_GCC -O2 -DASM_68K -D_SUN68K_"

#-- MIPS

OPTS_CC_MIPS='-O2 -xansi -DASM_MIPS'
OPTS_GCC_MIPS="$OPTS_GCC -O6 -DASM_MIPS"
OPTS_EGCS_MIPS="$OPTS_EGCS -Os -DASM_MIPS" 

#-- Alpha

OPTS_CC_ALPHA_EV4='-O4 -tune ev4 -inline all'
OPTS_CC_ALPHA_EV5='-O4 -tune ev5 -inline all'
OPTS_CC_ALPHA='-O4 -fast -arch ev56 -tune ev56 -inline all'

OPTS_GCC_ALPHA="$OPTS_GCC -O6 -DASM_ALPHA -static"
OPTS_EGCS_ALPHA="$OPTS_EGCS -Os -DASM_ALPHA -static"

#-- HPUX

OPTS_CC_HPUX="$LDFLAGS_CC_HPUX +a1 +O3 -D_HPUX -DASM_HPPA"
LDFLAGS_CC_HPUX='+A +DA2.0'

OPTS_GCC_HPUX="$OPTS_GCC -O6 -DASM_HPPA -static"
OPTS_GCC_HPUX_M68K="$OPTS_GCC -D_HPUX_M68K -static"

#-- DGUX

OPTS_GCC_DGUX="$OPTS_GCC -O6 -D_DGUX -DPIPELINE_COUNT=2 \
	       -DCPU_ID=CPU_88K -DOS_ID=OS_DGUX"

#-- PPC

OPTS_GCC_PPC601="$OPTS_GCC -O6 -DASM_PPC -mcpu=601"
OPTS_GCC_PPC="$OPTS_GCC -O6 -DASM_PPC -mcpu=604"
OPTS_GCC_PPC860="$OPTS_GCC -O6 -DASM_PPC -mcpu=860 -msoft-float"
OPTS_GCC272_PPC="$OPTS_GCC272 -O6 -DASM_PPC -mcpu=604"
OPTS_GCC272_PPC860="$OPTS_GCC272 -O6 -DASM_PPC -mcpu=860 -msoft-float"
OPTS_GCC_POWER="$OPTS_GCC -O6 -DASM_POWER -mcpu=power"

OPTS_EGCS_PPC601="$OPTS_EGCS -O6 -DASM_PPC -mcpu=601"
OPTS_EGCS_PPC604="$OPTS_EGCS -O6 -DASM_PPC -mcpu=604"
OPTS_EGCS_PPC860="$OPTS_EGCS -O6 -DASM_PPC -mcpu=860 -msoft-float"
OPTS_EGCS_POWER="$OPTS_EGCS -O6 -DASM_POWER -mcpu=power"

OPTS_XLC_PPC601="$OPTS_XLC -qarch=ppc -qtune=601 -D_AIX -D_ARCH_PPC"
OPTS_XLC_PPC="$OPTS_XLC -qarch=ppc -qtune=604 -D_AIX -D_ARCH_PPC"
OPTS_XLC_POWER="$OPTS_XLC -qarch=pwr -qtune=pwr -D_AIX -D_ARCH_PWR"
OPTS_XLC_POWER2="$OPTS_XLC -qarch=pwr2 -qtune=pwr2 -D_AIX -D_ARCH_PWR2"

OPTS_XLC3_PPC601="$OPTS_XLC3 -qarch=ppc -qtune=601 -D_AIX -D_ARCH_PPC"
OPTS_XLC3_POWER="$OPTS_XLC3 -qarch=pwr -qtune=pwr -D_AIX -D_ARCH_PWR"

#-- X86

OPTS_GCC_X86="$OPTS_GCC -O6 -m486 -DASM_X86"
OPTS_GCC272_X86="$OPTS_GCC272 -O6 -m486 -DASM_X86"

OPTS_EGCS_X86="$OPTS_EGCS -mcpu=pentiumpro -malign-functions=4 -malign-loops=4 -DASM_X86"

#-- DYNIX

OPTS_EPC_DYNIX="-relax -D_SEQUENT_"

OPTS_GCC_DYNIX="-D_SEQUENT_"

#-- NeXT

OPTS_GCC_M68K="$OPTS_GCC -m68040 -DASM_68K"
OPTS_GAS_M68K="-v -V --register-prefix-optional -m68040"

OPTS_GCC_M68030K="$OPTS_GCC -m68030 -DASM_68K"
OPTS_GAS_M68030K="-v -V --register-prefix-optional -m68030"

OPTS_NEXT_M68K="$OPTS_GCC -O6 -m68040 -DASM_68K"
OPTS_NEXT_SPARC="$OPTS_GCC -O6 -DASM_SPARC -D_OLD_NEXT_"
OPTS_NEXT_HPPA="$OPTS_GCC -O6 -DASM_HPPA -D_OLD_NEXT_"

#-- ARM

OPTS_GCC_ARM="$OPTS_GCC $OPT_FLAGS -DARM"

#-- NetBSD/vax

OPTS_GCC_VAX="$OPTS_GCC272 -O2 -DASM_VAX"
OPTS_EGCS_VAX="$OPTS_EGCS -O2 -DASM_VAX"

#-- OS/390

#-D__STRING_CODE_SET__="ISO8859-1"
OPTS_OS390="-D_ALL_SOURCE"

#-- UltraSparc
#
# See Also: platforms/ultrasparc/s_paramaters.h
#
OPTS_DES_ULTRA_C="-DDES_ULTRA -DINLINE=' ' -DIN_DCTI_CLIENT \
		  -DLOW_WORD_VALID -DMANUAL_REGISTER_ALLOCATION -DBIT_32 \
		  -DKWAN_LOOP_SLICE='unsigned long' -Iplatforms/ultrasparc"
# a bit hairy, isn't it ? ;-)
OPTS_DES_ULTRA_ASM="-DASM_SPARC -DIN_DCTI_CLIENT \
		    -DDES_ULTRA -DINLINE=inline -DFULL_64_BIT_VALID -DASM \
		    -DMANUAL_REGISTER_ALLOCATION -DDO_FLOAT_PIPE -DBIT_64 \
		    -DUSE_IDENTICAL_FLOAT_REGISTERS -DUSE_64_BIT_SENTINEL \
		    -DKWAN_LOOP_SLICE='unsigned long' -Iplatforms/ultrasparc \
		    -mtune=ultrasparc -fforce-mem -fstrict-aliasing\
		    -Wall \
		    -mv8plus -mvis -mepilogue -Wa,-xarch=v8plusa -mflat \
		    -Os -fcall-used-g4 -fcall-used-g5 -fcall-used-g6"

#-- MMX/DES

OPTS_DES_MMX="-DMMX_BITSLICER -DKWAN -DMEGGS -DBIT_64"

#
# Source C++ files making up the base client code
#
COMMON_SRCS="common/client.cpp \
	     common/problem.cpp \
	     common/autobuff.cpp \
	     common/iniread.cpp \
	     common/network.cpp \
	     common/mail.cpp \
	     common/convdes.cpp \
	     common/clicdata.cpp \
	     common/clirate.cpp \
	     common/clisrate.cpp \
	     common/clitime.cpp \
	     common/disphelp.cpp \
	     common/clievent.cpp \
	     common/cpucheck.cpp \
	     common/pathwork.cpp \
	     common/cliident.cpp \
	     common/logstuff.cpp \
	     common/triggers.cpp \
	     common/selcore.cpp \
	     common/netinit.cpp \
	     common/cmdline.cpp \
	     common/selftest.cpp \
	     common/bench.cpp \
	     common/probman.cpp \
	     common/clirun.cpp \
	     common/probfill.cpp \
	     common/pollsys.cpp \
	     common/setprio.cpp \
	     common/console.cpp \
	     common/modereq.cpp \
	     common/confmenu.cpp \
	     common/confrwv.cpp \
	     common/confopt.cpp \
	     common/checkpt.cpp \
	     common/util.cpp \
	     common/random.cpp \
	     common/buffbase.cpp \
	     common/base64.cpp \
	     common/netres.cpp"

#
# Source files making up the RC5 core code
#
XLC_LINTILLA_ASMS="rc5/ppc/crunch_lintilla.ppcxlc.s \
		   rc5/ppc/crunch_allitnil_552.ppcxlc.s"

RC5PPC_SRCS="rc5/ppc/crunch_lintilla_296.ppc.s \
	     rc5/ppc/crunch_allitnil_552.ppc.s \
	     rc5/ppc/crunch_ppc_wrappers.cpp"

NASM_RC5X86_SRCS="rc5/x86/nasm/rg486.asm \
		  rc5/x86/nasm/rc5-rgk5.asm \
		  rc5/x86/nasm/brfp5.asm \
		  rc5/x86/nasm/rc5-rgk6.asm \
		  rc5/x86/nasm/rc5-rgp6.asm \
		  rc5/x86/nasm/rg6x86.asm \
		  rc5/x86/nasm/rc5mmx.asm"

RC5X86_SRCS="rc5/x86/rc5-486-rg.cpp \
	     rc5/x86/rc5-6x86-rg.cpp \
	     rc5/x86/rc5p5brf.cpp \
	     rc5/x86/rc5-p6-rg.cpp \
	     rc5/x86/rc5-k5-rg.cpp \
	     rc5/x86/rc5-k6-rg.cpp"

#
# Source files making up the DES core code
#
KWAN_SLICE_SRCS1="des/deseval.cpp des/des-slice.cpp des/sboxes-kwan.cpp"
KWAN_SLICE_SRCS2="des/deseval.cpp des/des-slice.cpp des/sboxes-kwan2.cpp"
KWAN_SLICE_SRCS3="des/deseval.cpp des/des-slice.cpp des/sboxes-kwan3.cpp"
KWAN_SLICE_SRCS4="des/deseval.cpp des/des-slice.cpp des/sboxes-kwan4.cpp"

MEGGS_SLICE_SRCS1="des/deseval-meggs2.cpp des/des-slice-meggs.cpp"
MEGGS_SLICE_SRCS2="des/deseval-meggs3.cpp des/des-slice-meggs.cpp"

DWORZ_SLICE_SRCS="des/alpha-asm/deseval-dworz3.S des/alpha-asm/des-slice-dworz.cpp"

DESX86_SRCS="des/des-x86.cpp"

DESMMX_SRCS="des/des-slice-meggs.cpp"
NASM_DESMMX_SRCS="des/mmx-bitslice/deseval-mmx.asm"


DESULTRA_SRCS_C="des/ultrasparc/des-slice-ultrasparc.cpp \
		 des/ultrasparc/simple.c \
		 des/ultrasparc/des_ultra_crunch.c \
		 des/ultrasparc/kwan_from_to.c \
		 des/ultrasparc/do_all.c \
		 des/ultrasparc/do_all_fancy.c \
		 des/ultrasparc/do_s1.c \
		 des/ultrasparc/do_s1_s3.c \
		 des/ultrasparc/do_s2.c \
		 des/ultrasparc/do_s3.c \
		 des/ultrasparc/do_s4.c \
		 des/ultrasparc/do_s5.c \
		 des/ultrasparc/do_s6.c \
		 des/ultrasparc/do_s7.c \
		 des/ultrasparc/do_s8.c"
DESULTRA_SRCS_ASM="des/ultrasparc/des-slice-ultrasparc.cpp \
		   des/ultrasparc/des_ultra_crunch.c"

#
# Source files making up the OGR core code
#
OGR_ANSI_SRCS="ogr/ogr.cpp ogr/crc32.cpp ogr/choosedat.cpp"
#if adding OGR, also -DHAVE_OGR_CORES

#
# Source files making up the CSC core code
#
CSC_ANSI_SRCS="csc/convcsc.cpp csc/csc-common.cpp \
               csc/csc-1k-i.cpp csc/csc-1k.cpp \
               csc/csc-6b-i.cpp csc/csc-6b.cpp"
#if adding CSC, also -DHAVE_CSC_CORES

CSC_ASM_SRCS="csc/x86/convcsc.asm  \
		csc/x86/csc-1k-i.asm \
		csc/x86/csc-1k.asm \
		csc/x86/csc-6b-i.asm \
		csc/x86/csc-6b.asm \
		csc/x86/csc-comm.asm"

#
# Define the default compilation options
#
TARGET_CC="g++"
TARGET_CCFLAGS="$OPTS_GCC"
TARGET_LDFLAGS=""
TARGET_LIBS=""
TARGET_AS="as"
TARGET_NASM="nasm"
TARGET_NASM_FMT="elf"
TARGET_ASFLAGS=""
TARGET_STRIP="strip"
TARGET_CP="cp"

TARGET_ADDSRCS=""
TARGET_ADDASMS=""
TARGET_ADDNASMS=""
TARGET_ADDOBJS=""

#
# Define characters to delete to form a safe name
#     [WARNING: this is a GNU-ism]
DELETECHARS="'[:punct:]'"

#
# Determine the platform specific options for this target
#
case "$1" in
###### MIPS based platforms
    *mips-cobalt)	# For Cobalt Qube - doesn't work yet - Peter
	RC5CORECOPY="rc5/mips-crunch.cpp"
	TARGET_CC="gcc"
	TARGET_CCFLAGS="$OPTS_GCC_MIPS -mcpu=r3000 \
			-DMULTITHREAD \
			-DBIT_32 -DKWAN -DMEGGS -DMIPS_CRUNCH=1"
	TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2"
	TARGET_LIBS="-lpthread"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *mips-sni-gcc)	   #For MIPS SINIX
	RC5CORECOPY="rc5/mips/mips-crunch.cpp"
	TARGET_CCFLAGS="$OPTS_GCC_MIPS -Dsinix \
			-DPIPELINE_COUNT=2 -DMIPS_CRUNCH=1"
	TARGET_LIBS="-lsocket -lnsl -lc -L/usr/ucblib -lucb"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *mips-cc-64)	     # For 64bit MIPS processors
	#  mips-crunch.cpp doesn't yet compile with CC
	RC5CORECOPY="rc5/ansi/rc5ansi2-rg2.cpp"
	TARGET_CC="CC"
	TARGET_CCFLAGS="$OPTS_CC_MIPS -O3 -r5000 -IPA -64 -mips4 \
			-DPIPELINE_COUNT=2 -DBIT_64 -DKWAN -DMEGGS"
	TARGET_LDFLAGS="-static -64 -IPA -mips4"
	TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *mips5-cc)		# IRIX CC is slower than mips-gcc targets
	#  mips-crunch.cpp doesn't compile with CC
	RC5CORECOPY="rc5/ansi/rc5ansi2-rg2.cpp"
	TARGET_CC="CC"
	TARGET_CCFLAGS="$OPTS_CC_MIPS -D_irix5_ \
			-DPIPELINE_COUNT=2 -DBIT_32 -DKWAN -DMEGGS"
	TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *mips-cc)		# IRIX CC is slower than mips-gcc targets
	#  mips-crunch.cpp doesn't compile with CC
	RC5CORECOPY="rc5/ansi/rc5ansi2-rg2.cpp"
	TARGET_CC="CC"
	TARGET_LDFLAGS="-n32"
	TARGET_CCFLAGS="$OPTS_CC_MIPS -n32 \
			-DMULTITHREAD -DPIPELINE_COUNT=2 \
			-DBIT_32 -DKWAN -DMEGGS "
	TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2"
	TARGET_LIBS="-lpthread"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *mips-gcc-irix5-crunch)	# faster than mips-gcc for IRIX
        DELETECHARS="'/.\$\-'"
	RC5CORECOPY="rc5/mips/mips-crunch.cpp"
	TARGET_CCFLAGS="$OPTS_GCC_MIPS -D_irix5_ \
			-DMIPS_CRUNCH=1 -D_CPU_32BIT_ -DBIT_32 -DKWAN -DMEGGS"
	TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *mips-egcs-crunch-64)     #needs very recent egcs
	RC5CORECOPY="rc5/mips/mips-crunch.cpp"
	TARGET_CCFLAGS="$OPTS_EGCS_MIPS -mabi=64 \
			-DMULTITHREAD -DPIPELINE_COUNT=2 \
			-DMIPS_CRUNCH=1 -DBIT_64 -DKWAN -DMEGGS"
	TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2"
	TARGET_LIBS="-lpthread"
	TARGET_LDFLAGS="-mabi=64"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *mips-egcs-crunch)	# faster than mips-gcc for IRIX
	RC5CORECOPY="rc5/mips/mips-crunch.cpp"
	TARGET_CCFLAGS="$OPTS_EGCS_MIPS -mabi=n32 \
			-DMULTITHREAD -DPIPELINE_COUNT=2 \
			-DMIPS_CRUNCH=1 -DBIT_32 -DKWAN -DMEGGS"
	TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2"
	TARGET_LIBS="-lpthread"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *mips-irix)     # [ivo] generic mips-irix target
        DELETECHARS="'/.\$\-'"
        RC5CORECOPY="rc5/mips/mips-crunch.cpp"
        TARGET_CC="gcc"
        TARGET_CCFLAGS="$OPTS_GCC_MIPS   \
                        -DHAVE_DES_CORES -DHAVE_CSC_CORES \
                        -DMIPS_CRUNCH=1 -DBIT_32 -DKWAN -DMEGGS"
        TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2 $CSC_ANSI_SRCS"
        #TARGET_LIBS="-lpthread"
        #TARGET_LDFLAGS="-mips3"
	TARGET_STRIP="touch"
	TARGET_TARBALL="mips-irix5"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
        ;;


    *mips-gcc-ultrix)	# For mips based DEC Ultrix machines
	DELETECHARS="'/.\$\-'"
	RC5CORECOPY="rc5/ansi/rc5ansi2-rg.cpp"
	TARGET_CCFLAGS="$OPTS_GCC_MIPS -DPIPELINE_COUNT=2 \
			-DBIT_32 -DKWAN -DMEGGS"
	TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;


###### HPUX

    *hpux-hppa-CC)
	RC5CORECOPY="rc5/parisc/parisc.cpp"
	TARGET_CC="CC"
	TARGET_CCFLAGS="-DPIPELINE_COUNT=2 \
			-DBIT_32 -DKWAN -DMEGGS"
	TARGET_ADDSRCS="rc5/parisc/parisc.s $MEGGS_SLICE_SRCS2"
	TARGET_LDFLAGS="$LDFLAGS_CC_HPUX"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

   *hpux-hppa-gcc-nomt)  # [ivo]
        #DELETECHARS="'/.\$\-'"
        RC5CORECOPY="rc5/parisc/parisc.cpp"
        TARGET_CCFLAGS="$OPTS_GCC_HPUX  \
                        -DHAVE_CSC_CORES -DHAVE_DES_CORES \
                        -DBIT_32 -DKWAN -DMEGGS"
        TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2 $CSC_ANSI_SRCS"
        TARGET_ADDASMS="rc5/parisc/parisc.s"
        #TARGET_LDFLAGS="-lpthread"
        TARGET_TARBALL="hpux1020-hppa11"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
        ;;

    *hpux-m68k-gcc)
	RC5CORECOPY="rc5/ansi/rc5ansi1-b2.cpp"
	TARGET_CCFLAGS="$OPTS_GCC_HPUX_M68K -DPIPELINE_COUNT=1 \
			-DBIT_32 -DKWAN"
	TARGET_LDFLAGS="-static"
	TARGET_AFLAGS="$OPTS_GAS_M68030K"
	TARGET_ADDASMS="rc5/crunch.68k.gcc.s"
	TARGET_ADDSRCS="$SLICE_SRCS3"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	echo $TARGET_CCFLAGS
	;;

###### DGUX (Data General Unix)
    *dgux-gcc)
	RC5CORECOPY="rc5/ansi/rc5ansi2-rg.cpp"
	TARGET_CC="/usr/local/bin/g++"
	TARGET_CCFLAGS="$OPTS_GCC_DGUX"
	TARGET_LDFLAGS="-static"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *dgux-gcc-mt)
	RC5CORECOPY="rc5/ansi/rc5ansi2-rg.cpp"
	TARGET_CC="/usr/local/bin/g++"
	TARGET_CCFLAGS="$OPTS_GCC_DGUX -D_POSIX4A_DRAFT6_SOURCE -DMULTITHREAD"
	TARGET_LIBS="-lthread"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

###### Sparc/UltraSparc or Sun/SunOS/Solaris

    *sparc-openbsd)                   # snake
	RC5CORECOPY="rc5/ansi/rc5ansi2-rg.cpp"
	TARGET_CCFLAGS="$OPTS_GCC272_SPARC1 -DBIT_32 -DKWAN -DMEGGS"
	TARGET_LDFLAGS="-static"
	#TARGET_ADDSRCS="$KWAN_SLICE_SRCS3"
	TARGET_ADDSRCS="des/deseval-meggs2-2.cpp des/des-slice-meggs.cpp"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *sparc-linux)
	RC5CORECOPY="rc5/ansi/rc5ansi2-rg.cpp"
	TARGET_CCFLAGS="$OPTS_GCC_SPARC -D__showids__ \
			-DPIPELINE_COUNT=2 -DLURK \
			-DBIT_32 -DKWAN -DMEGGS"
	TARGET_ADDSRCS="common/lurk.cpp \
			des/deseval-meggs2-2.cpp des/des-slice-meggs.cpp"
	TARGET_LDFLAGS="" #NEVER STATIC FOR GLIBC!!!
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *sparc-linux-mt)
	RC5CORECOPY="rc5/ansi/rc5ansi2-rg.cpp"
	TARGET_CCFLAGS="$OPTS_GCC_SPARC -D__showids__ \
			-DMULTITHREAD -DPIPELINE_COUNT=2 -DLURK \
			-DBIT_32 -DKWAN -DMEGGS"
	TARGET_ADDSRCS="common/lurk.cpp \
			des/deseval-meggs2-2.cpp des/des-slice-meggs.cpp"
	TARGET_LDFLAGS=""  #NEVER STATIC FOR GLIBC!!!
	TARGET_LIBS="-lpthread"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *sparc-linux-mt-egcs)	# [remi]
	TARGET_CC="egcc"
	TARGET_AS="egcc -c"
	RC5CORECOPY="rc5/ansi/rc5ansi2-rg.cpp"
	TARGET_CCFLAGS="$OPTS_EGCS_NONULTRA_SPARC \
			-D__showids__ -DLURK -DMULTITHREAD \
			-DBIT_32 -DKWAN -DMEGGS $CSC_ANSI_CCOPTS"
	TARGET_ADDSRCS="common/lurk.cpp \
			des/deseval-meggs2-2.cpp des/des-slice-meggs.cpp \
			$CSC_ANSI_SRCS"
	TARGET_LIBS="-lpthread"
	TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	TARGET_TARBALL="linux-sparc-elf-mt-glibc2"
	;;

    *sparc-cc)
        DELETECHARS="'/.\$\-'"
	RC5CORECOPY="rc5/ultra/rc5-ultra-crunch.cpp"
	TARGET_CC="cc"
	TARGET_CCFLAGS="$OPTS_CC_SPARC -DPIPELINE_COUNT=1"
	TARGET_LIBS="-lnsl -lsocket"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *sunos-gcc-static)	
	# FIX THIS
        DELETECHARS="'/.\$\-'"
	RC5CORECOPY="rc5/ansi/rc5ansi2-rg.cpp"
	TARGET_CCFLAGS="$OPTS_GCC_SPARC -DPIPELINE_COUNT=2"
	TARGET_LIBS="-static"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *sun3-gcc)
        DELETECHARS="'/.\$\-'"
	TARGET_CCFLAGS="$OPTS_GCC_SUN68K -DPIPELINE_COUNT=1 \
			-DBIT_32 -DKWAN -DMEGGS"
	TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2 rc5/crunch.sun68k.gcc.s"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *sun2-sunos3-gcc)
	TARGET_CCFLAGS="$OPTS_GCC_SUN68K -D_SUNOS3_ \
			-DPIPELINE_COUNT=1 -DBIT_32 -DKWAN -DMEGGS"
	TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2 rc5/crunch.sun68k.gcc.s"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *m68k-linux-gcc)
	TARGET_CFLAGS="$OPTS_GCC_M68K -DPIPELINE_COUNT=1 -DBIT_32 -DKWAN"
	TARGET_AFLAGS="$OPTS_GAS_M68K"
 	TARGET_ADDSRCS="$KWAN_SLICE_SRCS3"
 	TARGET_ADDASMS="crunch.68k.gcc.s"
 	TARGET_LIBS=""  #NEVER STATIC FOR GLIBC!!!
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    #####

    *sparc-solaris-gcc-mt-old)	# slower rc5, slower des
        DELETECHARS="'/.\$\-'"
	RC5CORECOPY="rc5/ansi/rc5ansi2-rg.cpp"
	TARGET_CC="gcc"
	TARGET_CCFLAGS="$OPTS_GCC_SPARC -Dsolaris \
			-DMULTITHREAD \
			-DULTRA_CRUNCH=1 -DBIT_32 -DKWAN"
	TARGET_ADDSRCS="$KWAN_SLICE_SRCS3"
	TARGET_LIBS="-lnsl -lsocket -ldl -lpthread"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *sparc-solaris-gcc-crunch-mt-old)    # fastest rc5, slower des
        DELETECHARS="'/.\$\-'"
	RC5CORECOPY="rc5/ultra/rc5-ultra-crunch.cpp"
	TARGET_CC="gcc"
	TARGET_CCFLAGS="$OPTS_GCC_SPARC -Dsolaris \
			-DMULTITHREAD \
			-DULTRA_CRUNCH=1 -DBIT_32 -DKWAN"
	TARGET_ADDSRCS="$KWAN_SLICE_SRCS3"
	TARGET_LIBS="-lnsl -lsocket -ldl -lpthread"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *sparc-solaris-gcc-nomt)   # [ivo solaris/nonultra/nomt] fastest rc5 & des for ultra
        #DELETECHARS="'/.\$\-'"
        RC5CORECOPY="rc5/ultra/rc5-ultra-crunch.cpp"
        TARGET_CC="gcc -pipe -fpermissive" 
        TARGET_CCFLAGS="$OPTS_GCC_SPARC -Dsolaris \
                        -DHAVE_CSC_CORES -DHAVE_DES_CORES \
                        -DULTRA_CRUNCH=1 -DBIT_32 -DKWAN -DMEGGS"
        TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2 $CSC_ANSI_SRCS"
        TARGET_LIBS="-lnsl -lsocket -ldl"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
        TRAGET_TARBALL="sparc-solaris26-nomt"
        ;;

    *sparc-solaris-gcc)   # [ivo solaris/nonultra/mt] fastest rc5 & des for ultra
        #DELETECHARS="'/.\$\-'"
        RC5CORECOPY="rc5/ultra/rc5-ultra-crunch.cpp"
        TARGET_CC="gcc -pipe -fpermissive"
        TARGET_CCFLAGS="$OPTS_GCC_SPARC -Dsolaris \
                        -DMULTITHREAD \
                        -DHAVE_CSC_CORES -DHAVE_DES_CORES \
                        -DULTRA_CRUNCH=1 -DBIT_32 -DKWAN -DMEGGS"
        TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2 $CSC_ANSI_SRCS"
        TARGET_LIBS="-lnsl -lsocket -ldl -lpthread"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
        TARGET_TARBALL="sparc-solaris26"
        ;;

    *sparc-solaris-gcc-ultra)   # [ivo ultra] fastest rc5 & VIS DES
        #DELETECHARS="'/.\$\-'"
        RC5CORECOPY="rc5/ultra/rc5-ultra-crunch.cpp"
        TARGET_CC="gcc -pipe -fpermissive"
        TARGET_CCFLAGS="$OPTS_DES_ULTRA_ASM -Dsolaris \
                        -DMULTITHREAD -DULTRA_CRUNCH=1 \
                        -DHAVE_CSC_CORES -DHAVE_DES_CORES "
        TARGET_ADDSRCS="$DESULTRA_SRCS_ASM $CSC_ANSI_SRCS"
        TARGET_ADDASMS="des/ultrasparc/simple.handopt.s"
        TARGET_ASFLAGS="$OPTS_AS_ULTRA"   
        TARGET_LIBS="-lnsl -lsocket -ldl -lpthread"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
        TARGET_TARBALL="ultrasparc-solaris26"
        ;;

    #####

    *x86-solaris)    # gcc, nomt, dynamic
	DELETECHARS="'/.\$\-'"
	TARGET_CCFLAGS="$OPTS_GCC_X86 -Dsolaris $OPTS_DES_MMX -DMMX_RC5"
	TARGET_ADDSRCS="$DESX86_SRCS $DESMMX_SRCS $KWAN_SLICE_SRCS4"
	TARGET_ADDASMS="des/brydgnu/bdeslow.S platforms/x86ident.S des/brydgnu/p1bdespro.S"
	TARGET_ADDNASMS="$NASM_RC5X86_SRCS $NASM_DESMMX_SRCS"
	TARGET_LIBS="-lnsl -lsocket -ldl"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *x86-solaris-mt)    # gcc, mt, dynamic
	DELETECHARS="'/.\$\-'"
	TARGET_CCFLAGS="$OPTS_GCC_X86 -Dsolaris $OPTS_DES_MMX -DMMX_RC5 \
			-DMULTITHREAD"
	TARGET_ADDSRCS="$DESX86_SRCS $DESMMX_SRCS $KWAN_SLICE_SRCS4"
	TARGET_ADDASMS="des/brydgnu/bdeslow.S des/brydgnu/bbdeslow.S \
			platforms/x86ident.S \
			des/brydgnu/p1bdespro.S des/brydgnu/p2bdespro.S"
	TARGET_ADDNASMS="$NASM_RC5X86_SRCS $NASM_DESMMX_SRCS"
	TARGET_LIBS="-lnsl -lsocket -ldl -lpthread"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

###### Alpha

    *alpha-gcc-digital_unix-mt)
	TARGET_CC="g++"
	TARGET_BASE_CCFLAGS="-Wa,-02 $OPTS_GCC -O6 -DPIPELINE_COUNT=2 -DBIT_64 -DMEGGS -DKWAN -DDEC_UNIX_CPU_SELECT -DMULTITHREAD -D_THREAD_SAFE -D_REENTRANT -DCORES_SUPPORT_SMP -Ddes_alpha_osf_ev5=des_alpha_osf_ev4"
	TARGET_CCFLAGS="-mcpu=ev4 $TARGET_BASE_CCFLAGS"
	TARGET_EV5_CCFLAGS="-mcpu=ev5 $TARGET_BASE_CCFLAGS"
	TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2 rc5/alphaasm/rc5-digital-unix-alpha-ev4.cpp"
	TARGET_DIGITAL_UNIX_EV5_SRCS="rc5/alphaasm/rc5-digital-unix-alpha-ev5.cpp"
	TARGET_LIBS="-lpthread -lexc"
	TARGET_OS=DIGITAL_UNIX
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *alpha-gcc-digital_unix-static)
	TARGET_CC="g++"
	TARGET_BASE_CCFLAGS="-Wa,-02 $OPTS_GCC -O6 -DPIPELINE_COUNT=2 -DBIT_64 -DMEGGS -DKWAN -DDEC_UNIX_CPU_SELECT"
	TARGET_CCFLAGS="-mcpu=ev4 $TARGET_BASE_CCFLAGS"
	TARGET_EV5_CCFLAGS="-mcpu=ev5 $TARGET_BASE_CCFLAGS"
	TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2 rc5/alphaasm/rc5-digital-unix-alpha-ev4.cpp"
	TARGET_DIGITAL_UNIX_EV5_SRCS="rc5/alphaasm/rc5-digital-unix-alpha-ev5.cpp des/alpha-asm/deseval-dworz3.S des/alpha-asm/des-slice-dworz.cpp"
	TARGET_LIBS="-static"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	TARGET_OS=DIGITAL_UNIX
	;;


    *alpha-netbsd)
	TARGET_CC="g++"
	TARGET_CCFLAGS="$OPTS_EGCS_ALPHA -DBIT_64 -DKWAN -DDWORZ"
	TARGET_ADDSRCS="$DWORZ_SLICE_SRCS \
			rc5/alpha/axp-bmeyer.cpp \
			rc5/alpha/axp-bmeyer.s"
	TARGET_LDFLAGS="-static"
	TARGET_LIBS="-ltermcap"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *alpha-openbsd)                  # snake
	TARGET_AS="g++ -c"
	TARGET_CC="g++"
	TARGET_CCFLAGS="$OPTS_GCC_ALPHA -DBIT_64 -DKWAN -DDWORZ"
	TARGET_ADDSRCS="$DWORZ_SLICE_SRCS rc5/alpha/axp-bmeyer.cpp"
#            rc5/alpha/axp-bmeyer.s"
	TARGET_ADDASMS="rc5/alpha/axp-bmeyer.s"
	TARGET_LDFLAGS="-static"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *alpha-linux)                     # jlawson
	TARGET_AS="as"
	TARGET_CC="g++"
	TARGET_CCFLAGS="$OPTS_GCC_ALPHA -DBIT_64 -DKWAN -DDWORZ \
			-DHAVE_CSC_CORES"
	TARGET_ADDSRCS="$DWORZ_SLICE_SRCS rc5/alpha/axp-bmeyer.cpp \
			${CSC_ANSI_SRCS}"
	TARGET_ADDASMS="rc5/alpha/axp-bmeyer.s"
	TARGET_LDFLAGS=""  #NEVER STATIC FOR GLIBC!!!
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	TARGET_TARBALL="linux-alpha-glibc2"
	;;

    *alpha-linux-egcs)                     # daa
	TARGET_AS="as"
	TARGET_CC="g++"
	TARGET_CCFLAGS="$OPTS_EGCS_ALPHA -DBIT_64 -DKWAN -DDWORZ"
	TARGET_ADDSRCS="$DWORZ_SLICE_SRCS rc5/alpha/axp-bmeyer.cpp"
	TARGET_ADDASMS="rc5/alpha/axp-bmeyer.s"
	TARGET_LDFLAGS=""  #NEVER STATIC FOR GLIBC!!!
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

###### PowerPC/POWER

  ### generic targets

    *ppc-601-linux-egcs)		# [cramer] PPC 601 target
	TARGET_CC="gcc -pipe -g"
	TARGET_CCFLAGS="$OPTS_EGCS_PPC601 \
			-DBIT_32 -DMEGGS -DKWAN"
	TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2 \
			$RC5PPC_SRCS"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *ppc-601-linux-mt-egcs)		# [cramer] PPC 601-mt target
	TARGET_CC="gcc -pipe -g"
	TARGET_CCFLAGS="$OPTS_EGCS_PPC601 \
			-DMULTITHREAD -DBIT_32 -DMEGGS -DKWAN"
	TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2 \
			$RC5PPC_SRCS"
	TARGET_LIBS="-lpthread"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *ppc-604-linux-egcs)		# [cramer] PPC 604 target
	TARGET_CC="gcc -pipe -g"
	TARGET_CCFLAGS="$OPTS_EGCS_PPC604 \
			-DBIT_32 -DMEGGS -DKWAN"
	TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2 \
			$RC5PPC_SRCS"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *ppc-604-linux-mt-egcs)		# [cramer] PPC 604-mt target
	TARGET_CC="gcc -pipe -g"
	TARGET_CCFLAGS="$OPTS_EGCS_PPC604 \
			-DMULTITHREAD -DBIT_32 -DMEGGS -DKWAN"
	TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2 \
			$RC5PPC_SRCS"
	TARGET_LIBS="-lpthread"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *ppc-860-linux-egcs)		# [cramer] PPC 860 target
	TARGET_CC="gcc -pipe -g"
	TARGET_CCFLAGS="$OPTS_EGCS_PPC860 \
			-DBIT_32 -DMEGGS -DKWAN"
	TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2 \
			$RC5PPC_SRCS"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *ppc-860-linux-mt-egcs)		# [cramer] PPC 860-mt target
	TARGET_CC="gcc -pipe -g"
	TARGET_CCFLAGS="$OPTS_EGCS_PPC860 \
			-DMULTITHREAD -DBIT_32 -DMEGGS -DKWAN"
	TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2 \
			$RC5PPC_SRCS"
	TARGET_LIBS="-lpthread"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *ppc-gcc)		# [myshkin] generic PPC target
	TARGET_CCFLAGS="$OPTS_GCC_PPC \
			-DBIT_32 -DMEGGS -DKWAN"
	TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2 \
			$RC5PPC_SRCS"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *ppc860-gcc)	# [myshkin] PPC 821/860 target
	TARGET_CCFLAGS="$OPTS_GCC_PPC \
			-DBIT_32 -DMEGGS -DKWAN"
	TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2 \
			$RC5PPC_SRCS"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *ppc-gcc272)	# [myshkin] generic PPC target, gcc 2.7.2
	TARGET_CCFLAGS="$OPTS_GCC272_PPC \
			-DBIT_32 -DMEGGS -DKWAN"
	TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2 \
			$RC5PPC_SRCS"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *ppc860-gcc272)	# [myshkin] PPC 821/860 target, gcc 2.7.2
	TARGET_CCFLAGS="$OPTS_GCC272_PPC860 \
			-DBIT_32 -DMEGGS -DKWAN"
	TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2 \
			$RC5PPC_SRCS"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

  ### AIX PPC targets
	# classes are buggy with AIX !

    *aix4-ppc-xlc)	 # This is the fastest build for AIX 4.x PPC machines
	DELETECHARS="'/.\$\-'"
	TARGET_CC="xlC"
	TARGET_CCFLAGS="$OPTS_XLC_PPC -DBIT_32 -DMEGGS -DKWAN"
	TARGET_ADDASMS="$XLC_LINTILLA_ASMS"
	TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2"
	TARGET_LIBS="-lCns"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *aix4-ppc601-xlc)      # AIX 4.x PPC, 601 chip
	DELETECHARS="'/.\$\-'"
	TARGET_CC="xlC"
	TARGET_CCFLAGS="$OPTS_XLC_PPC601 -DBIT_32 -DMEGGS -DKWAN"
	TARGET_ADDASMS="$XLC_LINTILLA_ASMS"
	TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2"
	TARGET_LIBS="-lCns"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *aix32-ppc-xlc)	# AIX 3.2.x PPC
	DELETECHARS="'/.\$\-'"
	TARGET_CC="xlC"
	TARGET_CCFLAGS="$OPTS_XLC3_PPC601 -DBIT_32 -DMEGGS -DKWAN"
	TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2 \
		rc5/ppc/crunch_allitnil_552.ppc.s \
		rc5/ppc/crunch_lintilla_296.ppc.s"
	TARGET_LIBS="-lCns"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *ppc-gcc-aix32)	# AIX 3.2.x gcc [patrick] <patrick@mail4you.de>
	DELETECHARS="'/.\$\-'"
	TARGET_CCFLAGS="$OPTS_GCC_PPC -DBIT_32 -DMEGGS -DKWAN"
	TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2 $RC5PPC_SRCS"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *aix4-ppc-egcs)			# [patrick] <patrick@mail4you.de>
        DELETECHARS="'/.\$\-'"
        TARGET_CCFLAGS="$OPTS_EGCS -D_AIX -mcpu=ppc601 -DASM_PPC -DBIT_32 -DMEGGS -DKWAN"
        TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2 $RC5PPC_SRCS"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
        ;;


  ### AIX POWER targets
        # AIX POWER this one works for all platforms (AIX 3.x, 4.[1-3])!

    *power-aix-gcc)                     # [patrick] <patrick@mail4you.de>
        DELETECHARS="'/.\$\-'"
	TARGET_CCFLAGS="$OPTS_GCC_POWER -D_AIX \
		-DBIT_32 -DMEGGS -DKWAN"
	TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2 rc5/ansi/rc5ansi_2-rg.cpp"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *power-aix-egcs)                     # [patrick] <patrick@mail4you.de>
        DELETECHARS="'/.\$\-'"
        TARGET_CCFLAGS="$OPTS_EGCS -DASM_POWER -mcpu=power -D_AIX \
		-DBIT_32 -DMEGGS -DKWAN"
        TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2 rc5/ansi/rc5ansi-2-rg.cpp"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
        ;;

        #new all in one AIX target
    *aixall-egcs)                       # [patrick] <patrick@mail4you.de>
        # WARNING: the code will show a PPC CPU even though also POWER
        # CPUs are supported !
        DELETECHARS="'/.\$\-'"
	AIXALL=TRUE
        TARGET_CCFLAGS="$OPTS_EGCS -mcpu=common -D_AIX -D_AIXALL \
                        -DBIT_32 -DMEGGS -DKWAN"
        TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2 $RC5PPC_SRCS \
                rc5/ansi/rc5ansi_2-rg.cpp "
        AIXPPC601FLAGS="$OPTS_EGCS_PPC601 -D_AIX -DBIT32 -DMEGGS -DKWAN"
        AIXPPC604FLAGS="$OPTS_EGCS_PPC601 -D_AIX -DBIT32 -DMEGGS -DKWAN"
        AIXPOWERFLAGS="$OPTS_EGCS_POWER -D_AIX -DBIT32 -DMEGGS -DKWAN"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
        ;;


###### Intel X86 Linux platforms

  ### ***RELEASE*** targets - mt for all but libc4, _never_ static for glibc2

    *x86-linux-glibc2)	                   # glibc2
	TARGET_AS="gcc -c"
	TARGET_CC="gcc"
	TARGET_CCFLAGS="$OPTS_EGCS_X86 $OPTS_DES_MMX -DMMX_RC5 -D__showids__ \
			-DMULTITHREAD -DLURK \
			-DHAVE_CSC_CORES -DHAVE_DES_CORES" #-DHAVE_OGR_CORES
	TARGET_LDFLAGS=""  #NEVER STATIC FOR GLIBC!!!
	TARGET_ADDSRCS="common/lurk.cpp \
			$DESX86_SRCS $DESMMX_SRCS $KWAN_SLICE_SRCS4 \
			" #$OGR_ANSI_SRCS
	TARGET_ADDASMS="des/brydgnu/bdeslow.S des/brydgnu/bbdeslow.S \
			platforms/x86ident.S \
			des/brydgnu/p1bdespro.S des/brydgnu/p2bdespro.S"
	TARGET_ADDNASMS="$NASM_RC5X86_SRCS $NASM_DESMMX_SRCS $CSC_ASM_SRCS"
	TARGET_NASM_FMT="elf"
	TARGET_LIBS="-lpthread"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
        TARGET_TARBALL="linux-x86-glibc2"
	;;

    *x86-linux-glibc2-static)	 # glibc2 static for b0rken RH50
	TARGET_AS="gcc -c"
	TARGET_CC="gcc"
	TARGET_CCFLAGS="$OPTS_EGCS_X86 $OPTS_DES_MMX -DMMX_RC5 -D__showids__ \
			-DMULTITHREAD -DLURK \
			-DHAVE_CSC_CORES -DHAVE_DES_CORES" #-DHAVE_OGR_CORES
	TARGET_LDFLAGS="-static"
	TARGET_ADDSRCS="common/lurk.cpp \
			$DESX86_SRCS $DESMMX_SRCS $KWAN_SLICE_SRCS4 \
			" #$OGR_ANSI_SRCS
	TARGET_ADDASMS="des/brydgnu/bdeslow.S des/brydgnu/bbdeslow.S \
			platforms/x86ident.S \
			des/brydgnu/p1bdespro.S des/brydgnu/p2bdespro.S"
	TARGET_ADDNASMS="$NASM_RC5X86_SRCS $NASM_DESMMX_SRCS $CSC_ASM_SRCS"
	TARGET_NASM_FMT="elf"
	TARGET_LIBS="-lpthread"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
        TARGET_TARBALL="linux-x86-glibc2-static-redhat50"
	;;

    *x86-linux-libc5)	                   # libc5
	TARGET_AS="gcc -c"
	TARGET_CC="gcc"
	TARGET_CCFLAGS="$OPTS_EGCS_X86 $OPTS_DES_MMX -DMMX_RC5 -D__showids__ \
			-DMULTITHREAD -DSMC -DLURK \
			-DHAVE_CSC_CORES -DHAVE_DES_CORES"  #-DHAVE_OGR_CORES
	TARGET_LDFLAGS="-static -Xlinker -omagic"
	TARGET_ADDSRCS="rc5/x86/rc5-486-smc-rg.cpp common/lurk.cpp \
			$DESX86_SRCS $DESMMX_SRCS $KWAN_SLICE_SRCS4 \
			" #$OGR_ANSI_SRCS
	TARGET_ADDASMS="des/brydgnu/bdeslow.S des/brydgnu/bbdeslow.S \
			platforms/x86ident.S \
			des/brydgnu/p1bdespro.S des/brydgnu/p2bdespro.S"
	TARGET_ADDNASMS="$NASM_RC5X86_SRCS $NASM_DESMMX_SRCS $CSC_ASM_SRCS"
	TARGET_NASM_FMT="elf"
	TARGET_LIBS="-lpthread"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
        TARGET_TARBALL="linux-x86-libc5"
	;;

    *x86-linux-libc4)	                    # libc4
	TARGET_AS="gcc -c"
	TARGET_CC="gcc"
	TARGET_CCFLAGS="$OPTS_GCC_X86 $OPTS_DES_MMX -DMMX_RC5 \
			-D__showids__ -DSMC -DLURK \
			-DHAVE_CSC_CORES -DHAVE_DES_CORES"  #-DHAVE_OGR_CORES
	TARGET_LDFLAGS="-static -Xlinker -omagic"
	TARGET_ADDSRCS="rc5/x86/rc5-486-smc-rg.cpp common/lurk.cpp \
			$DESX86_SRCS $DESMMX_SRCS $KWAN_SLICE_SRCS4 \
			" #$OGR_ANSI_SRCS
	TARGET_ADDASMS="des/brydgnu/bdeslow.S des/brydgnu/bbdeslow.S \
			platforms/x86ident.S \
			des/brydgnu/p1bdespro.S des/brydgnu/p2bdespro.S"
	TARGET_ADDNASMS="$NASM_RC5X86_SRCS $NASM_DESMMX_SRCS $CSC_ASM_SRCS"
        TARGET_NASM_FMT="aout"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
        TARGET_TARBALL="linux-x86-libc4"
	;;

    ## *** TEST/DEBUG *** target

    *x86-linux-debug)	              # debug
	TARGET_AS="gcc -c"
	TARGET_CC="gcc -g"
	TARGET_CCFLAGS="$OPTS_GCC_X86 $OPTS_DES_MMX -DMMX_RC5 \
			-D__showids__ -DSMC -DMULTITHREAD -DLURK \
			-DHAVE_CSC_CORES -DHAVE_DES_CORES"  #-DHAVE_OGR_CORES
	TARGET_LDFLAGS="-Xlinker -omagic"
	TARGET_ADDSRCS="rc5/x86/rc5-486-smc-rg.cpp common/lurk.cpp \
			$DESX86_SRCS $DESMMX_SRCS $KWAN_SLICE_SRCS4 \
			" #$OGR_ANSI_SRCS
	TARGET_ADDASMS="des/brydgnu/bdeslow.S des/brydgnu/bbdeslow.S \
			platforms/x86ident.S \
			des/brydgnu/p1bdespro.S des/brydgnu/p2bdespro.S"
	TARGET_ADDNASMS="$NASM_RC5X86_SRCS $NASM_DESMMX_SRCS $CSC_ASM_SRCS"
	TARGET_NASM_FMT="elf"
	TARGET_STRIP="touch"
	TARGET_LIBS="-lpthread"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
        TARGET_TARBALL="linux-x86-debug"
	;;

###### Intel X86 FreeBSD

    *x86-freebsd-mt)         # (obsolete) [dbaker] aout + pthread
        echo "The x86-freebsd-mt target is obsolete. Its identical to the x86-freebsd target."
        echo "(the normal x86-freebsd target is multithreaded on SMP, single threaded on non-SMP)"
        exit 1
 	;;

    *x86-freebsd-mt-elf)    # (obsolete) [dbaker] elf + pthread
        echo "The x86-freebsd-mt-elf target is obsolete. (identical to x86-freebsd-elf)"
        echo "(the normal x86-freebsd target is multithreaded on SMP, single threaded on non-SMP)"
        exit 1
        ;;

    *x86-freebsd4-mt-elf)    # (obsolete) [dbaker] elf + pthread + fbsd4
        echo "The x86-freebsd4-mt-elf target is obsolete. (identical to x86-freebsd-elf)"
        echo "The FreeBSD version is detected at runtime."
        exit 1
        ;;

    *x86-freebsd)             # [dbaker] aout
	TARGET_CC="gcc295"
	TARGET_AS="gcc295 -c"
	TARGET_CCFLAGS="$OPTS_GCC_X86 $OPTS_DES_MMX -DMMX_RC5 -DLURK \
			-DHAVE_CSC_CORES -DHAVE_OGR_CORES -DHAVE_OGR_CORES"
	TARGET_ADDSRCS="common/lurk.cpp $DESX86_SRCS $DESMMX_SRCS \
	                $KWAN_SLICE_SRCS4 $OGR_ANSI_SRCS"
	TARGET_ADDASMS="des/brydgnu/bdeslow.S des/brydgnu/bbdeslow.S \
			platforms/x86ident.S \
			des/brydgnu/p1bdespro.S des/brydgnu/p2bdespro.S"
	TARGET_LIBS="-lc_r"
	TARGET_NASM_FMT="aoutb"
	TARGET_ADDNASMS="$NASM_RC5X86_SRCS $NASM_DESMMX_SRCS $CSC_ASM_SRCS"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
        TARGET_TARBALL="freebsd-x86-aout"
        ;;

    *x86-freebsd-elf)       # [dbaker] elf
	TARGET_CC="gcc295"
	TARGET_AS="gcc295 -c"
	TARGET_CCFLAGS="$OPTS_ECS_X86 $OPTS_DES_MMX -DMMX_RC5 -DLURK \
			-DHAVE_CSC_CORES -DHAVE_OGR_CORES -DHAVE_DES_CORES"
	TARGET_ADDSRCS="common/lurk.cpp $DESX86_SRCS $DESMMX_SRCS \
	                $KWAN_SLICE_SRCS4 $OGR_ANSI_SRCS"
	TARGET_ADDASMS="des/brydgnu/bdeslow.S des/brydgnu/bbdeslow.S \
			platforms/x86ident.S \
			des/brydgnu/p1bdespro.S des/brydgnu/p2bdespro.S"
	TARGET_ADDNASMS="$NASM_RC5X86_SRCS $NASM_DESMMX_SRCS $CSC_ASM_SRCS"
	TARGET_LIBS="-lc_r"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
        TARGET_TARBALL="freebsd-x86-elf"
	;;
 
###### Intel X86 NetBSD

    *x86-netbsd)
	TARGET_AS="g++ -c -DNO_BALIGN"
	TARGET_CCFLAGS="$OPTS_GCC_X86 $OPTS_DES_MMX -DMMX_RC5 \
	                -DHAVE_CSC_CORES -DHAVE_DES_CORES" #-DHAVE_OGR_CORES
	TARGET_LDFLAGS="-static"
	TARGET_ADDSRCS="$DESX86_SRCS $DESMMX_SRCS $KWAN_SLICE_SRCS4 \
	                " #$OGR_ANSI_SRCS
	TARGET_ADDASMS="des/brydgnu/bdeslow.S platforms/x86ident.S \
	                des/brydgnu/p1bdespro.S"
	TARGET_NASM_FMT="aoutb"
	TARGET_ADDNASMS="$NASM_RC5X86_SRCS $NASM_DESMMX_SRCS 
	                 $CSC_ASM_SRCS"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

###### Intel X86 OpenBSD

    *x86-openbsd)
	TARGET_AS="g++ -c"
	TARGET_CCFLAGS="$OPTS_GCC272_X86 $OPTS_DES_MMX -DMMX_RC5 \
	                -DHAVE_CSC_CORES -DHAVE_DES_CORES" #-DHAVE_OGR_CORES
	TARGET_LDFLAGS="-static"
	TARGET_ADDSRCS="$DESX86_SRCS $DESMMX_SRCS $KWAN_SLICE_SRCS4 \
	                " #$OGR_ANSI_SRCS
	TARGET_NASM_FMT="aoutb"
	TARGET_ADDASMS="des/brydgnu/bdeslow.S platforms/x86ident.S \
	                des/brydgnu/p1bdespro.S"
	TARGET_ADDNASMS="$NASM_RC5X86_SRCS $NASM_DESMMX_SRCS \
	                $CSC_ASM_SRCS"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

###### Intel X86 BSDI

    *x86-bsdi)                        # snake
	TARGET_AS="g++ -c -DNO_BALIGN"
	TARGET_CCFLAGS="$OPTS_GCC_X86 -DKWAN $OPTS_DES_MMX -DMMX_RC5 \
	                -DHAVE_CSC_CORES -DHAVE_DES_CORES"  #-DHAVE_OGR_CORES
	TARGET_LDFLAGS="-static"
	TARGET_ADDSRCS="$DESX86_SRCS $DESMMX_SRCS $KWAN_SLICE_SRCS4 \
	                " #$OGR_ANSI_SRCS
	TARGET_ADDASMS="des/brydgnu/bdeslow.S platforms/x86ident.S \
	                des/brydgnu/p1bdespro.S"
	TARGET_NASM_FMT="aoutb"
	TARGET_ADDNASMS="$NASM_RC5X86_SRCS $NASM_DESMMX_SRCS \
	                 $CSC_ASM_SRCS"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
       ;;

    *x86-bsdi4)                       # BSD/OS 4.0 with ELF format -snake
	TARGET_AS="g++ -c"
	TARGET_CCFLAGS="$OPTS_GCC_X86 $OPTS_DES_MMX -DMMX_RC5 \
	                -DHAVE_CSC_CORES -DHAVE_DES_CORES" #-DHAVE_OGR_CORES
	TARGET_LDFLAGS="-static"
	TARGET_ADDSRCS="$DESX86_SRCS $DESMMX_SRCS $KWAN_SLICE_SRCS4 \
	                " #$OGR_ANSI_SRCS
	TARGET_ADDASMS="des/brydgnu/bdeslow.S platforms/x86ident.S \
	                des/brydgnu/p1bdespro.S"
	TARGET_NASM_FMT="elf"
	TARGET_ADDNASMS="$NASM_RC5X86_SRCS $NASM_DESMMX_SRCS \
	                 $CSC_ASM_SRCS"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
       ;;

####### Intel X86 QNX

    *x86-qnx4)
	TARGET_AS="g++ -c -DNO_BALIGN"
	TARGET_CCFLAGS="$OPTS_GCC_X86 $OPTS_DES_MMX -DPIPELINE_COUNT=2"
	TARGET_LDFLAGS="-static"
	TARGET_ADDSRCS="$RC5X86_SRCS $DESX86_SRCS $KWAN_SLICE_SRCS4"
	TARGET_ADDASMS="des/brydgnu/bdeslow.S platforms/x86ident.S \
	                des/brydgnu/p1bdespro.S"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

####### Intel X86 SCO5

    *x86-sco5)
	TARGET_AS="g++ -c"
	TARGET_CCFLAGS="$OPTS_GCC_X86 $OPTS_DES_MMX -DMMX_RC5 \
			-DPIPELINE_COUNT=2 -belf -Dsco5"
	TARGET_LDFLAGS="-static"
	TARGET_ADDSRCS="$DESX86_SRCS $DESMMX_SRCS $KWAN_SLICE_SRCS4"
	TARGET_ADDASMS="des/brydgnu/bdeslow.S platforms/x86ident.S des/brydgnu/p1bdespro.S"
	TARGET_ADDNASMS="$NASM_RC5X86_SRCS $NASM_DESMMX_SRCS"
	TARGET_LIBS="-lsocket"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

####### Intel x86 DYNIX

    *x86-dynix4)
	RC5CORECOPY="rc5/ansi/rc5ansi2-rg2.cpp"
	TARGET_CC="ec++"
	TARGET_CCFLAGS="$OPTS_EPC_DYNIX -DMMX_RC5 -DPIPELINE_COUNT=2 \
			-DBIT_32 -DMEGGS -DKWAN"
	TARGET_ADDSRCS="$MEGGS_SLICE_SRCS1"
	TARGET_ADDNASMS="$NASM_RC5X86_SRCS $NASM_DESMMX_SRCS"
	TARGET_LIBS="-lsocket -lnsl -lseq -L/opt/epc/ec++/lib -lec++"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *x86-dynix2)
	RC5CORECOPY="rc5/ansi/rc5ansi2-rg2.cpp"
	TARGET_CCFLAGS="$OPTS_GCC_DYNIX -DMMX_RC5 -DPIPELINE_COUNT=2 \
			-DBIT_32 -DMEGGS -DKWAN"
	TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2"
	TARGET_ADDNASMS="$NASM_RC5X86_SRCS $NASM_DESMMX_SRCS"
	TARGET_LDFLAGS="-L."
	# Don't panic; -lXbsd is for gettimeofday()
	TARGET_LIBS="-lsocket -linet -lnsl -lXbsd -lseq"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

###### NeXT (x86, m68k, sparc, hppa)

    *x86-next)
	TARGET_AS="gcc -c"
	TARGET_CC="gcc"
	TARGET_CCFLAGS="$OPTS_GCC_X86 $OPTS_DES_MMX -DMMX_RC5 -D_NeXT_ \
			-DPIPELINE_COUNT=2 -DBIT_32"
	TARGET_ADDSRCS="$DESX86_SRCS $DESMMX_SRCS $KWAN_SLICE_SRCS4"
	TARGET_ADDASMS="des/brydgnu/bdeslow.S platforms/x86ident.S des/brydgnu/p1bdespro.S"
	TARGET_ADDNASMS="$RC5X86_SRCS $NASM_DESMMX_SRCS"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *m68k-next-gcc)
	TARGET_CC="gcc"
	TARGET_CCFLAGS="$OPTS_NEXT_M68K -D_NeXT_ -DPIPELINE_COUNT=1 \
			-DBIT_32 -DKWAN"
	TARGET_ADDSRCS="rc5/68k/crunch.68k.gcc.s $KWAN_SLICE_SRCS4"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *m68k-next)
	RC5CORECOPY="rc5/ansi/rc5ansi1-b2.cpp"
	TARGET_CC="cc++"
	TARGET_CCLAGS="$OPTS_NEXT_M68K -arch m68k -D_NeXT_ -DPIPELINE_COUNT=1"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *sparc-next)
	RC5CORECOPY="rc5/ansi/rc5ansi2-rg.cpp"
	TARGET_CC="cc++"
	TARGET_CCFLAGS="$OPTS_NEXT_SPARC -arch sparc -D_NeXT_  \
			-DPIPELINE_COUNT=2 -DBIT_32"
	TARGET_ADDSRCS="des/des-slice.cpp des/deseval.cpp"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *hppa-next)
 	RC5CORECOPY="rc5/ansi/rc5ansi2-b2.cpp"
	TARGET_CC="cc++"
	TARGET_CCFLAGS="$OPTS_NEXT_HPPA -arch hppa -D_NeXT_ \
			-DPIPELINE_COUNT=2 -DBIT_32"
	TARGET_ADDSRCS="des/des-slice.cpp des/deseval.cpp"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

###### ARM

    *riscos)
	TARGET_CC="armcpp -aif -nodebug -littleend \
		   -apcs 3/26bit/swst/hardfp/fpe2 -zps1 -nounusedareas \
		   -l/home/cberry/play/riscoslib/CLib/stubs.o"
	TARGET_AS="armasm -apcs 3/26bit"
	TARGET_CCFLAGS="-Icommon -Irc5/arm -Ides -Iogr -Iplatforms \
			-I/home/cberry/play/riscoslib/OSLib \
			-I/home/cberry/play/riscoslib/TCPIPLibs \
			-J/home/cberry/play/riscoslib/CLib \
			-D__showids__ \
			-DCOMPAT_INET4 -D__riscos \
			-DPIPELINE_COUNT=2 -DBIT_32 -DKWAN"
	TARGET_ADDSRCS="platforms/riscos/riscos.cpp"
	TARGET_ADDASMS="platforms/riscos/riscosasm.s \
			rc5/arm/rc5-arm-1.s rc5/arm/rc5-arm-2.s rc5/arm/rc5-arm-3.s \
			des/des-slice-arm.s des/des-slice-sa.s"
	TARGET_LIBS="-lcpplib /home/cberry/play/riscoslib/TCPIPLibs/unixlib.o \
		     /home/cberry/play/riscoslib/TCPIPLibs/inetlib.o \
		     /home/cberry/play/riscoslib/TCPIPLibs/socklib.o"
        TARGET_DOCFILES="docs/readme.riscos"   #platform specific docfile
	TARGET_STRIP=touch
	TARGET_BINNAME_SUFFIX=",ff8"
	;;

    *arm-linux)					# chrisb
	TARGET_CC="gcc"
	TARGET_AS="as"
	TARGET_CCFLAGS="$OPTS_GCC_ARM -Dlinux -DBIT_32 -DKWAN"
	TARGET_ADDSRCS=""
	TARGET_ADDASMS="rc5/arm/rc5-arm-1-gnu.s rc5/arm/rc5-arm-2-gnu.s \
			rc5/arm/rc5-arm-3-gnu.s \
			des/arm/des-slice-sa-gnu.s des/arm/des-slice-arm-gnu.s"
	TARGET_LIBS="-lm"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

    *arm-netbsd)				# chrisb
	TARGET_CC="gcc"
	TARGET_AS="as"
	TARGET_CCFLAGS="$OPTS_GCC_ARM -DBIT_32 -DKWAN"
	TARGET_ADDSRCS=""
	TARGET_ADDASMS="rc5/arm/rc5-arm-1-gnu.s rc5/arm/rc5-arm-2-gnu.s \
			rc5/arm/rc5-arm-3-gnu.s \
			des/arm/des-slice-sa-gnu.s des/arm/des-slice-arm-gnu.s"
	TARGET_LIBS="-lm"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

###### NetBSD/vax
    *vax-netbsd-gcc)
        RC5CORECOPY="rc5/rc5ansi1-b2.cpp"
        TARGET_CC="g++"
        TARGET_CCFLAGS="$OPTS_GCC_VAX -DPIPELINE_COUNT=1 -DBIT_32 \
                        -DMEGGS -DKWAN -DRC5ANSICORE"
        TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2"
        TARGET_LIBS="-ltermcap"
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
        ;;

###### OS390
    *os390)
	RC5CORECOPY="rc5/ansi/rc5ansi2-rg2.cpp"
	TARGET_CC="gcc"
	TARGET_AS=""
	TARGET_CCFLAGS="$OPTS_OS390 -D__showids__ \
			-DPIPELINE_COUNT=2 -DBIT_32 -DKWAN -DMEGGS"
	TARGET_ADDSRCS="$MEGGS_SLICE_SRCS2"
	TARGET_ADDASMS=""
	TARGET_LIBS="$SOCKS_LIBS"
        TARGET_DOCFILES="docs/readme.os390"   #platform specific docfile
	;;

###### Be OS (x86, PPC)
    *x86-beos)
	TARGET_AS="gcc -c"
	TARGET_CC="gcc"
	TARGET_CCFLAGS="$OPTS_EGCS_X86 $OPTS_DES_MMX -DMMX_RC5 -D__showids__ \
			-DMULTITHREAD"
	TARGET_LDFLAGS="-static"
	TARGET_ADDSRCS="$DESX86_SRCS $DESMMX_SRCS $KWAN_SLICE_SRCS4"
	TARGET_ADDASMS="des/brydgnu/bdeslow.S des/brydgnu/bbdeslow.S \
			platforms/x86ident.S \
			des/brydgnu/p1bdespro.S des/brydgnu/p2bdespro.S"
	TARGET_ADDNASMS="$NASM_RC5X86_SRCS $NASM_DESMMX_SRCS"
	TARGET_LIBS=""
        TARGET_DOCFILES="docs/readme._ix"   #platform specific docfile
	;;

####### OS/2 (x86, emx)
    # requires EMX, gcc 2.72 
    # if you don't have a basename command, you can use the following script:
    # just copy it to basename.cmd
        #@echo off
        #ksh -c "parm=%1 ; echo ${parm##*[\\/]}"
       
    *x86-os2-gcc)               # [patrick] <patrick@skarabeus.de>
        basename ()
        {
        export parm=$1
        ksh -c 'echo ${parm##*/}'
        }
	TARGET_AS="gcc -c"
        TARGET_CC="gcc"
	TARGET_CCFLAGS="-Zmt -pipe $OPTS_GCC_X86 $OPTS_DES_MMX -DMMX_RC5 -I. -I${C_INCLUDE_PATH} -DMULTITHREAD -D__showids__"
	TARGET_LDFLAGS="-Zmt"
	TARGET_ADDSRCS="common/lurk.cpp rc5/x86/rc5-486-smc-rg.cpp $RC5X86_SRCS $DESX86_SRCS $DESMMX_SRCS $KWAN_SLICE_SRCS4 platforms/os2cli/os2inst.cpp"
	TARGET_ADDASMS="des/brydgnu/bdeslow.S des/brydgnu/bbdeslow.S platforms/x86ident.S des/brydgnu/p1bdespro.S des/brydgnu/p2bdespro.S"
	TARGET_ADDNASMS="rc5/x86/nasm/rc5mmx.asm $NASM_DESMMX_SRCS"
	TARGET_NASM_FMT="aout"
        TARGET_LIBS="-lsocket"
        TARGET_DOCFILES="docs/readme.os2"   #platform specific docfile
        TARGET_OS=OS2
        ;;

    *x86-os2-nasm-gcc)          # [patrick] <patrick@skarabeus.de>
        basename ()
        {
        export parm=$1
        ksh -c 'echo ${parm##*/}'
        }
	TARGET_AS="gcc -c"
        TARGET_CC="gcc"
	TARGET_CCFLAGS="-Zmt -pipe $OPTS_GCC_X86 $OPTS_DES_MMX -DMMX_RC5 -I. -I${C_INCLUDE_PATH} -DMULTITHREAD -D__showids__"
	TARGET_LDFLAGS="-Zmt"
	TARGET_ADDSRCS="common/lurk.cpp rc5/x86/rc5-486-smc-rg.cpp $DESX86_SRCS $DESMMX_SRCS $KWAN_SLICE_SRCS4 platforms/os2cli/os2inst.cpp"
	TARGET_ADDASMS="des/brydgnu/bdeslow.S des/brydgnu/bbdeslow.S platforms/x86ident.S des/brydgnu/p1bdespro.S des/brydgnu/p2bdespro.S"
	TARGET_ADDNASMS="$NASM_RC5X86_SRCS $NASM_DESMMX_SRCS"
	TARGET_NASM_FMT="aout"
        TARGET_LIBS="-lsocket"
        TARGET_DOCFILES="docs/readme.os2"   #platform specific docfile
        TARGET_OS=OS2
        ;;


###### Unknown
    *list)
	egrep "^[ ]*\*" $0 | more
	echo ""
	exit 1
	;;
    *)
	echo "Unknown target platform \"$1\" specified."
	echo "Run with 'list' as an argument to see available platforms."
	echo ""
	exit 1
esac
echo "Platform target for \"$1\" recognized."

#
# add (cough, cough) things to all
#
TARGET_CCFLAGS="$TARGET_CCFLAGS -I./common -I./rc5 -I./des -I./ogr -I./csc"
#TARGET_ADDSRCS="$TARGET_ADDSRCS $CSC_ANSI_SRCS $OGR_ANSI_SRCS"
#TARGET_CCFLAGS="$TARGET_CCFLAGS -DHAVE_CSC_CORES -DHAVE_OGR_CORES"

#
# Generate the list of output objects, making note of what
# source file it was derrived from.
#
 

TARGET_ALLCCOBJS=
TARGET_ALLASOBJS=
TARGET_ALLNASMOBJS=

if [ -n "${COMMON_SRCS}" -o -n "${TARGET_ADDSRCS}" ]; then
  echo "Scanning output C++ dependencies..."
  for target in ${COMMON_SRCS} ${TARGET_ADDSRCS}; do
      TARGETOBJECT=output/`basename $target .cpp`.o
      SAFENAME=`echo ${TARGETOBJECT} | tr -d ${DELETECHARS}`
      echo "  ${target} -> ${TARGETOBJECT} (${SAFENAME})"
      eval "DEPEND_${SAFENAME}=${target}"
      TARGET_ALLCCOBJS="${TARGET_ALLCCOBJS} ${TARGETOBJECT}"
  done
fi

if [ -n "${TARGET_ADDASMS}" ]; then
  echo "Scanning output AS dependencies..."
  for target in ${TARGET_ADDASMS}; do
      TARGETOBJECT=output/`basename $target`.o
      SAFENAME=`echo ${TARGETOBJECT} | tr -d ${DELETECHARS}`
      echo "  $target -> $TARGETOBJECT ($SAFENAME)"
      eval "DEPEND_${SAFENAME}=$target"
      TARGET_ALLASOBJS="${TARGET_ALLASOBJS} ${TARGETOBJECT}"
  done
fi

if [ -n "${TARGET_ADDNASMS}" ]; then
  echo "Scanning output NASM dependencies..."
  for target in ${TARGET_ADDNASMS}; do
      TARGETOBJECT=output/`basename $target`.o
      SAFENAME=`echo ${TARGETOBJECT} | tr -d ${DELETECHARS}`
      echo "  $target -> $TARGETOBJECT ($SAFENAME)"
      eval "DEPEND_${SAFENAME}=$target"
      TARGET_ALLNASMOBJS="${TARGET_ALLNASMOBJS} ${TARGETOBJECT}"
  done
fi

if [ "$TARGET_OS" = "DIGITAL_UNIX" ]; then
  echo "Scanning additional Digital Unix Sources"
  for target in ${TARGET_DIGITAL_UNIX_EV5_SRCS}; do
      TARGETOBJECT=output/`basename $target .cpp`.o
      SAFENAME=`echo ${TARGETOBJECT} | tr -d ${DELETECHARS}`
      echo "  ${target} -> ${TARGETOBJECT} (${SAFENAME})"
      eval "DEPEND_${SAFENAME}=${target}"
      TARGET_DUEV5OBJS="${TARGET_DUEV5OBJS} ${TARGETOBJECT}"
  done
fi

#
# Build the test program
#
echo "Building test program..."
if [ $1 = riscos ]; then
  #tum-te-tum
  rsh starman "cd rc5/src/client; gcc common/testplat.cpp -o testplat"
else
    echo "${TARGET_CC} ${TARGET_CCFLAGS} common/testplat.cpp ${TARGET_LDFLAGS} ${TARGET_LIBS} -o testplat"
  sh -c "${TARGET_CC} ${TARGET_CCFLAGS} common/testplat.cpp ${TARGET_LDFLAGS} ${TARGET_LIBS} -o testplat"
  if [ $? -ne 0 ]; then
    echo "Compilation failed.  Check your target options."
    echo " ---------------------------------------------"
    echo "${TARGET_CC} ${TARGET_CCFLAGS} common/testplat.cpp ${TARGET_LDFLAGS} ${TARGET_LIBS} -o testplat"
    echo " ---------------------------------------------"
    exit
  fi
  if [ "$TARGET_OS" = "OS2" ]; then
     emxbind testplat
  else
     ${TARGET_STRIP} testplat
  fi
fi


#
# Look up the platform and os types
#
if [ $1 = riscos ]; then
  CLIENTCPU=11
  CLIENTOS=34
  INTSIZES=442
else
  CLIENTCPU=`./testplat cpu`
  CLIENTOS=`./testplat os`
# INTSIZES=`./testplat intsizes`
fi
CLIENTOSNAME=`grep "#define OS_.*\<$CLIENTOS\>" common/cputypes.h | head -1 | cut -d' ' -f2`
CLIENTCPUNAME=`grep "#define CPU_.*\<$CLIENTCPU\>" common/cputypes.h | head -1 | cut -d' ' -f2`
echo "CLIENT_CPU = $CLIENTCPUNAME ($CLIENTCPU)"
echo "CLIENT_OS = $CLIENTOSNAME ($CLIENTOS)"
#echo "INTSIZES = $INTSIZES"
TARGET_CCFLAGS="-DBUILDNAME=\${BUILDNAME} ${TARGET_CCFLAGS}"
if [ "$TARGET_OS" = "DIGITAL_UNIX" ]; then
TARGET_EV5_CCFLAGS="-DBUILDNAME=\${BUILDNAME} ${TARGET_EV5_CCFLAGS}"
fi

#
# Generate full doc file list.
#
if [ -f docs/readme.1st ]; then
  TARGET_DOCFILES="docs/readme.1st ${TARGET_DOCFILES}"
fi  
TARGET_DOCFILES="${TARGET_DOCFILES} docs/CHANGES.txt docs/${TARGET_BINNAME}.txt"
if [ "X$TARGET_GENMAN" = "X1" ]; then
  TARGET_DOCFILES="${TARGET_DOCFILES} ${TARGET_BINNAME}.1"
fi  

#
# Start building the output makefile
#
echo "Generating output Makefile prologue code..."
rm -f Makefile

echo "# Autogenerated $TARGET_BINNAME client makefile ($1)" > Makefile
if [ "$AIXALL" = "TRUE" ]; then
echo "#   target cpu --> CPU_POWERPC (2) && CPU_POWER (9)" >> Makefile
else
echo "#   target cpu --> $CLIENTCPUNAME ($CLIENTCPU)" >> Makefile
fi
echo "#    target os --> $CLIENTOSNAME ($CLIENTOS)" >> Makefile
#echo "#     intsizes --> $INTSIZES" >> Makefile
echo "# see http://www.distributed.net/ for details." >> Makefile
echo "" >> Makefile

echo "CC = ${TARGET_CC}" >> Makefile
echo "CP = ${TARGET_CP}" >> Makefile
echo "CCFLAGS = ${TARGET_CCFLAGS}" >> Makefile
if [ "$AIXALL" = "TRUE" ]; then
echo "PPC601FLAGS = ${AIXPPC601FLAGS}" >> Makefile
echo "PPC604FLAGS = ${AIXPPC604FLAGS}" >> Makefile
echo "POWERFLAGS = ${AIXPOWERFLAGS}" >> Makefile
fi
echo "LDFLAGS = ${TARGET_LDFLAGS}" >> Makefile
echo "LIBS = ${TARGET_LIBS}" >> Makefile
echo "AS = ${TARGET_AS}" >> Makefile
echo "ASFLAGS = ${TARGET_ASFLAGS}" >> Makefile
echo "NASM = ${TARGET_NASM}" >> Makefile
if [ "X$TARGET_NASM_FMT" = "X" ]; then
  $TARGET_NASM_FMT="elf"
fi  
TARGET_NASMFLAGS="-f $TARGET_NASM_FMT \
                  -i rc5/x86/nasm/ -i des/mmx-bitslice/ -i csc/x86/ \
		  -d__showids__"
if [ "$TARGET_NASM_FMT" = "elf" ]; then
  TARGET_NASMFLAGS="$TARGET_NASMFLAGS -d__ELF__"
else
  TARGET_NASMFLAGS="$TARGET_NASMFLAGS -d__AOUT__" #for both aout and aoutb
fi
echo "NASMFLAGS = ${TARGET_NASMFLAGS}" >> Makefile
echo "STRIP = ${TARGET_STRIP}" >> Makefile
echo "ALLOBJS = ${TARGET_ALLCCOBJS} ${TARGET_ALLASOBJS} ${TARGET_ALLNASMOBJS} ${TARGET_DUEV5OBJS}" >> Makefile
echo "ADDOBJS = ${TARGET_ADDOBJS}" >> Makefile
echo "BUILDNAME = $1" >> Makefile
echo "DOCFILES = ${TARGET_DOCFILES}" >>Makefile
echo "BUILDNUM:= \`grep CLIENT_BUILD_FRAC common/version.h|tr -dc 0-9\`" >>Makefile
echo "" >> Makefile

#
# Generate the main production targets in the makefile
#
echo "Generating Makefile production targets..."
echo "# Regular targets follow" >> Makefile

if [ "$TARGET_OS" = "OS2" ]; then

echo "${TARGET_BINNAME}.exe:	\${BUILDNAME}.exe" >> Makefile
echo "	\${CP} \${BUILDNAME}.exe ${TARGET_BINNAME}.exe" >> Makefile
echo "" >> Makefile

echo "\${BUILDNAME}.exe:	\${ALLOBJS} \${ADDOBJS} output/\${BUILDNAME}.res" >> Makefile
echo "	\${CC} \${LDFLAGS} \${ALLOBJS} \${ADDOBJS} \${LIBS} -o \${BUILDNAME}" >> Makefile
echo "	emxbind -b -r output/\${BUILDNAME}.res \${BUILDNAME}" >> Makefile
echo "" >> Makefile

echo "output/\${BUILDNAME}.res: platforms/os2cli/${TARGET_BINNAME}.rc" >> Makefile
echo "	 platforms\\os2cli\\gcc_rc.cmd \${BUILDNAME}.res" >> Makefile
echo "" >> Makefile

echo "clean:" >> Makefile
echo "	rm -f \${ALLOBJS}  ${TARGET_BINNAME}.exe" >> Makefile
echo "	rm -f output/\${BUILDNAME}.res" >> Makefile
echo "" >> Makefile

else

#echo "\${BUILDNAME}:	\${ALLOBJS} \${ADDOBJS}" >> Makefile
#echo "	\${CC} \${LDFLAGS} \${ALLOBJS} \${ADDOBJS} \${LIBS} -o \${BUILDNAME}" >> Makefile
#echo "" >> Makefile
#
#echo "${TARGET_BINNAME}${TARGET_BINNAME_SUFFIX}:	\${BUILDNAME}${TARGET_BINNAME_SUFFIX}" >> Makefile
#echo "	\${CP} \${BUILDNAME} ${TARGET_BINNAME}${TARGET_BINNAME_SUFFIX}" >> Makefile
rm -f {BUILDNAME}
#
echo "${TARGET_BINNAME}${TARGET_BINNAME_SUFFIX}:	\${ALLOBJS} \${ADDOBJS}" >> Makefile
echo "	\${CC} \${LDFLAGS} \${ALLOBJS} \${ADDOBJS} \${LIBS} -o ${TARGET_BINNAME}${TARGET_BINNAME_SUFFIX}" >> Makefile
echo "	\${STRIP} ${TARGET_BINNAME}${TARGET_BINNAME_SUFFIX}" >> Makefile
if [ "X$TARGET_GENMAN" != "X" ]; then
    echo "	./${TARGET_BINNAME}${TARGET_BINNAME_SUFFIX} -genman" >> Makefile
fi  
if [ "X$TARGET_TARBALL" != "X" ]; then
  if  [ "$TARGET_ARCTYPE" = "zip" ]; then
    echo "Zip support is not in place"  
  else     # tgz
    echo "	tar -cvzf ${TARGET_BINNAME}\${BUILDNUM}-${TARGET_TARBALL}.tar.gz ${TARGET_BINNAME} \${DOCFILES}" >>Makefile
  fi
  echo "" >> Makefile  

  # make rule to transfer the packaged tarball
  echo "ftp:" >> Makefile
  if [ "X$TARGET_TARBALL_COMMENT" != "X" ]; then
    echo "	echo \"${TARGET_TARBALL_COMMENT}\">${TARGET_BINNAME}\${BUILDNUM}-${TARGET_TARBALL}.comment" >>Makefile
  fi
  echo "	sh ./upload.sh ${TARGET_BINNAME}\${BUILDNUM}-${TARGET_TARBALL}" >>Makefile
  if [ "X$TARGET_TARBALL_COMMENT" != "X" ]; then
    echo "	rm -f ${TARGET_BINNAME}\${BUILDNUM}-${TARGET_TARBALL}.comment" >>Makefile
  fi
fi  
echo "" >> Makefile

echo "dep: $0" >> Makefile
echo "	\$(SHELL) $0 \${BUILDNAME}" >> Makefile
echo "" >> Makefile
echo "reconfigure: dep" >> Makefile
echo "" >> Makefile
echo "clean:" >> Makefile
echo "	rm -f \${ALLOBJS}  ${TARGET_BINNAME}${TARGET_BINNAME_SUFFIX}" >> Makefile
echo "" >> Makefile

fi

echo "superclean: clean" >> Makefile
echo "	rm -f Makefile buff-in.* buff-out.* *.ini testplat" >> Makefile
echo "	find . -name '*~' -exec rm {} \\;" >> Makefile
echo "" >> Makefile

echo "distclean: superclean $0" >> Makefile
echo "	find . -name '.#*' -exec rm {} \\;" >> Makefile
echo "	rm -f \`egrep \"^[ ]*\\*\" $0 | sed -e 's/\(^.*\*\)\(.*\)\().*\$\$\)/\2/'\`" >> Makefile
echo "" >> Makefile

echo "ident:	${TARGET_BINNAME}${TARGET_BINNAME_SUFFIX}" >> Makefile
echo "	ident ${TARGET_BINNAME}${TARGET_BINNAME_SUFFIX} | awk '{ printf(\"%-30s %10s %s %s %s %s%c\", \$\$2,\$\$3,\$\$4,\$\$5,\$\$6,\$\$7,10)}'" >> Makefile
echo "" >> Makefile

## add binary-tarball targets
#echo "internal-tarpackit:	\${TARGETFILE} \${TAREXTRAS}" >> Makefile
#echo "	strip \${STRIPFLAGS} \${TARGETFILE}" >> Makefile
#echo "	-rm -rf \${TARBASENAME}\${BUILDNUM}-\${TARNAME}" >> Makefile
#echo "	mkdir \${TARBASENAME}\${BUILDNUM}-\${TARNAME}" >> Makefile
#echo "	cp -f \${TARGETFILE} \${TAREXTRAS} \\" >> Makefile
#echo "		\${TARBASENAME}\${BUILDNUM}-\${TARNAME}" >> Makefile
#echo "	tar cvf \${TARBASENAME}\${BUILDNUM}-\${TARNAME}.tar \\" >> Makefile
#echo "		\${TARBASENAME}\${BUILDNUM}-\${TARNAME}" >> Makefile
#echo "	rm -rf \${TARBASENAME}\${BUILDNUM}-\${TARNAME}" >> Makefile
#echo "	-rm -f \${TARBASENAME}\${BUILDNUM}-\${TARNAME}.tar.gz" >> Makefile
#echo "	\${TARCOMPRESS} \${TARBASENAME}\${BUILDNUM}-\${TARNAME}.tar" >> Makefile
#echo "	@echo Type \'make ftp\' to upload the tarball to the ftp site." >> Makefile
#echo "" >> Makefile

# make rule to transfer the packaged tarball
#echo "ftp:" >> Makefile
#echo "	echo \"user anonymous -luser@distributed.net#cd /incoming#\\" >> Makefile
#echo "	binary#mput \${TARBASENAME}*.tar*#bye#\" | \\" >> Makefile
#echo "	tr \"#\" \"\n\" | ftp -n -i -v upload.distributed.net" >> Makefile
#echo "" >> Makefile



#
# Generate the dependency targets in the makefile
#
echo "# Dependency targets follow" >> Makefile

if [ -n "${TARGET_ALLCCOBJS}" ]; then
  echo "Generating Makefile C++ dependency targets..."
  for target in ${TARGET_ALLCCOBJS}; do
    SAFENAME=`echo $target | tr -d ${DELETECHARS}`
    eval TARGETSRC=$`echo DEPEND_$SAFENAME`
    if [ -n "${RC5CORECOPY}" -a `basename ${TARGETSRC}` = problem.cpp ]; then
      TARGET_HDEPS1=`./testplat build_dependancies ${TARGETSRC}`
      TARGET_HDEPS2=`./testplat build_dependancies ${RC5CORECOPY}`
      echo "$target:	${TARGETSRC} ${TARGET_HDEPS1} ${RC5CORECOPY} ${TARGET_HDEPS2}" >> Makefile
      echo "	\${CC} -c \${CCFLAGS} -include ${RC5CORECOPY} ${TARGETSRC} -o $target" >> Makefile
    else
      TARGET_HDEPS=`./testplat build_dependancies ${TARGETSRC}`
      echo "$target:	${TARGETSRC} ${TARGET_HDEPS}" >> Makefile
      echo "	\${CC} -c \${CCFLAGS} ${TARGETSRC} -o $target" >> Makefile
    fi
    echo "" >> Makefile
  done
fi

if [ -n "${TARGET_ALLASOBJS}" ]; then
  echo "Generating Makefile AS dependency targets..."
  for target in ${TARGET_ALLASOBJS}; do
    SAFENAME=`echo $target | tr -d ${DELETECHARS}`
    eval TARGETSRC=$`echo DEPEND_$SAFENAME`
    echo "$target:	${TARGETSRC}" >> Makefile
    echo "	\${AS} \${ASFLAGS} ${TARGETSRC} -o $target" >> Makefile
    echo "" >> Makefile
  done
fi

if [ -n "${TARGET_ALLNASMOBJS}" ]; then
  echo "Generating Makefile NASM dependency targets..."
  for target in ${TARGET_ALLNASMOBJS}; do
    SAFENAME=`echo $target | tr -d ${DELETECHARS}`
    eval TARGETSRC=$`echo DEPEND_$SAFENAME`
    echo "$target:	${TARGETSRC}" >> Makefile
    echo "	\${NASM} \${NASMFLAGS} ${TARGETSRC} -o $target" >> Makefile
    echo "" >> Makefile
  done
fi

if [ "$TARGET_OS" = "DIGITAL_UNIX" ]; then
  echo "Generating Makefile Digital Unix EV5 dependency targets..."
  for target in ${TARGET_DUEV5OBJS}; do
    SAFENAME=`echo $target | tr -d ${DELETECHARS}`
    eval TARGETSRC=$`echo DEPEND_$SAFENAME`
    TARGET_HDEPS=`./testplat build_dependancies ${TARGETSRC}`
    echo "$target:	${TARGETSRC} ${TARGET_HDEPS}" >> Makefile
    echo "	\${CC} -c $TARGET_EV5_CCFLAGS ${TARGETSRC} -o $target" >> Makefile
    echo "" >> Makefile
  done
fi

if [ "$AIXALL" = "TRUE" ]; then
  echo "Patching compilersettings in Makefile for the cores"
  mv Makefile Makefile.tmp
  awk '
/allitnil_552.ppc.s -o/ { print "\t\${CC} -c ${PPC601FLAGS} " $4 " " $5 " " $6 ; next }
/lintilla_296.ppc.s -o/ { print "\t\${CC} -c ${PPC604FLAGS} " $4 " " $5 " " $6 ; next }
/rc5ansi_2-rg.cpp -o/ { print "\t\${CC} -c ${POWERFLAGS} " $4 " " $5 " " $6 ; next }
{ print $0 }' Makefile.tmp > Makefile
rm Makefile.tmp
fi

echo "Makefile auto-generation complete!"
if [ "X$TARGET_TARBALL" = "X" ]; then
  echo "TARGET_TARBALL was not defined."
  echo "Upload-ready tarballs will not be auto-generated"
  echo "and Makefile does not have an 'ftp' target"
fi  
echo ""
