rockbox/tools/configure
2007-03-04 14:09:21 +00:00

1825 lines
50 KiB
Bash
Executable file

#!/bin/sh
# __________ __ ___.
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
# \/ \/ \/ \/ \/
# $Id$
#
# global CC options for all platforms
CCOPTS="-W -Wall -Wundef -O -nostdlib -ffreestanding -Wstrict-prototypes"
use_logf="#undef ROCKBOX_HAS_LOGF"
use_simsound="#undef ROCKBOX_HAS_SIMSOUND"
scriptver=`echo '$Revision$' | sed -e 's:\\$::g' -e 's/Revision: //'`
#
# Begin Function Definitions
#
input() {
read response
echo $response
}
prefixtools () {
prefix="$1"
CC=${prefix}gcc
WINDRES=${prefix}windres
DLLTOOL=${prefix}dlltool
DLLWRAP=${prefix}dllwrap
RANLIB=${prefix}ranlib
LD=${prefix}ld
AR=${prefix}ar
AS=${prefix}as
OC=${prefix}objcopy
}
crosswincc () {
# naive approach to selecting a mingw cross-compiler on linux/*nix
echo "Enabling win32 crosscompiling"
prefixtools i586-mingw32msvc-
LDOPTS="-lgdi32 -luser32 -mwindows"
# add cross-compiler option(s)
GCCOPTS="$GCCOPTS -mno-cygwin"
output="rockboxui.exe" # use this as output binary name
crosscompile="yes"
endian="little" # windows is little endian
}
checksoundcard () {
if test -n "$codecs"; then
if test -f "/usr/include/sys/soundcard.h"; then
# We have a header file so we can build the sound code
use_simsound="#define ROCKBOX_HAS_SIMSOUND 1"
echo "Enabled PCM sound playback in simulator"
fi # header file present
fi # has codecs
}
# scan the $PATH for the given command
findtool(){
file="$1"
IFS=":"
for path in $PATH
do
# echo "checks for $file in $path" >&2
if test -f "$path/$file"; then
echo "$path/$file"
return
fi
done
}
simcc () {
# default tool setup for native building
prefixtools ""
GCCOPTS='-W -Wall -g -fno-builtin'
output="rockboxui" # use this as default output binary name
if [ "$simver" = "sdl" ]; then
# generic sdl-config checker
sdl=`findtool sdl-config`
if [ -z "$sdl" ]; then
echo "configure didn't find sdl-config, which indicates that you"
echo "don't have SDL (properly) installed. Please correct and"
echo "re-run configure!"
exit
fi
fi
case $uname in
CYGWIN*)
echo "Cygwin host detected"
SHARED_FLAG="-shared"
if [ "$simver" = "win32" ]; then
# win32 version
GCCOPTS="$GCCOPTS -mno-cygwin -DNOCYGWIN"
LDOPTS="-lgdi32 -luser32 -mno-cygwin"
elif [ "$simver" = "sdl" ]; then
# sdl version
GCCOPTS="$GCCOPTS `sdl-config --cflags`"
LDOPTS="`sdl-config --libs` -mconsole"
checksoundcard
else
# x11 version
GCCOPTS="$GCCOPTS"
LDOPTS='-L/usr/X11R6/lib -lSM -lICE -lXt -lX11 -lXmu -lSM -lICE -lX11 -lpthread'
checksoundcard
fi
output="rockboxui.exe" # use this as output binary name
;;
Linux)
echo "Linux host detected"
GCCOPTS="$GCCOPTS"
SHARED_FLAG="-shared"
if [ "$simver" = "win32" ]; then
LDOPTS='-L/usr/X11R6/lib -lX11 -lm -lXt -lXmu -lnsl -ldl -lpthread'
crosswincc # setup cross-compiler
elif [ "$simver" = "sdl" ]; then
if [ "0" != `sdl-config --libs |grep -c mwindows` ]; then
# Enable crosscompiling if sdl-config is from Windows SDL
crosswincc
fi
GCCOPTS="$GCCOPTS `sdl-config --cflags`"
LDOPTS="`sdl-config --libs`"
checksoundcard
else
LDOPTS='-L/usr/X11R6/lib -lX11 -lm -lXt -lXmu -lnsl -ldl -lpthread'
checksoundcard
fi # not a cross-compiler
;;
FreeBSD)
echo "FreeBSD host detected"
LDOPTS='-L/usr/X11R6/lib -lX11 -lm -lXt -lXmu -dl -lpthread'
SHARED_FLAG="-shared"
if [ "$simver" = "win32" ]; then
crosswincc # setup cross-compiler
fi
;;
Darwin)
echo "Darwin host detected"
# sdl version
GCCOPTS="$GCCOPTS `sdl-config --cflags`"
LDOPTS="`sdl-config --libs`"
SHARED_FLAG="-dynamiclib -Wl\,-single_module"
use_simsound="#define ROCKBOX_HAS_SIMSOUND 1"
echo "Enabled PCM sound playback in simulator"
;;
*)
echo "Unsupported system: $uname, fix configure and retry"
exit
;;
esac
if [ "`uname -m`" = "x86_64" ]; then
GCCOPTS="$GCCOPTS -fPIC" # needed to make shared objects link
fi
if test "X$crosscompile" != "Xyes"; then
id=$$
cat >/tmp/conftest-$id.c <<EOF
#include <stdio.h>
int main(int argc, char **argv)
{
int var=0;
char *varp = (char *)&var;
*varp=1;
printf("%d\n", var);
return 0;
}
EOF
$CC -o /tmp/conftest-$id /tmp/conftest-$id.c 2>/dev/null
if test `/tmp/conftest-$id 2>/dev/null` -gt "1"; then
# big endian
endian="big"
else
# little endian
endian="little"
fi
echo "Simulator environment deemed $endian endian"
# use wildcard here to make it work even if it was named *.exe like
# on cygwin
rm -f /tmp/conftest-$id*
fi
}
shcc () {
prefixtools sh-elf-
GCCOPTS="$CCOPTS -m1"
GCCOPTIMIZE="-fomit-frame-pointer -fschedule-insns"
endian="big"
}
calmrisccc () {
prefixtools calmrisc16-unknown-elf-
GCCOPTS="-Wl\,--no-check-sections $CCOPTS"
GCCOPTIMIZE="-fomit-frame-pointer"
endian="big"
}
coldfirecc () {
prefixtools m68k-elf-
GCCOPTS="$CCOPTS -m5206e -Wa\,-m5249 -malign-int -mstrict-align"
GCCOPTIMIZE="-fomit-frame-pointer"
endian="big"
}
arm7tdmicc () {
prefixtools arm-elf-
GCCOPTS="$CCOPTS -mcpu=arm7tdmi"
if test "X$1" != "Xshort"; then
GCCOPTS="$GCCOPTS -mlong-calls"
fi
GCCOPTIMIZE="-fomit-frame-pointer"
endian="little"
}
arm9tdmicc () {
prefixtools arm-elf-
GCCOPTS="$CCOPTS -mcpu=arm9tdmi -mlong-calls"
GCCOPTIMIZE="-fomit-frame-pointer"
endian="little"
}
whichadvanced () {
##################################################################
# Prompt for specific developer options
#
echo ""
echo "Enter your developer options (press enter when done)"
echo -n "(D)EBUG, (L)ogf, (S)imulator, (P)rofiling"
if [ "$memory" = "2" ]; then
echo -n ", (8)MB MOD"
fi
if [ "$archos" = "h120" ]; then
echo -n ", (R)TC MOD"
fi
echo ""
cont=1
while [ $cont = "1" ]; do
option=`input`;
case $option in
[Dd])
if [ "yes" = "$profile" ]; then
echo "Debug is incompatible with profiling"
else
echo "define DEBUG"
use_debug="yes"
fi
;;
[Ll])
echo "logf() support enabled"
logf="yes"
;;
[Ss])
echo "Simulator build enabled"
simulator="yes"
;;
[Pp])
if [ "yes" = "$use_debug" ]; then
echo "Profiling is incompatible with debug"
else
echo "Profiling support is enabled"
profile="yes"
fi
;;
8)
if [ "$memory" = "2" ]; then
memory="8"
echo "Memory size selected: 8MB"
else
cont=0
fi
;;
[Rr])
if [ "$archos" = "h120" ]; then
config_rtc="#define CONFIG_RTC RTC_DS1339_DS3231"
have_rtc_alarm="#define HAVE_RTC_ALARM"
echo "RTC functions enabled (DS1339/DS3231)"
else
cont=0
fi
;;
*)
cont=0
;;
esac
done
echo "done"
if [ "yes" = "$use_debug" ]; then
debug="-DDEBUG"
GCCOPTS="$GCCOPTS -g -DDEBUG"
fi
if [ "yes" = "$logf" ]; then
use_logf="#define ROCKBOX_HAS_LOGF 1"
fi
if [ "yes" = "$simulator" ]; then
debug="-DDEBUG"
extradefines="$extradefines -DSIMULATOR"
whichsim
fi
if [ "yes" = "$profile" ]; then
extradefines="$extradefines -DRB_PROFILE"
PROFILE_OPTS="-finstrument-functions"
fi
}
whichsim () {
if [ -z "$simver" ]; then
##################################################################
# Figure out what simulator version
#
# x11 is deprecated so hide it from the question
# win32 is also deprecated
#
echo ""
echo "Build (S)DL version? (S)"
option=`input`;
case $option in
[Ww])
simver="win32"
WINDRES=windres
DLLTOOL=dlltool
DLLWRAP=dllwrap
# make sure the code knows this is for win32
extradefines="$extradefines -DWIN32"
;;
[Xx])
simver="x11"
extradefines="$extradefines -DX11"
;;
[Ss]|*)
simver="sdl"
extradefines="$extradefines -DSDL"
;;
esac
echo "Selected $simver simulator"
fi
}
voiceconfig () {
echo "Building voice for $archos"
echo ""
if [ `which flite` ]; then
FLITE="F(l)ite "
FLITE_OPTS="FLITE_OPTS=\"\""
DEFAULT_TTS="flite"
DEFAULT_TTS_OPTS=$FLITE_OPTS
DEFAULT_NOISEFLOOR="500"
DEFAULT_CHOICE="L"
fi
if [ `which speak` ]; then
ESPEAK="(e)Speak "
ESPEAK_OPTS="ESPEAK_OPTS=\"\""
DEFAULT_TTS="espeak"
DEFAULT_TTS_OPTS=$ESPEAK_OPTS
DEFAULT_NOISEFLOOR="500"
DEFAULT_CHOICE="e"
fi
if [ `which festival` ]; then
FESTIVAL="(F)estival "
FESTIVAL_OPTS="FLITE_OPTS=\"\""
DEFAULT_TTS="festival"
DEFAULT_TTS_OPTS=$FESTIVAL_OPTS
DEFAULT_NOISEFLOOR="500"
DEFAULT_CHOICE="F"
fi
if [ "$FESTIVAL" = "$FLITE" ] && [ "$FLITE" = "$ESPEAK" ]; then
echo "You need Festival, eSpeak or Flite in your path to build voice files"
exit
fi
echo "TTS engine to use: ${FLITE}${FESTIVAL}${ESPEAK}(${DEFAULT_CHOICE})?"
option=`input`
case "$option" in
[Ll])
TTS_ENGINE="flite"
NOISEFLOOR="500" # TODO: check this value
TTS_OPTS=$FLITE_OPTS
;;
[Ee])
TTS_ENGINE="espeak"
NOISEFLOOR="500"
TTS_OPTS=$ESPEAK_OPTS
;;
[Ff])
TTS_ENGINE="festival"
NOISEFLOOR="500"
TTS_OPTS=$FESTIVAL_OPTS
;;
*)
TTS_ENGINE=$DEFAULT_TTS
TTS_OPTS=$DEFAULT_TTS_OPTS
NOISEFLOOR=$DEFAULT_NOISEFLOOR
esac
echo "Using $TTS_ENGINE for TTS"
echo ""
if [ `which oggenc` ]; then
OGGENC="(O)ggenc "
DEFAULT_ENC="oggenc"
VORBIS_OPTS="VORBIS_OPTS=\"-q0 --downmix\""
DEFAULT_ENC_OPTS=$VORBIS_OPTS
DEFAULT_CHOICE="O"
fi
if [ `which speexenc` ]; then
SPEEXENC="(S)peexenc "
DEFAULT_ENC="speexenc"
SPEEX_OPTS="" # TODO: find appropriate options for speex
DEFAULT_ENC_OPTS=$SPEEX_OPTS
DEFAULT_CHOICE="S"
fi
if [ `which lame` ]; then
LAME="(L)ame "
DEFAULT_ENC="lame"
LAME_OPTS="LAME_OPTS=\"--resample 12 -t -m m -h -V 9 -S\""
DEFAULT_ENC_OPTS=$LAME_OPTS
DEFAULT_CHOICE="L"
fi
if [ "$LAME" = "" ]; then
echo "You need to have Lame installed to build voice files"
fi
echo "Encoder to use: ${LAME}${OGGENC}${SPEEXENC}(${DEFAULT_CHOICE})?"
echo ""
echo "Note: Use Lame - the other options won't work"
option=`input`
case "$option" in
[Oo])
ENCODER="oggenc"
ENC_OPTS=$VORBIS_OPTS
;;
[Ss])
ENCODER="speexenc"
ENC_OPTS=$SPEEX_OPTS
;;
[Ll])
ENCODER="lame"
ENC_OPTS=$LAME_OPTS
;;
*)
ENCODER=$DEFAULT_ENC
ENC_OPTS=$DEFAULT_ENC_OPTS
esac
echo "Using $ENCODER for encoding voice clips"
cat > voicesettings.sh <<EOF
TTS_ENGINE="${TTS_ENGINE}"
ENCODER="${ENCODER}"
TEMPDIR="${pwd}"
NOISEFLOOR="${NOISEFLOOR}"
${TTS_OPTS}
${ENC_OPTS}
EOF
}
picklang() {
# figure out which languages that are around
for file in $rootdir/apps/lang/*.lang; do
clean=`echo $file | sed -e 's:.*/::g' | cut "-d." -f1`
langs="$langs $clean"
done
num=1
for one in $langs; do
echo "$num. $one"
num=`expr $num + 1`
done
read pick
return $pick;
}
whichlang() {
num=1
for one in $langs; do
if [ "$num" = "$pick" ]; then
echo $one
return
fi
num=`expr $num + 1`
done
}
opt=$1
if test "$opt" = "--help"; then
echo "Rockbox configure script."
echo "Invoke this in a directory to generate a Makefile to build Rockbox"
echo "Do *NOT* run this within the tools directory!"
echo ""
echo "Usage: configure [--ccache][--no-ccache]"
exit
fi
if test -r "configure"; then
# this is a check for a configure script in the current directory, it there
# is one, try to figure out if it is this one!
if { grep "^# Jukebox" configure >/dev/null 2>&1 ; } then
echo "WEEEEEEEEP. Don't run this configure script within the tools directory."
echo "It will only cause you pain and grief. Instead do this:"
echo ""
echo " cd .."
echo " mkdir build-dir"
echo " cd build-dir"
echo " ../tools/configure"
echo ""
echo "Much happiness will arise from this. Enjoy"
exit
fi
fi
# get our current directory
pwd=`pwd`;
if [ -z "$rootdir" ]; then
##################################################################
# Figure out where the source code root is!
#
rootdir=`dirname $0`/../
#####################################################################
# Convert the possibly relative directory name to an absolute version
#
now=`pwd`
cd $rootdir
rootdir=`pwd`
# cd back to the build dir
cd $now
fi
apps="apps"
appsdir='\$(ROOTDIR)/apps'
firmdir='\$(ROOTDIR)/firmware'
toolsdir='\$(ROOTDIR)/tools'
##################################################################
# Figure out target platform
#
echo "Enter target platform:"
cat <<EOF
==Archos== ==iriver== ==Apple iPod==
0) Player/Studio 10) H120/H140 20) Color/Photo
1) Recorder 11) H320/H340 21) Nano
2) FM Recorder 12) iHP-100/110/115 22) Video
3) Recorder v2 13) iFP-790 23) 3G
4) Ondio SP 14) H10 20Gb 24) 4G Grayscale
5) Ondio FM 15) H10 5/6Gb 25) Mini 1G
6) AV300 26) Mini 2G
==iAudio== ==Toshiba== ==SanDisk==
30) X5/X5V/X5L 40) Gigabeat F 50) Sansa e200
31) M5/M5L 51) Sansa e200R
==Tatung==
60) Elio TPJ-1022
EOF
buildfor=`input`;
# Set of tools built for all target platforms:
toolset="rdf2binary convbdf"
# Toolsets for some target families:
archosbitmaptools="$toolset scramble descramble sh2d uclpack bmp2rb codepages"
iriverbitmaptools="$toolset scramble descramble mkboot bmp2rb codepages"
iaudiobitmaptools="$toolset scramble descramble mkboot bmp2rb codepages"
ipodbitmaptools="$toolset scramble ipod_fw bmp2rb codepages"
gigabeatbitmaptools="$toolset scramble descramble bmp2rb codepages"
# generic is used by IFP, H10, Sansa-e200
genericbitmaptools="$toolset bmp2rb codepages"
# ---- For each target ----
#
# *Variables*
# target_id: a unique number identifying this target, DOES NOT necessarily
# have to be the menu number. Just use the currently highest
# number+1 when you add a new target.
# archos: short model name used all over to identify this target
# target: -Ddefine passed to the build commands to make the correct
# config-*.h file get included etc
# tool: the tool that takes a plain binary and converts that into a
# working "firmware" file for your target
# output: the final output file name
# boottool: the tool that takes a plain binary and generates a bootloader
# file for your target (or blank to use $tool)
# bootoutput:the final output file name for the bootloader (or blank to use
# $output)
# appextra: passed to the APPEXTRA variable in the Makefiles.
# TODO: add proper explanation
# archosrom: used only for Archos targets that build a special flashable .ucl
# image. Set to blank for other builds.
# flash: the same as archosrom. These two should be merged
# plugins: set to 'yes' to build the plugins. Early development builds can
# set this to no in the early stages to have an easier life for a
# while
# codecs: lists codecs to build for this target
# toolset: lists what particular tools in the tools/ directory that this
# target needs to have built prior to building Rockbox
#
# *Functions*
# *cc: sets up gcc and compiler options for your target builds. Note
# that if you select a simulator build, the compiler selection is
# overridden later in the script.
case $buildfor in
0|player)
target_id=1
archos="player"
target="-DARCHOS_PLAYER"
memory="2"
shcc
tool="$rootdir/tools/scramble"
output="archos.mod"
appextra="player:gui"
archosrom="$pwd/rombox.ucl"
flash="$pwd/rockbox.ucl"
plugins="yes"
codecs=""
# toolset is the tools within the tools directory that we build for
# this particular target.
toolset="$toolset scramble descramble sh2d generate_rocklatin uclpack"
# Note: the convbdf is present in the toolset just because: 1) the
# firmware/Makefile assumes it is present always, and 2) we will need it when we
# build the player simulator
t_cpu="sh"
t_manufacturer="archos"
t_model="player"
;;
1|recorder)
target_id=2
archos="recorder"
target="-DARCHOS_RECORDER"
memory="2"
shcc
tool="$rootdir/tools/scramble"
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
output="ajbrec.ajz"
appextra="recorder:gui"
archosrom="$pwd/rombox.ucl"
flash="$pwd/rockbox.ucl"
plugins="yes"
codecs=""
# toolset is the tools within the tools directory that we build for
# this particular target.
toolset=$archosbitmaptools
t_cpu="sh"
t_manufacturer="archos"
t_model="recorder"
;;
2|fmrecorder)
target_id=3
archos="fmrecorder"
target="-DARCHOS_FMRECORDER"
memory="2"
shcc
tool="$rootdir/tools/scramble -fm"
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
output="ajbrec.ajz"
appextra="recorder:gui"
archosrom="$pwd/rombox.ucl"
flash="$pwd/rockbox.ucl"
plugins="yes"
codecs=""
# toolset is the tools within the tools directory that we build for
# this particular target.
toolset=$archosbitmaptools
t_cpu="sh"
t_manufacturer="archos"
t_model="fm_v2"
;;
3|recorderv2)
target_id=4
archos="recorderv2"
target="-DARCHOS_RECORDERV2"
memory="2"
shcc
tool="$rootdir/tools/scramble -v2"
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
output="ajbrec.ajz"
appextra="recorder:gui"
archosrom="$pwd/rombox.ucl"
flash="$pwd/rockbox.ucl"
plugins="yes"
codecs=""
# toolset is the tools within the tools directory that we build for
# this particular target.
toolset=$archosbitmaptools
t_cpu="sh"
t_manufacturer="archos"
t_model="fm_v2"
;;
4|ondiosp)
target_id=7
archos="ondiosp"
target="-DARCHOS_ONDIOSP"
memory="2"
shcc
tool="$rootdir/tools/scramble -osp"
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
output="ajbrec.ajz"
appextra="recorder:gui"
archosrom="$pwd/rombox.ucl"
flash="$pwd/rockbox.ucl"
plugins="yes"
codecs=""
# toolset is the tools within the tools directory that we build for
# this particular target.
toolset=$archosbitmaptools
t_cpu="sh"
t_manufacturer="archos"
t_model="ondio"
;;
5|ondiofm)
target_id=8
archos="ondiofm"
target="-DARCHOS_ONDIOFM"
memory="2"
shcc
tool="$rootdir/tools/scramble -ofm"
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
output="ajbrec.ajz"
appextra="recorder:gui"
archosrom="$pwd/rombox.ucl"
flash="$pwd/rockbox.ucl"
plugins="yes"
codecs=""
toolset=$archosbitmaptools
t_cpu="sh"
t_manufacturer="archos"
t_model="ondio"
;;
6|av300)
target_id=26
archos="av300"
target="-DARCHOS_AV300"
memory=16 # always
arm7tdmicc
tool="$rootdir/tools/scramble -mm=C"
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
output="cjbm.ajz"
appextra="recorder:gui"
archosrom=""
flash=""
plugins="yes"
codecs=""
# toolset is the tools within the tools directory that we build for
# this particular target.
toolset="$toolset scramble descramble bmp2rb codepages"
# architecture, manufacturer and model for the target-tree build
t_cpu="arm"
t_manufacturer="archos"
t_model="av300"
;;
10|h120)
target_id=9
archos="h120"
target="-DIRIVER_H120"
memory=32 # always
coldfirecc
tool="$rootdir/tools/scramble -add=h120"
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 2"
bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
output="rockbox.iriver"
appextra="recorder:gui"
archosrom=""
flash="$pwd/rombox.iriver"
plugins="yes"
codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
# toolset is the tools within the tools directory that we build for
# this particular target.
toolset=$iriverbitmaptools
t_cpu="coldfire"
t_manufacturer="iriver"
t_model="h100"
;;
11|h300)
target_id=10
archos="h300"
target="-DIRIVER_H300"
memory=32 # always
coldfirecc
tool="$rootdir/tools/scramble -add=h300"
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
output="rockbox.iriver"
appextra="recorder:gui"
archosrom=""
flash=""
plugins="yes"
codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
# toolset is the tools within the tools directory that we build for
# this particular target.
toolset=$iriverbitmaptools
t_cpu="coldfire"
t_manufacturer="iriver"
t_model="h300"
;;
12|h100)
target_id=11
archos="h100"
target="-DIRIVER_H100"
memory=16 # always
coldfirecc
tool="$rootdir/tools/scramble -add=h100"
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 2"
bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
output="rockbox.iriver"
appextra="recorder:gui"
archosrom=""
flash=""
plugins="yes"
codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
# toolset is the tools within the tools directory that we build for
# this particular target.
toolset=$iriverbitmaptools
t_cpu="coldfire"
t_manufacturer="iriver"
t_model="h100"
;;
30|x5)
target_id=12
archos="x5"
target="-DIAUDIO_X5"
memory=16 # always
coldfirecc
tool="$rootdir/tools/scramble -add=iax5"
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 7"
output="rockbox.iaudio"
appextra="recorder:gui"
archosrom=""
flash=""
plugins="yes"
codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
# toolset is the tools within the tools directory that we build for
# this particular target.
toolset="$iaudiobitmaptools"
# architecture, manufacturer and model for the target-tree build
t_cpu="coldfire"
t_manufacturer="iaudio"
t_model="x5"
;;
31|m5)
target_id=28
archos="m5"
target="-DIAUDIO_M5"
memory=16 # always
coldfirecc
tool="$rootdir/tools/scramble -add=iam5"
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 2"
bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 7"
output="rockbox.iaudio"
appextra="recorder:gui"
archosrom=""
flash=""
plugins="yes"
codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
# toolset is the tools within the tools directory that we build for
# this particular target.
toolset="$iaudiobitmaptools"
# architecture, manufacturer and model for the target-tree build
t_cpu="coldfire"
t_manufacturer="iaudio"
t_model="m5"
;;
20|ipodcolor)
target_id=13
archos="ipodcolor"
target="-DIPOD_COLOR"
memory=32 # always
arm7tdmicc
tool="$rootdir/tools/scramble -add=ipco"
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
output="rockbox.ipod"
appextra="recorder:gui"
archosrom=""
flash=""
plugins="yes"
codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
bootoutput="bootloader-$archos.ipod"
# toolset is the tools within the tools directory that we build for
# this particular target.
toolset=$ipodbitmaptools
# architecture, manufacturer and model for the target-tree build
t_cpu="arm"
t_manufacturer="ipod"
t_model="color"
;;
21|ipodnano)
target_id=14
archos="ipodnano"
target="-DIPOD_NANO"
memory=32 # always
arm7tdmicc
tool="$rootdir/tools/scramble -add=nano"
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
output="rockbox.ipod"
appextra="recorder:gui"
archosrom=""
flash=""
plugins="yes"
codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
bootoutput="bootloader-$archos.ipod"
# toolset is the tools within the tools directory that we build for
# this particular target.
toolset=$ipodbitmaptools
# architecture, manufacturer and model for the target-tree build
t_cpu="arm"
t_manufacturer="ipod"
t_model="nano"
;;
22|ipodvideo)
target_id=15
archos="ipodvideo"
target="-DIPOD_VIDEO"
memory=32 # 30GB models have 32MB, 60GB have 64MB
arm7tdmicc
tool="$rootdir/tools/scramble -add=ipvd"
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
output="rockbox.ipod"
appextra="recorder:gui"
archosrom=""
flash=""
plugins="yes"
codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
bootoutput="bootloader-$archos.ipod"
# toolset is the tools within the tools directory that we build for
# this particular target.
toolset=$ipodbitmaptools
# architecture, manufacturer and model for the target-tree build
t_cpu="arm"
t_manufacturer="ipod"
t_model="video"
;;
23|ipod3g)
target_id=16
archos="ipod3g"
target="-DIPOD_3G"
memory=32 # always
arm7tdmicc
tool="$rootdir/tools/scramble -add=ip3g"
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
output="rockbox.ipod"
appextra="recorder:gui"
archosrom=""
flash=""
plugins="yes"
codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
bootoutput="bootloader-$archos.ipod"
# toolset is the tools within the tools directory that we build for
# this particular target.
toolset=$ipodbitmaptools
# architecture, manufacturer and model for the target-tree build
t_cpu="arm"
t_manufacturer="ipod"
t_model="3g"
;;
24|ipod4g)
target_id=17
archos="ipod4g"
target="-DIPOD_4G"
memory=32 # always
arm7tdmicc
tool="$rootdir/tools/scramble -add=ip4g"
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
output="rockbox.ipod"
appextra="recorder:gui"
archosrom=""
flash=""
plugins="yes"
codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
bootoutput="bootloader-$archos.ipod"
# toolset is the tools within the tools directory that we build for
# this particular target.
toolset=$ipodbitmaptools
# architecture, manufacturer and model for the target-tree build
t_cpu="arm"
t_manufacturer="ipod"
t_model="4g"
;;
25|ipodmini)
target_id=18
archos="ipodmini"
target="-DIPOD_MINI"
memory=32 # always
arm7tdmicc
tool="$rootdir/tools/scramble -add=mini"
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
output="rockbox.ipod"
appextra="recorder:gui"
archosrom=""
flash=""
plugins="yes"
codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
bootoutput="bootloader-$archos.ipod"
# toolset is the tools within the tools directory that we build for
# this particular target.
toolset=$ipodbitmaptools
# architecture, manufacturer and model for the target-tree build
t_cpu="arm"
t_manufacturer="ipod"
t_model="mini"
;;
13|ifp7xx)
target_id=19
archos="ifp7xx"
target="-DIRIVER_IFP7XX"
memory=1
arm7tdmicc short
tool="cp"
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
output="rockbox.wma"
appextra="recorder:gui"
archosrom=""
flash=""
plugins="yes"
codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
# toolset is the tools within the tools directory that we build for
# this particular target.
toolset=$genericbitmaptools
t_cpu="arm"
t_manufacturer="iriver"
t_model="ifp7xx"
;;
40|gigabeatf)
target_id=20
archos="gigabeatf"
target="-DGIGABEAT_F"
memory=32 # always
arm9tdmicc
tool="cp"
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
output="rockbox.gigabeat"
appextra="recorder:gui"
archosrom=""
flash=""
plugins="yes"
codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
toolset=$gigabeatbitmaptools
boottool="$rootdir/tools/scramble -gigabeat"
bootoutput="FWIMG01.DAT"
# architecture, manufacturer and model for the target-tree build
t_cpu="arm"
t_manufacturer="gigabeat"
t_model="meg-fx"
;;
26|ipodmini2g)
target_id=21
archos="ipodmini2g"
target="-DIPOD_MINI2G"
memory=32 # always
arm7tdmicc
tool="$rootdir/tools/scramble -add=mn2g"
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
output="rockbox.ipod"
appextra="recorder:gui"
archosrom=""
flash=""
plugins="yes"
codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
bootoutput="bootloader-$archos.ipod"
# toolset is the tools within the tools directory that we build for
# this particular target.
toolset=$ipodbitmaptools
# architecture, manufacturer and model for the target-tree build
t_cpu="arm"
t_manufacturer="ipod"
t_model="mini2g"
;;
14|h10)
target_id=22
archos="h10"
target="-DIRIVER_H10"
memory=32 # always
arm7tdmicc
tool="$rootdir/tools/scramble -add=h10"
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
output="rockbox.h10"
appextra="recorder:gui"
archosrom=""
flash=""
plugins="yes"
codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
boottool="$rootdir/tools/scramble -mi4v3"
bootoutput="H10_20GC.mi4"
# toolset is the tools within the tools directory that we build for
# this particular target.
toolset="$genericbitmaptools scramble"
# architecture, manufacturer and model for the target-tree build
t_cpu="arm"
t_manufacturer="iriver"
t_model="h10"
;;
50|e200)
target_id=23
archos="e200"
target="-DSANSA_E200"
memory=32 # supposedly
arm7tdmicc
tool="$rootdir/tools/scramble -add=e200"
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
output="rockbox.e200"
appextra="recorder:gui"
archosrom=""
flash=""
plugins="yes"
codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
boottool="$rootdir/tools/scramble -mi4v3"
bootoutput="PP5022.mi4"
# toolset is the tools within the tools directory that we build for
# this particular target.
toolset="$genericbitmaptools scramble"
# architecture, manufacturer and model for the target-tree build
t_cpu="arm"
t_manufacturer="sandisk"
t_model="sansa-e200"
;;
51|e200r)
# the e200R model is pretty much identical to the e200, it only has a
# different option to the scramble tool when building a bootloader and
# makes the bootloader output file name in all lower case.
target_id=27
archos="e200r"
target="-DSANSA_E200"
memory=32 # supposedly
arm7tdmicc
tool="$rootdir/tools/scramble -add=e200"
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
output="rockbox.e200"
appextra="recorder:gui"
archosrom=""
flash=""
plugins="yes"
codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
boottool="$rootdir/tools/scramble -mi4r"
bootoutput="pp5022.mi4"
# toolset is the tools within the tools directory that we build for
# this particular target.
toolset="$genericbitmaptools scramble"
# architecture, manufacturer and model for the target-tree build
t_cpu="arm"
t_manufacturer="sandisk"
t_model="sansa-e200"
;;
15|h10_5gb)
target_id=24
archos="h10_5gb"
target="-DIRIVER_H10_5GB"
memory=32 # always
arm7tdmicc
tool="$rootdir/tools/scramble -add=h10_5gb"
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
output="rockbox.h10"
appextra="recorder:gui"
archosrom=""
flash=""
plugins="yes"
codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
boottool="$rootdir/tools/scramble -mi4v2"
bootoutput="H10.mi4"
# toolset is the tools within the tools directory that we build for
# this particular target.
toolset="$genericbitmaptools scramble"
# architecture, manufacturer and model for the target-tree build
t_cpu="arm"
t_manufacturer="iriver"
t_model="h10"
;;
60|tpj1022)
target_id=25
archos="tpj1022"
target="-DELIO_TPJ1022"
memory=32 # always
arm7tdmicc
tool="$rootdir/tools/scramble -add tpj2"
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
output="rockbox.elio"
appextra="recorder:gui"
archosrom=""
flash=""
plugins="yes"
codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
boottool="$rootdir/tools/scramble -mi4v2"
bootoutput="pp5020.mi4"
# toolset is the tools within the tools directory that we build for
# this particular target.
toolset="$genericbitmaptools scramble"
# architecture, manufacturer and model for the target-tree build
t_cpu="arm"
t_manufacturer="tatung"
t_model="tpj1022"
;;
*)
echo "Please select a supported target platform!"
exit
;;
esac
echo "Platform set to $archos"
#remove start
############################################################################
# Amount of memory, for those that can differ.
#
if [ "$memory" = "2" ]; then
size="2"
if [ -z "$update" ]; then
echo "Enter size of your RAM (in MB): (defaults to 2)"
size=`input`;
fi
case $size in
8)
memory="8"
;;
*)
memory="2"
;;
esac
echo "Memory size selected: $memory MB"
fi
#remove end
##################################################################
# Figure out build "type"
#
# the ifp7x0 is the only platform that supports building a gdb stub like
# this
case $archos in
ifp7xx)
gdbstub="(G)DB stub, "
;;
*)
;;
esac
echo ""
echo "Build (N)ormal, (A)dvanced, (S)imulator, (B)ootloader, $gdbstub(M)anual, (V)oice? (N)"
option=`input`;
case $option in
[Bb])
if test -n "$archosrom"; then
# Archos SH-based players do this somewhat differently for
# some reason
appsdir='\$(ROOTDIR)/flash/bootbox'
apps="bootbox"
else
appsdir='\$(ROOTDIR)/bootloader'
apps="bootloader"
flash=""
if test -n "$boottool"; then
tool="$boottool"
fi
if test -n "$bootoutput"; then
output=$bootoutput
fi
fi
extradefines="-DBOOTLOADER -ffunction-sections -fdata-sections"
bootloader="1"
echo "Bootloader build selected"
;;
[Ss])
debug="-DDEBUG"
simulator="yes"
extradefines="-DSIMULATOR"
echo "Simulator build selected"
whichsim
;;
[Aa])
echo "Advanced build selected"
whichadvanced
;;
[Gg])
extradefines="-DSTUB" # for target makefile symbol EXTRA_DEFINES
appsdir='\$(ROOTDIR)/gdb'
apps="stub"
case $archos in
ifp7xx)
output="stub.wma"
;;
*)
;;
esac
echo "GDB stub build selected"
;;
[Mm])
appsdir='\$(ROOTDIR)/manual'
firmdir='\$(ROOTDIR)/manual/platform' # No Makefile here. Effectively ignores target
toolsdir=$firmdir;
toolset='';
apps="manual"
echo "Manual build selected"
;;
[Vv])
echo "Voice build selected"
voiceconfig
toolset="${toolset} voicefont wavtrim"
voice="yes"
;;
*)
debug=""
echo "Normal build selected"
;;
esac
# to be able running "make manual" from non-manual configuration
case $archos in
fmrecorder)
manualdev="recorderv2fm"
;;
recorderv2)
manualdev="recorderv2fm"
;;
h1??)
manualdev="h1xx"
;;
ipodmini2g)
manualdev="ipodmini"
;;
*)
manualdev=$archos
;;
esac
if [ -z "$debug" ]; then
GCCOPTS="$GCCOPTS $GCCOPTIMIZE"
fi
echo "Using source code root directory: $rootdir"
# this was once possible to change at build-time, but no more:
language="english"
# Ask about language if building voice
if [ "yes" = "$voice" ]; then
echo "Select a number for the language to use (default is english)"
picklang
language=`whichlang`
if [ -z "$language" ]; then
# pick a default
language="english"
fi
echo "Language set to $language"
fi
uname=`uname`
if [ "yes" = "$simulator" ]; then
# setup compiler and things for simulator
simcc
if [ -d "archos" ]; then
echo "sub directory archos already present"
else
mkdir archos
echo "created an archos subdirectory for simulating the hard disk"
fi
fi
# Now, figure out version number of the (gcc) compiler we are about to use
gccver=`$CC -dumpversion`;
if [ -z "$gccver" ]; then
echo "WARNING: The compiler you must use ($CC) is not in your path!"
echo "WARNING: this may cause your build to fail since we cannot do the"
echo "WARNING: checks we want now."
else
# gccver should now be "3.3.5", "3.4.3", "2.95.3-6" and similar, but don't
# DEPEND on it
num1=`echo $gccver | cut -d . -f1`
num2=`echo $gccver | cut -d . -f2`
gccnum=`(expr $num1 "*" 100 + $num2) 2>/dev/null`
# This makes:
# 3.3.X => 303
# 3.4.X => 304
# 2.95.3 => 295
echo "Using $CC $gccver ($gccnum)"
if test "$gccnum" -ge "400"; then
# gcc 4.0 is just *so* much pickier on arguments that differ in signedness
# so we ignore that warnings for now
# -Wno-pointer-sign
GCCOPTS="$GCCOPTS -Wno-pointer-sign"
fi
if test "$gccnum" -ge "401"; then
# this is a lame hack to avoid "warning: dereferencing type-punned pointer
# will break strict-aliasing rules"
GCCOPTS="$GCCOPTS -fno-strict-aliasing"
fi
fi
# check the compiler for SH platforms
if test "$CC" = "sh-elf-gcc"; then
if test "$gccnum" -lt "400"; then
echo "WARNING: Consider upgrading your compiler to the 4.0.X series!"
echo "WARNING: http://www.rockbox.org/twiki/bin/view/Main/CrossCompiler"
else
# figure out patch status
gccpatch=`$CC --version`;
if { echo $gccpatch | grep "rockbox" >/dev/null 2>&1; } then
echo "gcc $gccver is rockbox patched"
# then convert -O to -Os to get smaller binaries!
GCCOPTS=`echo $GCCOPTS | sed 's/ -O / -Os /'`
else
echo "WARNING: You use an unpatched gcc compiler: $gccver"
echo "WARNING: http://www.rockbox.org/twiki/bin/view/Main/CrossCompiler"
fi
fi
fi
if test "$1" = "--ccache"; then
echo "Enable ccache for building"
ccache="ccache"
else
if test "$1" != "--no-ccache"; then
ccache=`findtool ccache`
if test -n "$ccache"; then
echo "Found and uses ccache ($ccache)"
fi
fi
fi
if test -n "$ccache"; then
CC="$ccache $CC"
fi
if test "X$endian" = "Xbig"; then
defendian="ROCKBOX_BIG_ENDIAN"
else
defendian="ROCKBOX_LITTLE_ENDIAN"
fi
sed > autoconf.h \
-e "s,@ENDIAN@,${defendian},g" \
-e "s,^#undef ROCKBOX_HAS_LOGF,$use_logf,g" \
-e "s,@SIMSOUND@,$use_simsound,g" \
-e "s,@config_rtc@,$config_rtc,g" \
-e "s,@have_rtc_alarm@,$have_rtc_alarm,g" \
<<EOF
/* This header was made by configure */
#ifndef __BUILD_AUTOCONF_H
#define __BUILD_AUTOCONF_H
/* Define endianess for the target or simulator platform */
#define @ENDIAN@ 1
/* Define this if you build rockbox to support the logf logging and display */
#undef ROCKBOX_HAS_LOGF
/* Define this if you have the linux/soundcard.h header and thus can compile
the sound-playing code in the X11 sim */
@SIMSOUND@
/* optional defines for RTC mod for h1x0 */
@config_rtc@
@have_rtc_alarm@
#endif /* __BUILD_AUTOCONF_H */
EOF
if test -n "$t_cpu"; then
TARGET_INC="-I\$(FIRMDIR)/target/$t_cpu/$t_manufacturer/$t_model"
TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/$t_cpu/$t_manufacturer"
TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/$t_cpu"
GCCOPTS="$GCCOPTS"
fi
if test "$simulator" = "yes"; then
# add simul make stuff on the #SIMUL# line
simmagic1="s,@SIMUL1@,\$(SILENT)\$(MAKE) -C \$(SIMDIR) OBJDIR=\$(BUILDDIR)/sim,"
simmagic2="s,@SIMUL2@,\$(SILENT)\$(MAKE) -C \$(ROOTDIR)/uisimulator/common OBJDIR=\$(BUILDDIR)/comsim,"
else
# delete the lines that match
simmagic1='/@SIMUL1@/D'
simmagic2='/@SIMUL2@/D'
fi
sed > Makefile \
-e "s,@ROOTDIR@,${rootdir},g" \
-e "s,@DEBUG@,${debug},g" \
-e "s,@MEMORY@,${memory},g" \
-e "s,@TARGET_ID@,${target_id},g" \
-e "s,@TARGET@,${target},g" \
-e "s,@ARCHOS@,${archos},g" \
-e "s,@LANGUAGE@,${language},g" \
-e "s,@PWD@,${pwd},g" \
-e "s,@CC@,${CC},g" \
-e "s,@LD@,${LD},g" \
-e "s,@AR@,${AR},g" \
-e "s,@AS@,${AS},g" \
-e "s,@OC@,${OC},g" \
-e "s,@WINDRES@,${WINDRES},g" \
-e "s,@DLLTOOL@,${DLLTOOL},g" \
-e "s,@DLLWRAP@,${DLLWRAP},g" \
-e "s,@RANLIB@,${RANLIB},g" \
-e "s,@TOOL@,${tool},g" \
-e "s,@BMP2RB_NATIVE@,${bmp2rb_native},g" \
-e "s,@BMP2RB_MONO@,${bmp2rb_mono},g" \
-e "s,@BMP2RB_REMOTENATIVE@,${bmp2rb_remotenative},g" \
-e "s,@BMP2RB_REMOTEMONO@,${bmp2rb_remotemono},g" \
-e "s,@OUTPUT@,${output},g" \
-e "s,@APPEXTRA@,${appextra},g" \
-e "s,@ARCHOSROM@,${archosrom},g" \
-e "s,@FLASHFILE@,${flash},g" \
-e "s,@PLUGINS@,${plugins},g" \
-e "s,@CODECS@,${codecs},g" \
-e "s,@PROFILE_OPTS@,${PROFILE_OPTS},g" \
-e "s,@SHARED_FLAG@,${SHARED_FLAG},g" \
-e "s,@GCCOPTS@,${GCCOPTS},g" \
-e "s,@TARGET_INC@,${TARGET_INC},g" \
-e "s!@LDOPTS@!${LDOPTS}!g" \
-e "s,@LOADADDRESS@,${loadaddress},g" \
-e "s,@EXTRADEF@,${extradefines},g" \
-e "s,@APPSDIR@,${appsdir},g" \
-e "s,@FIRMDIR@,${firmdir},g" \
-e "s,@TOOLSDIR@,${toolsdir},g" \
-e "s,@APPS@,${apps},g" \
-e "s,@SIMVER@,${simver},g" \
-e "s,@GCCVER@,${gccver},g" \
-e "s,@GCCNUM@,${gccnum},g" \
-e "s,@UNAME@,${uname},g" \
-e "s,@ENDIAN@,${defendian},g" \
-e "s,@TOOLSET@,${toolset},g" \
-e "${simmagic1}" \
-e "${simmagic2}" \
-e "s,@MANUALDEV@,${manualdev},g" \
<<EOF
## Automaticly generated. http://www.rockbox.org/
ifndef V
SILENT=@
else
VERBOSEOPT=-v
endif
# old 'make' versions don't have the built-in 'info' function
info=old\$(shell echo >&2 "Consider upgrading to GNU make 3.81+ for optimum build performance.")
ifeq (\$(call info),old)
export info=echo "\$\$(1)";
endif
export ROOTDIR=@ROOTDIR@
export FIRMDIR=@FIRMDIR@
export APPSDIR=@APPSDIR@
export TOOLSDIR=@TOOLSDIR@
export DOCSDIR=\$(ROOTDIR)/docs
export MANUALDIR=\${ROOTDIR}/manual
export DEBUG=@DEBUG@
export ARCHOS=@ARCHOS@
export ARCHOSROM=@ARCHOSROM@
export FLASHFILE=@FLASHFILE@
export TARGET_ID=@TARGET_ID@
export TARGET=@TARGET@
export OBJDIR=@PWD@
export BUILDDIR=@PWD@
export LANGUAGE=@LANGUAGE@
export MEMORYSIZE=@MEMORY@
export VERSION=\$(shell \$(ROOTDIR)/tools/svnversion.sh \$(ROOTDIR))
export BUILDDATE=\$(shell date -u +'-DYEAR=%Y -DMONTH=%m -DDAY=%d')
export MKFIRMWARE=@TOOL@
export BMP2RB_MONO=@BMP2RB_MONO@
export BMP2RB_NATIVE=@BMP2RB_NATIVE@
export BMP2RB_REMOTEMONO=@BMP2RB_REMOTEMONO@
export BMP2RB_REMOTENATIVE=@BMP2RB_REMOTENATIVE@
export BINARY=@OUTPUT@
export APPEXTRA=@APPEXTRA@
export ENABLEDPLUGINS=@PLUGINS@
export SOFTWARECODECS=@CODECS@
export EXTRA_DEFINES=@EXTRADEF@
export HOSTCC=gcc
export CC=@CC@
export LD=@LD@
export AR=@AR@
export AS=@AS@
export OC=@OC@
export WINDRES=@WINDRES@
export DLLTOOL=@DLLTOOL@
export DLLWRAP=@DLLWRAP@
export RANLIB=@RANLIB@
export PROFILE_OPTS=@PROFILE_OPTS@
export GCCOPTS=@GCCOPTS@
export TARGET_INC=@TARGET_INC@
export LOADADDRESS=@LOADADDRESS@
export SIMVER=@SIMVER@
export SIMDIR=\$(ROOTDIR)/uisimulator/\$(SIMVER)
export SHARED_FLAG=@SHARED_FLAG@
export LDOPTS=@LDOPTS@
export GCCVER=@GCCVER@
export GCCNUM=@GCCNUM@
export UNAME=@UNAME@
export MANUALDEV=@MANUALDEV@
# Do not print "Entering directory ..."
MAKEFLAGS += --no-print-directory
.PHONY: all clean tags zip tools manual
all: tools
@SIMUL1@
@SIMUL2@
\$(SILENT)\$(MAKE) -C \$(FIRMDIR) OBJDIR=\$(BUILDDIR)/firmware
\$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@
bin: tools
@SIMUL1@
@SIMUL2@
\$(SILENT)\$(MAKE) -C \$(FIRMDIR) OBJDIR=\$(BUILDDIR)/firmware
\$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@ \$(BUILDDIR)/\$(BINARY)
veryclean: clean toolsclean
toolsclean:
\$(SILENT)\$(MAKE) -C \$(TOOLSDIR) clean
clean:
\$(SILENT)echo Cleaning build directory
\$(SILENT)rm -rf rockbox.zip TAGS @APPS@ firmware comsim sim lang.[ch]\
manual *.pdf *.a credits.raw @OUTPUT@ bitmaps pluginbitmaps \
@ARCHOSROM@ @FLASHFILE@ UI256.bmp rockbox-full.zip \
html txt rockbox-manual*.zip sysfont.h
voice: tools
\$(TOOLSDIR)/genvoice.sh \$(ROOTDIR) \$(LANGUAGE) \$(ARCHOS) voicesettings.sh
tools:
\$(SILENT)\$(MAKE) -C \$(TOOLSDIR) CC=\$(HOSTCC) @TOOLSET@
tags:
\$(SILENT)rm -f TAGS
\$(SILENT)\$(MAKE) -C \$(FIRMDIR) tags
\$(SILENT)\$(MAKE) -C \$(APPSDIR) tags
\$(SILENT)\$(MAKE) -C \$(APPSDIR)/plugins tags
\$(SILENT)\$(MAKE) -C \$(APPSDIR)/plugins/lib tags
fontzip:
\$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -r "\$(ROOTDIR)" -f 1 -o rockbox-fonts.zip \$(TARGET) \$(BINARY)
zip:
\$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
mapzip:
\$(SILENT)find . -name "*.map" | xargs zip rockbox-maps.zip
fullzip:
\$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -r "\$(ROOTDIR)" -f 2 -o rockbox-full.zip \$(TARGET) \$(BINARY)
7zip:
\$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -o "rockbox.7z" -z "7za a" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
tar:
\$(SILENT)rm -f rockbox.tar
\$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -o "rockbox.tar" -z "tar --no-recursion -uf" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
bzip2: tar
\$(SILENT)bzip2 -f9 rockbox.tar
gzip: tar
\$(SILENT)gzip -f9 rockbox.tar
manual: manual-pdf
manual-pdf:
\$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-pdf
manual-html:
\$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-html
manual-zhtml: manual-zip
manual-txt:
\$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-txt
manual-ztxt:
\$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-txt-zip
manual-zip:
\$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-zip
help:
@echo "A few helpful make targets"
@echo ""
@echo "all - builds a full Rockbox (default), including tools"
@echo "bin - builds only the Rockbox.<target name> file"
@echo "clean - cleans a build directory (not tools)"
@echo "veryclean - cleans the build and tools directories"
@echo "manual - builds a manual"
@echo "manual-html - HTML manual"
@echo "manual-zip - HTML manual (zipped)"
@echo "manual-txt - txt manual"
@echo "fullzip - creates a rockbox.zip of your build with fonts"
@echo "zip - creates a rockbox.zip of your build (no fonts)"
@echo "gzip - creates a rockbox.tar.gz of your build (no fonts)"
@echo "bzip2 - creates a rockbox.tar.bz2 of your build (no fonts)"
@echo "7zip - creates a rockbox.7z of your build (no fonts)"
@echo "fontzip - creates rockbox-fonts.zip"
@echo "mapzip - creates rockbox-maps.zip with all .map files"
@echo "tools - builds the tools only"
@echo "install - installs your build (for simulator builds only)"
EOF
if [ "yes" = "$simulator" ]; then
cat >> Makefile <<EOF
install:
@echo "installing a full setup in your archos dir"
@(\$(MAKE) fullzip && cd archos && unzip -oq ../rockbox-full.zip)
EOF
fi
echo "Created Makefile"