Minor cleanup
[Rockbox.git] / tools / configure
blob1cc7e6220e0731e7dca623cfcfeca42b4f40bde3
1 #!/bin/sh
2 # __________ __ ___.
3 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 # \/ \/ \/ \/ \/
8 # $Id$
11 # global CC options for all platforms
12 CCOPTS="-W -Wall -Wundef -O -nostdlib -ffreestanding -Wstrict-prototypes"
14 use_logf="#undef ROCKBOX_HAS_LOGF"
16 scriptver=`echo '$Revision$' | sed -e 's:\\$::g' -e 's/Revision: //'`
19 # Begin Function Definitions
21 input() {
22 read response
23 echo $response
26 prefixtools () {
27 prefix="$1"
28 CC=${prefix}gcc
29 WINDRES=${prefix}windres
30 DLLTOOL=${prefix}dlltool
31 DLLWRAP=${prefix}dllwrap
32 RANLIB=${prefix}ranlib
33 LD=${prefix}ld
34 AR=${prefix}ar
35 AS=${prefix}as
36 OC=${prefix}objcopy
39 crosswincc () {
40 # naive approach to selecting a mingw cross-compiler on linux/*nix
41 echo "Enabling win32 crosscompiling"
43 prefixtools i586-mingw32msvc-
45 LDOPTS="-lgdi32 -luser32 -mwindows"
46 # add cross-compiler option(s)
47 GCCOPTS="$GCCOPTS -mno-cygwin"
49 output="rockboxui.exe" # use this as output binary name
50 crosscompile="yes"
51 endian="little" # windows is little endian
54 # scan the $PATH for the given command
55 findtool(){
56 file="$1"
58 IFS=":"
59 for path in $PATH
61 # echo "checks for $file in $path" >&2
62 if test -f "$path/$file"; then
63 echo "$path/$file"
64 return
66 done
70 simcc () {
72 # default tool setup for native building
73 prefixtools ""
75 simver=sdl
76 GCCOPTS='-W -Wall -g -fno-builtin'
78 output="rockboxui" # use this as default output binary name
80 # generic sdl-config checker
81 sdl=`findtool sdl-config`
83 if [ -z "$sdl" ]; then
84 echo "configure didn't find sdl-config, which indicates that you"
85 echo "don't have SDL (properly) installed. Please correct and"
86 echo "re-run configure!"
87 exit
90 # default share option, override below if needed
91 SHARED_FLAG="-shared"
93 case $uname in
94 CYGWIN*)
95 echo "Cygwin host detected"
97 # sdl version
98 GCCOPTS="$GCCOPTS `sdl-config --cflags`"
99 LDOPTS="`sdl-config --libs` -mconsole"
101 output="rockboxui.exe" # use this as output binary name
104 Linux)
105 echo "Linux host detected"
106 GCCOPTS="$GCCOPTS"
107 if [ "0" != `sdl-config --libs |grep -c mwindows` ]; then
108 # Enable crosscompiling if sdl-config is from Windows SDL
109 crosswincc
111 GCCOPTS="$GCCOPTS `sdl-config --cflags`"
112 LDOPTS="`sdl-config --libs`"
115 FreeBSD)
116 echo "FreeBSD host detected"
117 # sdl version
118 GCCOPTS="$GCCOPTS `sdl-config --cflags`"
119 LDOPTS="`sdl-config --libs`"
122 Darwin)
123 echo "Darwin host detected"
124 # sdl version
125 GCCOPTS="$GCCOPTS `sdl-config --cflags`"
126 LDOPTS="`sdl-config --libs`"
127 SHARED_FLAG="-dynamiclib -Wl\,-single_module"
131 echo "Unsupported system: $uname, fix configure and retry"
132 exit
134 esac
136 if [ "`uname -m`" = "x86_64" ] || [ "`uname -m`" = "amd64" ]; then
137 # fPIC is needed to make shared objects link
138 # setting visibility to hidden is necessary to avoid strange crashes
139 # due to symbol clashing
140 GCCOPTS="$GCCOPTS -fPIC -fvisibility=hidden"
143 GCCOPTS="$GCCOPTS -I\$(SIMDIR)"
145 if test "X$crosscompile" != "Xyes"; then
146 id=$$
147 cat >/tmp/conftest-$id.c <<EOF
148 #include <stdio.h>
149 int main(int argc, char **argv)
151 int var=0;
152 char *varp = (char *)&var;
153 *varp=1;
155 printf("%d\n", var);
156 return 0;
160 $CC -o /tmp/conftest-$id /tmp/conftest-$id.c 2>/dev/null
162 if test `/tmp/conftest-$id 2>/dev/null` -gt "1"; then
163 # big endian
164 endian="big"
165 else
166 # little endian
167 endian="little"
169 echo "Simulator environment deemed $endian endian"
171 # use wildcard here to make it work even if it was named *.exe like
172 # on cygwin
173 rm -f /tmp/conftest-$id*
177 shcc () {
178 prefixtools sh-elf-
179 GCCOPTS="$CCOPTS -m1"
180 GCCOPTIMIZE="-fomit-frame-pointer -fschedule-insns"
181 endian="big"
184 calmrisccc () {
185 prefixtools calmrisc16-unknown-elf-
186 GCCOPTS="-Wl\,--no-check-sections $CCOPTS"
187 GCCOPTIMIZE="-fomit-frame-pointer"
188 endian="big"
191 coldfirecc () {
192 prefixtools m68k-elf-
193 GCCOPTS="$CCOPTS -m5206e -Wa\,-m5249 -malign-int -mstrict-align"
194 GCCOPTIMIZE="-fomit-frame-pointer"
195 endian="big"
198 arm7tdmicc () {
199 prefixtools arm-elf-
200 GCCOPTS="$CCOPTS -mcpu=arm7tdmi"
201 if test "X$1" != "Xshort"; then
202 GCCOPTS="$GCCOPTS -mlong-calls"
204 GCCOPTIMIZE="-fomit-frame-pointer"
205 endian="little"
208 arm9tdmicc () {
209 prefixtools arm-elf-
210 GCCOPTS="$CCOPTS -mcpu=arm9tdmi -mlong-calls"
211 GCCOPTIMIZE="-fomit-frame-pointer"
212 endian="little"
215 whichadvanced () {
216 ##################################################################
217 # Prompt for specific developer options
219 echo ""
220 echo "Enter your developer options (press enter when done)"
221 echo -n "(D)EBUG, (L)ogf, (S)imulator, (P)rofiling, (V)oice"
222 if [ "$memory" = "2" ]; then
223 echo -n ", (8)MB MOD"
225 if [ "$archos" = "h120" ]; then
226 echo -n ", (R)TC MOD"
228 echo ""
230 cont=1
232 while [ $cont = "1" ]; do
234 option=`input`;
236 case $option in
237 [Dd])
238 if [ "yes" = "$profile" ]; then
239 echo "Debug is incompatible with profiling"
240 else
241 echo "define DEBUG"
242 use_debug="yes"
245 [Ll])
246 echo "logf() support enabled"
247 logf="yes"
249 [Ss])
250 echo "Simulator build enabled"
251 simulator="yes"
253 [Pp])
254 if [ "yes" = "$use_debug" ]; then
255 echo "Profiling is incompatible with debug"
256 else
257 echo "Profiling support is enabled"
258 profile="yes"
261 [Vv])
262 echo "Voice build selected"
263 voice="yes"
266 if [ "$memory" = "2" ]; then
267 memory="8"
268 echo "Memory size selected: 8MB"
269 else
270 cont=0
273 [Rr])
274 if [ "$archos" = "h120" ]; then
275 config_rtc="#define CONFIG_RTC RTC_DS1339_DS3231"
276 have_rtc_alarm="#define HAVE_RTC_ALARM"
277 echo "RTC functions enabled (DS1339/DS3231)"
278 else
279 cont=0
283 cont=0
285 esac
286 done
287 echo "done"
289 if [ "yes" = "$voice" ]; then
290 toolset="${toolset} voicefont wavtrim"
292 # Ask about languages to build
293 echo "Select a number for the language to use (default is english)"
294 # The multiple-language feature is currently broken
295 # echo "You may enter a comma-separated list of languages to build"
297 picklang
298 voicelanguage=`whichlang`
300 if [ -z "$voicelanguage" ]; then
301 # pick a default
302 voicelanguage="english"
304 echo "Voice language set to $voicelanguage"
306 # Configure encoder and TTS engine for each language
307 for thislang in `echo $voicelanguage | sed 's/,/ /g'`; do
308 voiceconfig "$thislang"
309 done
311 if [ "yes" = "$use_debug" ]; then
312 debug="-DDEBUG"
313 GCCOPTS="$GCCOPTS -g -DDEBUG"
315 if [ "yes" = "$logf" ]; then
316 use_logf="#define ROCKBOX_HAS_LOGF 1"
318 if [ "yes" = "$simulator" ]; then
319 debug="-DDEBUG"
320 extradefines="$extradefines -DSIMULATOR"
322 if [ "yes" = "$profile" ]; then
323 extradefines="$extradefines -DRB_PROFILE"
324 PROFILE_OPTS="-finstrument-functions"
328 # Configure voice settings
329 voiceconfig () {
330 thislang=$1
331 echo "Building $thislang voice for $archos. Select options"
332 echo ""
334 if [ -f "`which flite`" ]; then
335 FLITE="F(l)ite "
336 FLITE_OPTS=""
337 DEFAULT_TTS="flite"
338 DEFAULT_TTS_OPTS=$FLITE_OPTS
339 DEFAULT_NOISEFLOOR="500"
340 DEFAULT_CHOICE="L"
342 if [ -f "`which espeak`" ]; then
343 ESPEAK="(e)Speak "
344 ESPEAK_OPTS=""
345 DEFAULT_TTS="espeak"
346 DEFAULT_TTS_OPTS=$ESPEAK_OPTS
347 DEFAULT_NOISEFLOOR="500"
348 DEFAULT_CHOICE="e"
350 if [ -f "`which festival`" ]; then
351 FESTIVAL="(F)estival "
352 case "$thislang" in
353 "italiano")
354 FESTIVAL_OPTS="--language italian"
356 "espanol")
357 FESTIVAL_OPTS="--language spanish"
359 "finnish")
360 FESTIVAL_OPTS="--language finnish"
362 "czech")
363 FESTIVAL_OPTS="--language czech"
366 FESTIVAL_OPTS=""
368 esac
369 DEFAULT_TTS="festival"
370 DEFAULT_TTS_OPTS=$FESTIVAL_OPTS
371 DEFAULT_NOISEFLOOR="500"
372 DEFAULT_CHOICE="F"
374 if [ -f "`which swift`" ]; then
375 SWIFT="S(w)ift "
376 SWIFT_OPTS=""
377 DEFAULT_TTS="swift"
378 DEFAULT_TTS_OPTS=$SWIFT_OPTS
379 DEFAULT_NOISEFLOOR="500"
380 DEFAULT_CHOICE="w"
382 # Allow SAPI if Windows is in use
383 if [ -f "`which winver`" ]; then
384 SAPI="(S)API "
385 SAPI_OPTS=""
386 DEFAULT_TTS="sapi"
387 DEFAULT_TTS_OPTS=$SAPI_OPTS
388 DEFAULT_NOISEFLOOR="500"
389 DEFAULT_CHOICE="S"
392 if [ "$FESTIVAL" = "$FLITE" ] && [ "$FLITE" = "$ESPEAK" ] && [ "$ESPEAK" = "$SAPI" ] && [ "$SAPI" = "$SWIFT" ]; then
393 echo "You need Festival, eSpeak or Flite in your path, or SAPI available to build voice files"
394 exit
397 echo "TTS engine to use: ${FLITE}${FESTIVAL}${ESPEAK}${SAPI}${SWIFT}(${DEFAULT_CHOICE})?"
398 option=`input`
399 case "$option" in
400 [Ll])
401 TTS_ENGINE="flite"
402 NOISEFLOOR="500" # TODO: check this value
403 TTS_OPTS=$FLITE_OPTS
405 [Ee])
406 TTS_ENGINE="espeak"
407 NOISEFLOOR="500"
408 TTS_OPTS=$ESPEAK_OPTS
410 [Ff])
411 TTS_ENGINE="festival"
412 NOISEFLOOR="500"
413 TTS_OPTS=$FESTIVAL_OPTS
415 [Ss])
416 TTS_ENGINE="sapi"
417 NOISEFLOOR="500"
418 TTS_OPTS=$SAPI_OPTS
420 [Ww])
421 TTS_ENGINE="swift"
422 NOISEFLOOR="500"
423 TTS_OPTS=$SWIFT_OPTS
426 TTS_ENGINE=$DEFAULT_TTS
427 TTS_OPTS=$DEFAULT_TTS_OPTS
428 NOISEFLOOR=$DEFAULT_NOISEFLOOR
429 esac
430 echo "Using $TTS_ENGINE for TTS"
432 # Allow the user to input manual commandline options
433 printf "Enter $TTS_ENGINE options (enter for defaults \"$TTS_OPTS\"): "
434 USER_TTS_OPTS=`input`
435 if [ -n "$USER_TTS_OPTS" ]; then
436 TTS_OPTS="$USER_TTS_OPTS"
439 echo ""
441 if [ -f "`which oggenc`" ]; then
442 OGGENC="(O)ggenc "
443 DEFAULT_ENC="oggenc"
444 VORBIS_OPTS="-q0 --downmix"
445 DEFAULT_ENC_OPTS=$VORBIS_OPTS
446 DEFAULT_CHOICE="O"
448 if [ -f "`which speexenc`" ]; then
449 SPEEXENC="(S)peexenc "
450 DEFAULT_ENC="speexenc"
451 SPEEX_OPTS="" # TODO: find appropriate options for speex
452 DEFAULT_ENC_OPTS=$SPEEX_OPTS
453 DEFAULT_CHOICE="S"
455 if [ -f "`which lame`" ]; then
456 LAME="(L)ame "
457 DEFAULT_ENC="lame"
458 LAME_OPTS="--resample 12 -t -m m -h -V 9 -S -B 64 --vbr-new"
459 DEFAULT_ENC_OPTS=$LAME_OPTS
460 DEFAULT_CHOICE="L"
463 if [ "$LAME" = "" ]; then
464 echo "You currently need to have Lame installed to build voice files"
467 # echo "Encoder to use: ${LAME}${OGGENC}${SPEEXENC}(${DEFAULT_CHOICE})?"
468 # echo ""
469 # echo "Note: Use Lame - the other options won't work"
470 # option=`input`
471 option="l"
472 case "$option" in
473 [Oo])
474 ENCODER="oggenc"
475 ENC_OPTS=$VORBIS_OPTS
477 [Ss])
478 ENCODER="speexenc"
479 ENC_OPTS=$SPEEX_OPTS
481 [Ll])
482 ENCODER="lame"
483 ENC_OPTS=$LAME_OPTS
486 ENCODER=$DEFAULT_ENC
487 ENC_OPTS=$DEFAULT_ENC_OPTS
488 esac
489 echo "Using $ENCODER for encoding voice clips"
491 # Allow the user to input manual commandline options
492 printf "Enter $ENCODER options (enter for defaults \"$ENC_OPTS\"): "
493 USER_ENC_OPTS=`input`
494 if [ -n "$USER_ENC_OPTS" ]; then
495 ENC_OPTS=$USER_ENC_OPTS
498 TEMPDIR="${pwd}"
499 if [ -f "`which cygpath`" ]; then
500 TEMPDIR=`cygpath . -a -w`
504 picklang() {
505 # figure out which languages that are around
506 for file in $rootdir/apps/lang/*.lang; do
507 clean=`echo $file | sed -e 's:.*/::g' | cut "-d." -f1`
508 langs="$langs $clean"
509 done
511 num=1
512 for one in $langs; do
513 echo "$num. $one"
514 num=`expr $num + 1`
515 done
517 read pick
520 whichlang() {
521 output=""
522 # Allow the user to pass a comma-separated list of langauges
523 for thispick in `echo $pick | sed 's/,/ /g'`; do
524 num=1
525 for one in $langs; do
526 # Accept both the language number and name
527 if [ "$num" = "$thispick" ] || [ "$thispick" = "$one" ]; then
528 if [ "$output" = "" ]; then
529 output=$one
530 else
531 output=$output,$one
534 num=`expr $num + 1`
535 done
536 done
537 echo $output
540 opt=$1
542 if test "$opt" = "--help"; then
543 echo "Rockbox configure script."
544 echo "Invoke this in a directory to generate a Makefile to build Rockbox"
545 echo "Do *NOT* run this within the tools directory!"
546 echo ""
547 echo "Usage: configure [--ccache][--no-ccache]"
548 exit
551 if test -r "configure"; then
552 # this is a check for a configure script in the current directory, it there
553 # is one, try to figure out if it is this one!
555 if { grep "^# Jukebox" configure >/dev/null 2>&1 ; } then
556 echo "WEEEEEEEEP. Don't run this configure script within the tools directory."
557 echo "It will only cause you pain and grief. Instead do this:"
558 echo ""
559 echo " cd .."
560 echo " mkdir build-dir"
561 echo " cd build-dir"
562 echo " ../tools/configure"
563 echo ""
564 echo "Much happiness will arise from this. Enjoy"
565 exit
569 # get our current directory
570 pwd=`pwd`;
572 if { echo $pwd | grep " "; } then
573 echo "You're running this script in a path that contains space. The build"
574 echo "system is unfortunately not clever enough to deal with this. Please"
575 echo "run the script from a different path, rename the path or fix the build"
576 echo "system!"
577 exit
580 if [ -z "$rootdir" ]; then
581 ##################################################################
582 # Figure out where the source code root is!
584 rootdir=`dirname $0`/../
586 #####################################################################
587 # Convert the possibly relative directory name to an absolute version
589 now=`pwd`
590 cd $rootdir
591 rootdir=`pwd`
593 # cd back to the build dir
594 cd $now
597 apps="apps"
598 appsdir='\$(ROOTDIR)/apps'
599 firmdir='\$(ROOTDIR)/firmware'
600 toolsdir='\$(ROOTDIR)/tools'
603 ##################################################################
604 # Figure out target platform
607 echo "Enter target platform:"
608 cat <<EOF
609 ==Archos== ==iriver== ==Apple iPod==
610 0) Player/Studio 10) H120/H140 20) Color/Photo
611 1) Recorder 11) H320/H340 21) Nano
612 2) FM Recorder 12) iHP-100/110/115 22) Video
613 3) Recorder v2 13) iFP-790 23) 3G
614 4) Ondio SP 14) H10 20Gb 24) 4G Grayscale
615 5) Ondio FM 15) H10 5/6Gb 25) Mini 1G
616 6) AV300 26) Mini 2G
617 27) 1G, 2G
619 ==iAudio== ==Toshiba== ==SanDisk==
620 30) X5/X5V/X5L 40) Gigabeat F 50) Sansa e200
621 31) M5/M5L 41) Gigabeat S 51) Sansa e200R
622 52) Sansa c200
624 ==Tatung== ==Olympus==
625 60) Elio TPJ-1022 70) M:Robe 500
628 buildfor=`input`;
630 # Set of tools built for all target platforms:
631 toolset="rdf2binary convbdf codepages"
633 # Toolsets for some target families:
634 archosbitmaptools="$toolset scramble descramble sh2d uclpack bmp2rb"
635 iriverbitmaptools="$toolset scramble descramble mkboot bmp2rb"
636 iaudiobitmaptools="$toolset scramble descramble mkboot bmp2rb"
637 ipodbitmaptools="$toolset scramble ipod_fw bmp2rb"
638 gigabeatbitmaptools="$toolset scramble descramble bmp2rb"
639 # generic is used by IFP, H10, Sansa-e200
640 genericbitmaptools="$toolset bmp2rb"
643 # ---- For each target ----
645 # *Variables*
646 # target_id: a unique number identifying this target, DOES NOT necessarily
647 # have to be the menu number. Just use the currently highest
648 # number+1 when you add a new target.
649 # archos: short model name used all over to identify this target
650 # memory: number of megabytes of RAM this target has. If the amount can
651 # be selected by the size prompt, let memory be unset here
652 # target: -Ddefine passed to the build commands to make the correct
653 # config-*.h file get included etc
654 # tool: the tool that takes a plain binary and converts that into a
655 # working "firmware" file for your target
656 # output: the final output file name
657 # boottool: the tool that takes a plain binary and generates a bootloader
658 # file for your target (or blank to use $tool)
659 # bootoutput:the final output file name for the bootloader (or blank to use
660 # $output)
661 # appextra: passed to the APPEXTRA variable in the Makefiles.
662 # TODO: add proper explanation
663 # archosrom: used only for Archos targets that build a special flashable .ucl
664 # image. Set to blank for other builds.
665 # flash: the same as archosrom. These two should be merged
666 # plugins: set to 'yes' to build the plugins. Early development builds can
667 # set this to no in the early stages to have an easier life for a
668 # while
669 # swcodec: set 'yes' on swcodec targets
670 # toolset: lists what particular tools in the tools/ directory that this
671 # target needs to have built prior to building Rockbox
673 # *Functions*
674 # *cc: sets up gcc and compiler options for your target builds. Note
675 # that if you select a simulator build, the compiler selection is
676 # overridden later in the script.
678 case $buildfor in
680 0|player)
681 target_id=1
682 archos="player"
683 target="-DARCHOS_PLAYER"
684 shcc
685 tool="$rootdir/tools/scramble"
686 output="archos.mod"
687 appextra="player:gui"
688 archosrom="$pwd/rombox.ucl"
689 flash="$pwd/rockbox.ucl"
690 plugins="yes"
691 swcodec=""
693 # toolset is the tools within the tools directory that we build for
694 # this particular target.
695 toolset="$toolset scramble descramble sh2d player_unifont uclpack"
697 # Note: the convbdf is present in the toolset just because: 1) the
698 # firmware/Makefile assumes it is present always, and 2) we will need it when we
699 # build the player simulator
701 t_cpu="sh"
702 t_manufacturer="archos"
703 t_model="player"
706 1|recorder)
707 target_id=2
708 archos="recorder"
709 target="-DARCHOS_RECORDER"
710 shcc
711 tool="$rootdir/tools/scramble"
712 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
713 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
714 output="ajbrec.ajz"
715 appextra="recorder:gui"
716 archosrom="" #"$pwd/rombox.ucl"
717 flash="$pwd/rockbox.ucl"
718 plugins="yes"
719 swcodec=""
720 # toolset is the tools within the tools directory that we build for
721 # this particular target.
722 toolset=$archosbitmaptools
723 t_cpu="sh"
724 t_manufacturer="archos"
725 t_model="recorder"
728 2|fmrecorder)
729 target_id=3
730 archos="fmrecorder"
731 target="-DARCHOS_FMRECORDER"
732 shcc
733 tool="$rootdir/tools/scramble -fm"
734 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
735 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
736 output="ajbrec.ajz"
737 appextra="recorder:gui"
738 archosrom="" #"$pwd/rombox.ucl"
739 flash="$pwd/rockbox.ucl"
740 plugins="yes"
741 swcodec=""
742 # toolset is the tools within the tools directory that we build for
743 # this particular target.
744 toolset=$archosbitmaptools
745 t_cpu="sh"
746 t_manufacturer="archos"
747 t_model="fm_v2"
750 3|recorderv2)
751 target_id=4
752 archos="recorderv2"
753 target="-DARCHOS_RECORDERV2"
754 shcc
755 tool="$rootdir/tools/scramble -v2"
756 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
757 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
758 output="ajbrec.ajz"
759 appextra="recorder:gui"
760 archosrom="" #"$pwd/rombox.ucl"
761 flash="$pwd/rockbox.ucl"
762 plugins="yes"
763 swcodec=""
764 # toolset is the tools within the tools directory that we build for
765 # this particular target.
766 toolset=$archosbitmaptools
767 t_cpu="sh"
768 t_manufacturer="archos"
769 t_model="fm_v2"
772 4|ondiosp)
773 target_id=7
774 archos="ondiosp"
775 target="-DARCHOS_ONDIOSP"
776 shcc
777 tool="$rootdir/tools/scramble -osp"
778 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
779 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
780 output="ajbrec.ajz"
781 appextra="recorder:gui"
782 archosrom="$pwd/rombox.ucl"
783 flash="$pwd/rockbox.ucl"
784 plugins="yes"
785 swcodec=""
786 # toolset is the tools within the tools directory that we build for
787 # this particular target.
788 toolset=$archosbitmaptools
789 t_cpu="sh"
790 t_manufacturer="archos"
791 t_model="ondio"
794 5|ondiofm)
795 target_id=8
796 archos="ondiofm"
797 target="-DARCHOS_ONDIOFM"
798 shcc
799 tool="$rootdir/tools/scramble -ofm"
800 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
801 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
802 output="ajbrec.ajz"
803 appextra="recorder:gui"
804 archosrom="" #"$pwd/rombox.ucl"
805 flash="$pwd/rockbox.ucl"
806 plugins="yes"
807 swcodec=""
808 toolset=$archosbitmaptools
809 t_cpu="sh"
810 t_manufacturer="archos"
811 t_model="ondio"
814 6|av300)
815 target_id=26
816 archos="av300"
817 target="-DARCHOS_AV300"
818 memory=16 # always
819 arm7tdmicc
820 tool="$rootdir/tools/scramble -mm=C"
821 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
822 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
823 output="cjbm.ajz"
824 appextra="recorder:gui"
825 archosrom=""
826 flash=""
827 plugins="yes"
828 swcodec=""
829 # toolset is the tools within the tools directory that we build for
830 # this particular target.
831 toolset="$toolset scramble descramble bmp2rb"
832 # architecture, manufacturer and model for the target-tree build
833 t_cpu="arm"
834 t_manufacturer="archos"
835 t_model="av300"
838 10|h120)
839 target_id=9
840 archos="h120"
841 target="-DIRIVER_H120"
842 memory=32 # always
843 coldfirecc
844 tool="$rootdir/tools/scramble -add=h120"
845 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
846 bmp2rb_native="$rootdir/tools/bmp2rb -f 2"
847 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
848 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
849 output="rockbox.iriver"
850 appextra="recorder:gui"
851 archosrom=""
852 flash="$pwd/rombox.iriver"
853 plugins="yes"
854 swcodec="yes"
855 # toolset is the tools within the tools directory that we build for
856 # this particular target.
857 toolset=$iriverbitmaptools
858 t_cpu="coldfire"
859 t_manufacturer="iriver"
860 t_model="h100"
863 11|h300)
864 target_id=10
865 archos="h300"
866 target="-DIRIVER_H300"
867 memory=32 # always
868 coldfirecc
869 tool="$rootdir/tools/scramble -add=h300"
870 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
871 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
872 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
873 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
874 output="rockbox.iriver"
875 appextra="recorder:gui"
876 archosrom=""
877 flash=""
878 plugins="yes"
879 swcodec="yes"
880 # toolset is the tools within the tools directory that we build for
881 # this particular target.
882 toolset=$iriverbitmaptools
883 t_cpu="coldfire"
884 t_manufacturer="iriver"
885 t_model="h300"
888 12|h100)
889 target_id=11
890 archos="h100"
891 target="-DIRIVER_H100"
892 memory=16 # always
893 coldfirecc
894 tool="$rootdir/tools/scramble -add=h100"
895 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
896 bmp2rb_native="$rootdir/tools/bmp2rb -f 2"
897 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
898 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
899 output="rockbox.iriver"
900 appextra="recorder:gui"
901 archosrom=""
902 flash=""
903 plugins="yes"
904 swcodec="yes"
905 # toolset is the tools within the tools directory that we build for
906 # this particular target.
907 toolset=$iriverbitmaptools
908 t_cpu="coldfire"
909 t_manufacturer="iriver"
910 t_model="h100"
913 13|ifp7xx)
914 target_id=19
915 archos="ifp7xx"
916 target="-DIRIVER_IFP7XX"
917 memory=1
918 arm7tdmicc short
919 tool="cp"
920 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
921 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
922 output="rockbox.wma"
923 appextra="recorder:gui"
924 archosrom=""
925 flash=""
926 plugins="yes"
927 swcodec="yes"
928 # toolset is the tools within the tools directory that we build for
929 # this particular target.
930 toolset=$genericbitmaptools
931 t_cpu="arm"
932 t_manufacturer="pnx0101"
933 t_model="iriver-ifp7xx"
936 14|h10)
937 target_id=22
938 archos="h10"
939 target="-DIRIVER_H10"
940 memory=32 # always
941 arm7tdmicc
942 tool="$rootdir/tools/scramble -mi4v3 -model=h10 -type=RBOS"
943 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
944 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
945 output="rockbox.mi4"
946 appextra="recorder:gui"
947 archosrom=""
948 flash=""
949 plugins="yes"
950 swcodec="yes"
951 boottool="$rootdir/tools/scramble -mi4v3 -model=h10 -type=RBBL"
952 bootoutput="H10_20GC.mi4"
953 # toolset is the tools within the tools directory that we build for
954 # this particular target.
955 toolset="$genericbitmaptools scramble"
956 # architecture, manufacturer and model for the target-tree build
957 t_cpu="arm"
958 t_manufacturer="iriver"
959 t_model="h10"
962 15|h10_5gb)
963 target_id=24
964 archos="h10_5gb"
965 target="-DIRIVER_H10_5GB"
966 memory=32 # always
967 arm7tdmicc
968 tool="$rootdir/tools/scramble -mi4v2 -model=h105 -type=RBOS"
969 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
970 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
971 output="rockbox.mi4"
972 appextra="recorder:gui"
973 archosrom=""
974 flash=""
975 plugins="yes"
976 swcodec="yes"
977 boottool="$rootdir/tools/scramble -mi4v2 -model=h105 -type=RBBL"
978 bootoutput="H10.mi4"
979 # toolset is the tools within the tools directory that we build for
980 # this particular target.
981 toolset="$genericbitmaptools scramble"
982 # architecture, manufacturer and model for the target-tree build
983 t_cpu="arm"
984 t_manufacturer="iriver"
985 t_model="h10"
988 20|ipodcolor)
989 target_id=13
990 archos="ipodcolor"
991 target="-DIPOD_COLOR"
992 memory=32 # always
993 arm7tdmicc
994 tool="$rootdir/tools/scramble -add=ipco"
995 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
996 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
997 output="rockbox.ipod"
998 appextra="recorder:gui"
999 archosrom=""
1000 flash=""
1001 plugins="yes"
1002 swcodec="yes"
1003 bootoutput="bootloader-$archos.ipod"
1004 # toolset is the tools within the tools directory that we build for
1005 # this particular target.
1006 toolset=$ipodbitmaptools
1007 # architecture, manufacturer and model for the target-tree build
1008 t_cpu="arm"
1009 t_manufacturer="ipod"
1010 t_model="color"
1013 21|ipodnano)
1014 target_id=14
1015 archos="ipodnano"
1016 target="-DIPOD_NANO"
1017 memory=32 # always
1018 arm7tdmicc
1019 tool="$rootdir/tools/scramble -add=nano"
1020 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1021 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
1022 output="rockbox.ipod"
1023 appextra="recorder:gui"
1024 archosrom=""
1025 flash=""
1026 plugins="yes"
1027 swcodec="yes"
1028 bootoutput="bootloader-$archos.ipod"
1029 # toolset is the tools within the tools directory that we build for
1030 # this particular target.
1031 toolset=$ipodbitmaptools
1032 # architecture, manufacturer and model for the target-tree build
1033 t_cpu="arm"
1034 t_manufacturer="ipod"
1035 t_model="nano"
1038 22|ipodvideo)
1039 target_id=15
1040 archos="ipodvideo"
1041 target="-DIPOD_VIDEO"
1042 arm7tdmicc
1043 tool="$rootdir/tools/scramble -add=ipvd"
1044 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1045 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1046 output="rockbox.ipod"
1047 appextra="recorder:gui"
1048 archosrom=""
1049 flash=""
1050 plugins="yes"
1051 swcodec="yes"
1052 bootoutput="bootloader-$archos.ipod"
1053 # toolset is the tools within the tools directory that we build for
1054 # this particular target.
1055 toolset=$ipodbitmaptools
1056 # architecture, manufacturer and model for the target-tree build
1057 t_cpu="arm"
1058 t_manufacturer="ipod"
1059 t_model="video"
1062 23|ipod3g)
1063 target_id=16
1064 archos="ipod3g"
1065 target="-DIPOD_3G"
1066 memory=32 # always
1067 arm7tdmicc
1068 tool="$rootdir/tools/scramble -add=ip3g"
1069 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1070 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1071 output="rockbox.ipod"
1072 appextra="recorder:gui"
1073 archosrom=""
1074 flash=""
1075 plugins="yes"
1076 swcodec="yes"
1077 bootoutput="bootloader-$archos.ipod"
1078 # toolset is the tools within the tools directory that we build for
1079 # this particular target.
1080 toolset=$ipodbitmaptools
1081 # architecture, manufacturer and model for the target-tree build
1082 t_cpu="arm"
1083 t_manufacturer="ipod"
1084 t_model="3g"
1087 24|ipod4g)
1088 target_id=17
1089 archos="ipod4g"
1090 target="-DIPOD_4G"
1091 memory=32 # always
1092 arm7tdmicc
1093 tool="$rootdir/tools/scramble -add=ip4g"
1094 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1095 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1096 output="rockbox.ipod"
1097 appextra="recorder:gui"
1098 archosrom=""
1099 flash=""
1100 plugins="yes"
1101 swcodec="yes"
1102 bootoutput="bootloader-$archos.ipod"
1103 # toolset is the tools within the tools directory that we build for
1104 # this particular target.
1105 toolset=$ipodbitmaptools
1106 # architecture, manufacturer and model for the target-tree build
1107 t_cpu="arm"
1108 t_manufacturer="ipod"
1109 t_model="4g"
1112 25|ipodmini)
1113 target_id=18
1114 archos="ipodmini"
1115 target="-DIPOD_MINI"
1116 memory=32 # always
1117 arm7tdmicc
1118 tool="$rootdir/tools/scramble -add=mini"
1119 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1120 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1121 output="rockbox.ipod"
1122 appextra="recorder:gui"
1123 archosrom=""
1124 flash=""
1125 plugins="yes"
1126 swcodec="yes"
1127 bootoutput="bootloader-$archos.ipod"
1128 # toolset is the tools within the tools directory that we build for
1129 # this particular target.
1130 toolset=$ipodbitmaptools
1131 # architecture, manufacturer and model for the target-tree build
1132 t_cpu="arm"
1133 t_manufacturer="ipod"
1134 t_model="mini"
1137 26|ipodmini2g)
1138 target_id=21
1139 archos="ipodmini2g"
1140 target="-DIPOD_MINI2G"
1141 memory=32 # always
1142 arm7tdmicc
1143 tool="$rootdir/tools/scramble -add=mn2g"
1144 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1145 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1146 output="rockbox.ipod"
1147 appextra="recorder:gui"
1148 archosrom=""
1149 flash=""
1150 plugins="yes"
1151 swcodec="yes"
1152 bootoutput="bootloader-$archos.ipod"
1153 # toolset is the tools within the tools directory that we build for
1154 # this particular target.
1155 toolset=$ipodbitmaptools
1156 # architecture, manufacturer and model for the target-tree build
1157 t_cpu="arm"
1158 t_manufacturer="ipod"
1159 t_model="mini2g"
1162 27|ipod1g2g)
1163 target_id=29
1164 archos="ipod1g2g"
1165 target="-DIPOD_1G2G"
1166 memory=32 # always
1167 arm7tdmicc
1168 tool="$rootdir/tools/scramble -add=1g2g"
1169 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1170 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1171 output="rockbox.ipod"
1172 appextra="recorder:gui"
1173 archosrom=""
1174 flash=""
1175 plugins="yes"
1176 swcodec="yes"
1177 bootoutput="bootloader-$archos.ipod"
1178 # toolset is the tools within the tools directory that we build for
1179 # this particular target.
1180 toolset=$ipodbitmaptools
1181 # architecture, manufacturer and model for the target-tree build
1182 t_cpu="arm"
1183 t_manufacturer="ipod"
1184 t_model="1g2g"
1187 30|x5)
1188 target_id=12
1189 archos="x5"
1190 target="-DIAUDIO_X5"
1191 memory=16 # always
1192 coldfirecc
1193 tool="$rootdir/tools/scramble -add=iax5"
1194 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1195 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1196 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
1197 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 7"
1198 output="rockbox.iaudio"
1199 appextra="recorder:gui"
1200 archosrom=""
1201 flash=""
1202 plugins="yes"
1203 swcodec="yes"
1204 # toolset is the tools within the tools directory that we build for
1205 # this particular target.
1206 toolset="$iaudiobitmaptools"
1207 # architecture, manufacturer and model for the target-tree build
1208 t_cpu="coldfire"
1209 t_manufacturer="iaudio"
1210 t_model="x5"
1213 31|m5)
1214 target_id=28
1215 archos="m5"
1216 target="-DIAUDIO_M5"
1217 memory=16 # always
1218 coldfirecc
1219 tool="$rootdir/tools/scramble -add=iam5"
1220 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1221 bmp2rb_native="$rootdir/tools/bmp2rb -f 2"
1222 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
1223 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 7"
1224 output="rockbox.iaudio"
1225 appextra="recorder:gui"
1226 archosrom=""
1227 flash=""
1228 plugins="yes"
1229 swcodec="yes"
1230 # toolset is the tools within the tools directory that we build for
1231 # this particular target.
1232 toolset="$iaudiobitmaptools"
1233 # architecture, manufacturer and model for the target-tree build
1234 t_cpu="coldfire"
1235 t_manufacturer="iaudio"
1236 t_model="m5"
1239 40|gigabeatf)
1240 target_id=20
1241 archos="gigabeatf"
1242 target="-DGIGABEAT_F"
1243 memory=32 # always
1244 arm9tdmicc
1245 tool="$rootdir/tools/scramble -add=giga"
1246 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1247 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1248 output="rockbox.gigabeat"
1249 appextra="recorder:gui"
1250 archosrom=""
1251 flash=""
1252 plugins="yes"
1253 swcodec="yes"
1254 toolset=$gigabeatbitmaptools
1255 boottool="$rootdir/tools/scramble -gigabeat"
1256 bootoutput="FWIMG01.DAT"
1257 # architecture, manufacturer and model for the target-tree build
1258 t_cpu="arm"
1259 t_manufacturer="s3c2440"
1260 t_model="gigabeat-fx"
1263 41|gigabeats)
1264 target_id=26
1265 archos="gigabeats"
1266 target="-DGIGABEAT_S"
1267 memory=32 # always
1268 arm9tdmicc
1269 tool="$rootdir/tools/scramble -add=gigs"
1270 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1271 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1272 output="rockbox.gigabeat"
1273 appextra="recorder:gui"
1274 archosrom=""
1275 flash=""
1276 plugins=""
1277 swcodec="yes"
1278 toolset=$gigabeatbitmaptools
1279 boottool="$rootdir/tools/scramble -gigabeats"
1280 bootoutput="nk.bin"
1281 # architecture, manufacturer and model for the target-tree build
1282 t_cpu="arm"
1283 t_manufacturer="imx31"
1284 t_model="gigabeat-s"
1287 70|mrobe500)
1288 target_id=20
1289 archos="mrobe500"
1290 target="-DMROBE_500"
1291 memory=64 # always
1292 arm9tdmicc
1293 tool="$rootdir/tools/scramble -add=m500"
1294 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1295 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1296 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
1297 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
1298 output="rockbox.mrobe500"
1299 appextra="recorder:gui"
1300 archosrom=""
1301 flash=""
1302 plugins="yes"
1303 swcodec="yes"
1304 toolset=$gigabeatbitmaptools
1305 boottool="cp "
1306 bootoutput="rockbox.mrboot"
1307 # architecture, manufacturer and model for the target-tree build
1308 t_cpu="arm"
1309 t_manufacturer="tms320dm320"
1310 t_model="mrobe-500"
1313 50|e200)
1314 target_id=23
1315 archos="e200"
1316 target="-DSANSA_E200"
1317 memory=32 # supposedly
1318 arm7tdmicc
1319 tool="$rootdir/tools/scramble -mi4v3 -model=e200 -type=RBOS"
1320 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1321 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1322 output="rockbox.mi4"
1323 appextra="recorder:gui"
1324 archosrom=""
1325 flash=""
1326 plugins="yes"
1327 swcodec="yes"
1328 boottool="$rootdir/tools/scramble -mi4v3 -model=e200 -type=RBBL"
1329 bootoutput="PP5022.mi4"
1330 # toolset is the tools within the tools directory that we build for
1331 # this particular target.
1332 toolset="$genericbitmaptools scramble"
1333 # architecture, manufacturer and model for the target-tree build
1334 t_cpu="arm"
1335 t_manufacturer="sandisk"
1336 t_model="sansa-e200"
1339 51|e200r)
1340 # the e200R model is pretty much identical to the e200, it only has a
1341 # different option to the scramble tool when building a bootloader and
1342 # makes the bootloader output file name in all lower case.
1343 target_id=27
1344 archos="e200r"
1345 target="-DSANSA_E200"
1346 memory=32 # supposedly
1347 arm7tdmicc
1348 tool="$rootdir/tools/scramble -mi4v3 -model=e20r -type=RBOS"
1349 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1350 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1351 output="rockbox.mi4"
1352 appextra="recorder:gui"
1353 archosrom=""
1354 flash=""
1355 plugins="yes"
1356 swcodec="yes"
1357 boottool="$rootdir/tools/scramble -mi4r -model=e20r -type=RBBL"
1358 bootoutput="pp5022.mi4"
1359 # toolset is the tools within the tools directory that we build for
1360 # this particular target.
1361 toolset="$genericbitmaptools scramble"
1362 # architecture, manufacturer and model for the target-tree build
1363 t_cpu="arm"
1364 t_manufacturer="sandisk"
1365 t_model="sansa-e200"
1368 52|c200)
1369 target_id=30
1370 archos="c200"
1371 target="-DSANSA_C200"
1372 memory=32 # supposedly
1373 arm7tdmicc
1374 tool="$rootdir/tools/scramble -mi4v3 -model=c200 -type=RBOS"
1375 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1376 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1377 output="rockbox.mi4"
1378 appextra="recorder:gui"
1379 archosrom=""
1380 flash=""
1381 plugins="yes"
1382 swcodec="yes"
1383 boottool="$rootdir/tools/scramble -mi4v3 -model=c200 -type=RBBL"
1384 bootoutput="firmware.mi4"
1385 # toolset is the tools within the tools directory that we build for
1386 # this particular target.
1387 toolset="$genericbitmaptools scramble"
1388 # architecture, manufacturer and model for the target-tree build
1389 t_cpu="arm"
1390 t_manufacturer="sandisk"
1391 t_model="sansa-c200"
1394 60|tpj1022)
1395 target_id=25
1396 archos="tpj1022"
1397 target="-DELIO_TPJ1022"
1398 memory=32 # always
1399 arm7tdmicc
1400 tool="$rootdir/tools/scramble -add tpj2"
1401 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1402 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
1403 output="rockbox.elio"
1404 appextra="recorder:gui"
1405 archosrom=""
1406 flash=""
1407 plugins="yes"
1408 swcodec="yes"
1409 boottool="$rootdir/tools/scramble -mi4v2"
1410 bootoutput="pp5020.mi4"
1411 # toolset is the tools within the tools directory that we build for
1412 # this particular target.
1413 toolset="$genericbitmaptools scramble"
1414 # architecture, manufacturer and model for the target-tree build
1415 t_cpu="arm"
1416 t_manufacturer="tatung"
1417 t_model="tpj1022"
1421 echo "Please select a supported target platform!"
1422 exit
1425 esac
1427 echo "Platform set to $archos"
1430 #remove start
1431 ############################################################################
1432 # Amount of memory, for those that can differ. They have $memory unset at
1433 # this point.
1436 if [ -z "$memory" ]; then
1438 case $target_id in
1440 echo "Enter size of your RAM (in MB): (Defaults to 32)"
1441 size=`input`;
1442 case $size in
1443 60|64)
1444 memory="64"
1447 memory="32"
1449 esac
1453 echo "Enter size of your RAM (in MB): (defaults to 2)"
1454 size=`input`;
1455 case $size in
1457 memory="8"
1460 memory="2"
1462 esac
1464 esac
1466 echo "Memory size selected: $memory MB"
1468 #remove end
1470 ##################################################################
1471 # Figure out build "type"
1474 # the ifp7x0 is the only platform that supports building a gdb stub like
1475 # this
1476 case $archos in
1477 ifp7xx)
1478 gdbstub="(G)DB stub, "
1480 e200r|e200)
1481 gdbstub="(I)installer, "
1485 esac
1487 echo ""
1488 echo "Build (N)ormal, (A)dvanced, (S)imulator, (B)ootloader, $gdbstub(M)anual (N)"
1490 option=`input`;
1492 case $option in
1493 [Ii])
1494 appsdir='\$(ROOTDIR)/bootloader'
1495 apps="bootloader"
1496 extradefines="-DBOOTLOADER -DE200R_INSTALLER -ffunction-sections -fdata-sections"
1497 bootloader="1"
1498 echo "e200R-installer build selected"
1500 [Bb])
1501 if test $t_manufacturer = "archos"; then
1502 # Archos SH-based players do this somewhat differently for
1503 # some reason
1504 appsdir='\$(ROOTDIR)/flash/bootbox'
1505 apps="bootbox"
1506 else
1507 appsdir='\$(ROOTDIR)/bootloader'
1508 apps="bootloader"
1509 flash=""
1510 if test -n "$boottool"; then
1511 tool="$boottool"
1513 if test -n "$bootoutput"; then
1514 output=$bootoutput
1517 extradefines="-DBOOTLOADER -ffunction-sections -fdata-sections"
1518 bootloader="1"
1519 echo "Bootloader build selected"
1521 [Ss])
1522 debug="-DDEBUG"
1523 simulator="yes"
1524 extradefines="-DSIMULATOR"
1525 echo "Simulator build selected"
1527 [Aa])
1528 echo "Advanced build selected"
1529 whichadvanced
1531 [Gg])
1532 extradefines="-DSTUB" # for target makefile symbol EXTRA_DEFINES
1533 appsdir='\$(ROOTDIR)/gdb'
1534 apps="stub"
1535 case $archos in
1536 ifp7xx)
1537 output="stub.wma"
1541 esac
1542 echo "GDB stub build selected"
1544 [Mm])
1545 appsdir='\$(ROOTDIR)/manual'
1546 firmdir='\$(ROOTDIR)/manual/platform' # No Makefile here. Effectively ig:res target
1547 toolsdir=$firmdir;
1548 toolset='';
1549 apps="manual"
1550 echo "Manual build selected"
1553 debug=""
1554 echo "Normal build selected"
1557 esac
1558 # to be able running "make manual" from non-manual configuration
1559 case $archos in
1560 fmrecorder)
1561 manualdev="recorderv2fm"
1563 recorderv2)
1564 manualdev="recorderv2fm"
1566 h1??)
1567 manualdev="h1xx"
1569 ipodmini2g)
1570 manualdev="ipodmini"
1573 manualdev=$archos
1575 esac
1577 if [ -z "$debug" ]; then
1578 GCCOPTS="$GCCOPTS $GCCOPTIMIZE"
1581 echo "Using source code root directory: $rootdir"
1583 # this was once possible to change at build-time, but no more:
1584 language="english"
1586 uname=`uname`
1588 if [ "yes" = "$simulator" ]; then
1589 # setup compiler and things for simulator
1590 simcc
1592 if [ -d "archos" ]; then
1593 echo "sub directory archos already present"
1594 else
1595 mkdir archos
1596 echo "created an archos subdirectory for simulating the hard disk"
1600 # Now, figure out version number of the (gcc) compiler we are about to use
1601 gccver=`$CC -dumpversion`;
1603 # figure out the binutil version too and display it, mostly for the build
1604 # system etc to be able to see it easier
1605 ldver=`$LD --version | head -n 1 | sed -e 's/[^0-9.]//g'`
1607 if [ -z "$gccver" ]; then
1608 echo "WARNING: The compiler you must use ($CC) is not in your path!"
1609 echo "WARNING: this may cause your build to fail since we cannot do the"
1610 echo "WARNING: checks we want now."
1611 else
1613 # gccver should now be "3.3.5", "3.4.3", "2.95.3-6" and similar, but don't
1614 # DEPEND on it
1616 num1=`echo $gccver | cut -d . -f1`
1617 num2=`echo $gccver | cut -d . -f2`
1618 gccnum=`(expr $num1 "*" 100 + $num2) 2>/dev/null`
1620 # This makes:
1621 # 3.3.X => 303
1622 # 3.4.X => 304
1623 # 2.95.3 => 295
1625 echo "Using $CC $gccver ($gccnum)"
1627 if test "$gccnum" -ge "400"; then
1628 # gcc 4.0 is just *so* much pickier on arguments that differ in signedness
1629 # so we ignore that warnings for now
1630 # -Wno-pointer-sign
1631 GCCOPTS="$GCCOPTS -Wno-pointer-sign"
1634 if test "$gccnum" -ge "401"; then
1635 # this is a lame hack to avoid "warning: dereferencing type-punned pointer
1636 # will break strict-aliasing rules"
1638 GCCOPTS="$GCCOPTS -fno-strict-aliasing"
1641 if test "$gccnum" -ge "402"; then
1642 # disable warning about "warning: initialized field overwritten" as gcc 4.2
1643 # and later would throw it for several valid cases
1644 GCCOPTS="$GCCOPTS -Wno-override-init"
1649 echo "Using $LD $ldver"
1651 # check the compiler for SH platforms
1652 if test "$CC" = "sh-elf-gcc"; then
1653 if test "$gccnum" -lt "400"; then
1654 echo "WARNING: Consider upgrading your compiler to the 4.0.X series!"
1655 echo "WARNING: http://www.rockbox.org/twiki/bin/view/Main/CrossCompiler"
1656 else
1657 # figure out patch status
1658 gccpatch=`$CC --version`;
1660 if { echo $gccpatch | grep "rockbox" >/dev/null 2>&1; } then
1661 echo "gcc $gccver is rockbox patched"
1662 # then convert -O to -Os to get smaller binaries!
1663 GCCOPTS=`echo $GCCOPTS | sed 's/ -O / -Os /'`
1664 else
1665 echo "WARNING: You use an unpatched gcc compiler: $gccver"
1666 echo "WARNING: http://www.rockbox.org/twiki/bin/view/Main/CrossCompiler"
1671 if test "$CC" = "m68k-elf-gcc"; then
1672 # convert -O to -Os to get smaller binaries!
1673 GCCOPTS=`echo $GCCOPTS | sed 's/ -O / -Os /'`
1676 if test "$1" = "--ccache"; then
1677 echo "Enable ccache for building"
1678 ccache="ccache"
1679 else
1680 if test "$1" != "--no-ccache"; then
1681 ccache=`findtool ccache`
1682 if test -n "$ccache"; then
1683 echo "Found and uses ccache ($ccache)"
1688 if test -n "$ccache"; then
1689 CC="$ccache $CC"
1692 if test "X$endian" = "Xbig"; then
1693 defendian="ROCKBOX_BIG_ENDIAN"
1694 else
1695 defendian="ROCKBOX_LITTLE_ENDIAN"
1698 sed > autoconf.h \
1699 -e "s,@ENDIAN@,${defendian},g" \
1700 -e "s,^#undef ROCKBOX_HAS_LOGF,$use_logf,g" \
1701 -e "s,@config_rtc@,$config_rtc,g" \
1702 -e "s,@have_rtc_alarm@,$have_rtc_alarm,g" \
1703 <<EOF
1704 /* This header was made by configure */
1705 #ifndef __BUILD_AUTOCONF_H
1706 #define __BUILD_AUTOCONF_H
1708 /* Define endianess for the target or simulator platform */
1709 #define @ENDIAN@ 1
1711 /* Define this if you build rockbox to support the logf logging and display */
1712 #undef ROCKBOX_HAS_LOGF
1714 /* optional defines for RTC mod for h1x0 */
1715 @config_rtc@
1716 @have_rtc_alarm@
1718 #endif /* __BUILD_AUTOCONF_H */
1721 if test -n "$t_cpu"; then
1722 TARGET_INC="-I\$(FIRMDIR)/target/$t_cpu/$t_manufacturer/$t_model"
1723 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/$t_cpu/$t_manufacturer"
1724 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/$t_cpu"
1725 GCCOPTS="$GCCOPTS"
1728 if test "$simulator" = "yes"; then
1729 # add simul make stuff on the #SIMUL# line
1730 simmagic1="s,@SIMUL1@,\$(SILENT)\$(MAKE) -C \$(SIMDIR) OBJDIR=\$(BUILDDIR)/sim,"
1731 simmagic2="s,@SIMUL2@,\$(SILENT)\$(MAKE) -C \$(ROOTDIR)/uisimulator/common OBJDIR=\$(BUILDDIR)/comsim,"
1732 else
1733 # delete the lines that match
1734 simmagic1='/@SIMUL1@/D'
1735 simmagic2='/@SIMUL2@/D'
1738 sed > Makefile \
1739 -e "s,@ROOTDIR@,${rootdir},g" \
1740 -e "s,@DEBUG@,${debug},g" \
1741 -e "s,@MEMORY@,${memory},g" \
1742 -e "s,@TARGET_ID@,${target_id},g" \
1743 -e "s,@TARGET@,${target},g" \
1744 -e "s,@CPU@,${t_cpu},g" \
1745 -e "s,@MANUFACTURER@,${t_manufacturer},g" \
1746 -e "s,@ARCHOS@,${archos},g" \
1747 -e "s,@LANGUAGE@,${language},g" \
1748 -e "s:@VOICELANGUAGE@:${voicelanguage}:g" \
1749 -e "s,@PWD@,${pwd},g" \
1750 -e "s,@CC@,${CC},g" \
1751 -e "s,@LD@,${LD},g" \
1752 -e "s,@AR@,${AR},g" \
1753 -e "s,@AS@,${AS},g" \
1754 -e "s,@OC@,${OC},g" \
1755 -e "s,@WINDRES@,${WINDRES},g" \
1756 -e "s,@DLLTOOL@,${DLLTOOL},g" \
1757 -e "s,@DLLWRAP@,${DLLWRAP},g" \
1758 -e "s,@RANLIB@,${RANLIB},g" \
1759 -e "s,@TOOL@,${tool},g" \
1760 -e "s,@BMP2RB_NATIVE@,${bmp2rb_native},g" \
1761 -e "s,@BMP2RB_MONO@,${bmp2rb_mono},g" \
1762 -e "s,@BMP2RB_REMOTENATIVE@,${bmp2rb_remotenative},g" \
1763 -e "s,@BMP2RB_REMOTEMONO@,${bmp2rb_remotemono},g" \
1764 -e "s,@OUTPUT@,${output},g" \
1765 -e "s,@APPEXTRA@,${appextra},g" \
1766 -e "s,@ARCHOSROM@,${archosrom},g" \
1767 -e "s,@FLASHFILE@,${flash},g" \
1768 -e "s,@PLUGINS@,${plugins},g" \
1769 -e "s,@CODECS@,${swcodec},g" \
1770 -e "s,@PROFILE_OPTS@,${PROFILE_OPTS},g" \
1771 -e "s,@SHARED_FLAG@,${SHARED_FLAG},g" \
1772 -e "s,@GCCOPTS@,${GCCOPTS},g" \
1773 -e "s,@TARGET_INC@,${TARGET_INC},g" \
1774 -e "s!@LDOPTS@!${LDOPTS}!g" \
1775 -e "s,@LOADADDRESS@,${loadaddress},g" \
1776 -e "s,@EXTRADEF@,${extradefines},g" \
1777 -e "s,@APPSDIR@,${appsdir},g" \
1778 -e "s,@FIRMDIR@,${firmdir},g" \
1779 -e "s,@TOOLSDIR@,${toolsdir},g" \
1780 -e "s,@APPS@,${apps},g" \
1781 -e "s,@SIMVER@,${simver},g" \
1782 -e "s,@GCCVER@,${gccver},g" \
1783 -e "s,@GCCNUM@,${gccnum},g" \
1784 -e "s,@UNAME@,${uname},g" \
1785 -e "s,@ENDIAN@,${defendian},g" \
1786 -e "s,@TOOLSET@,${toolset},g" \
1787 -e "${simmagic1}" \
1788 -e "${simmagic2}" \
1789 -e "s,@MANUALDEV@,${manualdev},g" \
1790 -e "s,@ENCODER@,${ENCODER},g" \
1791 -e "s,@ENC_OPTS@,${ENC_OPTS},g" \
1792 -e "s,@TTS_ENGINE@,${TTS_ENGINE},g" \
1793 -e "s,@TTS_OPTS@,${TTS_OPTS},g" \
1794 <<EOF
1795 ## Automaticly generated. http://www.rockbox.org/
1797 ifndef V
1798 SILENT=@
1799 else
1800 VERBOSEOPT=-v
1801 endif
1803 # old 'make' versions don't have the built-in 'info' function
1804 info=old\$(shell echo >&2 "Consider upgrading to GNU make 3.81+ for optimum build performance.")
1805 ifeq (\$(call info),old)
1806 export info=echo "\$\$(1)";
1807 endif
1809 export ROOTDIR=@ROOTDIR@
1810 export FIRMDIR=@FIRMDIR@
1811 export APPSDIR=@APPSDIR@
1812 export TOOLSDIR=@TOOLSDIR@
1813 export DOCSDIR=\$(ROOTDIR)/docs
1814 export MANUALDIR=\${ROOTDIR}/manual
1815 export DEBUG=@DEBUG@
1816 export ARCHOS=@ARCHOS@
1817 export ARCHOSROM=@ARCHOSROM@
1818 export FLASHFILE=@FLASHFILE@
1819 export TARGET_ID=@TARGET_ID@
1820 export TARGET=@TARGET@
1821 export CPU=@CPU@
1822 export MANUFACTURER=@MANUFACTURER@
1823 export OBJDIR=@PWD@
1824 export BUILDDIR=@PWD@
1825 export LANGUAGE=@LANGUAGE@
1826 export VOICELANGUAGE=@VOICELANGUAGE@
1827 export MEMORYSIZE=@MEMORY@
1828 export VERSION=\$(shell \$(ROOTDIR)/tools/svnversion.sh \$(ROOTDIR))
1829 export BUILDDATE=\$(shell date -u +'-DYEAR=%Y -DMONTH=%m -DDAY=%d')
1830 export MKFIRMWARE=@TOOL@
1831 export BMP2RB_MONO=@BMP2RB_MONO@
1832 export BMP2RB_NATIVE=@BMP2RB_NATIVE@
1833 export BMP2RB_REMOTEMONO=@BMP2RB_REMOTEMONO@
1834 export BMP2RB_REMOTENATIVE=@BMP2RB_REMOTENATIVE@
1835 export BINARY=@OUTPUT@
1836 export APPEXTRA=@APPEXTRA@
1837 export ENABLEDPLUGINS=@PLUGINS@
1838 export SOFTWARECODECS=@CODECS@
1839 export EXTRA_DEFINES=@EXTRADEF@
1840 export HOSTCC=gcc
1841 export CC=@CC@
1842 export LD=@LD@
1843 export AR=@AR@
1844 export AS=@AS@
1845 export OC=@OC@
1846 export WINDRES=@WINDRES@
1847 export DLLTOOL=@DLLTOOL@
1848 export DLLWRAP=@DLLWRAP@
1849 export RANLIB=@RANLIB@
1850 export PROFILE_OPTS=@PROFILE_OPTS@
1851 export SIMVER=@SIMVER@
1852 export SIMDIR=\$(ROOTDIR)/uisimulator/sdl
1853 export GCCOPTS=@GCCOPTS@
1854 export TARGET_INC=@TARGET_INC@
1855 export LOADADDRESS=@LOADADDRESS@
1856 export SHARED_FLAG=@SHARED_FLAG@
1857 export LDOPTS=@LDOPTS@
1858 export GCCVER=@GCCVER@
1859 export GCCNUM=@GCCNUM@
1860 export UNAME=@UNAME@
1861 export MANUALDEV=@MANUALDEV@
1862 export TTS_OPTS=@TTS_OPTS@
1863 export TTS_ENGINE=@TTS_ENGINE@
1864 export ENC_OPTS=@ENC_OPTS@
1865 export ENCODER=@ENCODER@
1867 # Do not print "Entering directory ..."
1868 MAKEFLAGS += --no-print-directory
1870 .PHONY: all clean tags zip tools manual bin build info
1872 all: info
1874 info: build
1875 \$(SILENT)\$(TOOLSDIR)/mkinfo.pl \$(BUILDDIR)/rockbox-info.txt
1877 build: tools
1878 @SIMUL1@
1879 @SIMUL2@
1880 \$(SILENT)\$(MAKE) -C \$(FIRMDIR) OBJDIR=\$(BUILDDIR)/firmware
1881 \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@
1883 bin: tools
1884 @SIMUL1@
1885 @SIMUL2@
1886 \$(SILENT)\$(MAKE) -C \$(FIRMDIR) OBJDIR=\$(BUILDDIR)/firmware
1887 \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@ \$(BUILDDIR)/\$(BINARY)
1889 rocks: tools
1890 \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@ rocks
1892 veryclean: clean toolsclean
1894 toolsclean:
1895 \$(SILENT)\$(MAKE) -C \$(TOOLSDIR) clean
1897 clean:
1898 \$(SILENT)echo Cleaning build directory
1899 \$(SILENT)rm -rf rockbox.zip TAGS @APPS@ firmware comsim sim lang.[ch]\
1900 manual *.pdf *.a credits.raw @OUTPUT@ bitmaps pluginbitmaps \
1901 @ARCHOSROM@ @FLASHFILE@ UI256.bmp rockbox-full.zip \
1902 html txt rockbox-manual*.zip sysfont.h rockbox-info.txt \
1903 voicefontids *.wav *.mp3 *.voice
1905 tools:
1906 \$(SILENT)\$(MAKE) -C \$(TOOLSDIR) CC=\$(HOSTCC) @TOOLSET@
1908 tags:
1909 \$(SILENT)rm -f TAGS
1910 \$(SILENT)\$(MAKE) -C \$(FIRMDIR) tags
1911 \$(SILENT)\$(MAKE) -C \$(APPSDIR) tags
1912 \$(SILENT)\$(MAKE) -C \$(APPSDIR)/plugins tags
1913 \$(SILENT)\$(MAKE) -C \$(APPSDIR)/plugins/lib tags
1915 fontzip:
1916 \$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -r "\$(ROOTDIR)" -f 1 -o rockbox-fonts.zip \$(TARGET) \$(BINARY)
1918 zip:
1919 \$(SILENT)for f in \`cat \$(BUILDDIR)/@APPS@/features\`; do feat="\$\$feat:\$\$f" ; done ; \\
1920 \$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\$\$feat\" -i \"\$(TARGET_ID)\" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
1922 mapzip:
1923 \$(SILENT)find . -name "*.map" | xargs zip rockbox-maps.zip
1925 fullzip:
1926 \$(SILENT)for f in \`cat \$(BUILDDIR)/@APPS@/features\`; do feat="\$\$feat:\$\$f" ; done; \\
1927 \$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\$\$feat\" -i \"\$(TARGET_ID)\" -r "\$(ROOTDIR)" -f 2 -o rockbox-full.zip \$(TARGET) \$(BINARY)
1929 7zip:
1930 \$(SILENT)for f in \`cat \$(BUILDDIR)/@APPS@/features\`; do feat="\$\$feat:\$\$f" ; done; \\
1931 \$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\$\$feat\" -i \"\$(TARGET_ID)\" -o "rockbox.7z" -z "7za a" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
1933 tar:
1934 \$(SILENT)rm -f rockbox.tar
1935 \$(SILENT)for f in \`cat \$(BUILDDIR)/@APPS@/features\`; do feat="\$\$feat:\$\$f" ; done; \\
1936 \$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\$\$feat\" -i \"\$(TARGET_ID)\" -o "rockbox.tar" -z "tar --no-recursion -uf" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
1938 bzip2: tar
1939 \$(SILENT)bzip2 -f9 rockbox.tar
1941 gzip: tar
1942 \$(SILENT)gzip -f9 rockbox.tar
1944 manual: manual-pdf
1945 manual-pdf:
1946 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-pdf
1947 manual-html:
1948 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-html
1949 manual-zhtml: manual-zip
1950 manual-txt:
1951 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-txt
1952 manual-ztxt:
1953 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-txt-zip
1954 manual-zip:
1955 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-zip
1957 features:
1958 \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@ features
1960 help:
1961 @echo "A few helpful make targets"
1962 @echo ""
1963 @echo "all - builds a full Rockbox (default), including tools"
1964 @echo "bin - builds only the Rockbox.<target name> file"
1965 @echo "clean - cleans a build directory (not tools)"
1966 @echo "veryclean - cleans the build and tools directories"
1967 @echo "manual - builds a manual"
1968 @echo "manual-html - HTML manual"
1969 @echo "manual-zip - HTML manual (zipped)"
1970 @echo "manual-txt - txt manual"
1971 @echo "fullzip - creates a rockbox.zip of your build with fonts"
1972 @echo "zip - creates a rockbox.zip of your build (no fonts)"
1973 @echo "gzip - creates a rockbox.tar.gz of your build (no fonts)"
1974 @echo "bzip2 - creates a rockbox.tar.bz2 of your build (no fonts)"
1975 @echo "7zip - creates a rockbox.7z of your build (no fonts)"
1976 @echo "fontzip - creates rockbox-fonts.zip"
1977 @echo "mapzip - creates rockbox-maps.zip with all .map files"
1978 @echo "tools - builds the tools only"
1979 @echo "install - installs your build (for simulator builds only)"
1983 if [ "yes" = "$simulator" ]; then
1985 cat >> Makefile <<EOF
1987 install:
1988 @echo "installing a full setup in your archos dir"
1989 @(\$(MAKE) fullzip && cd archos && unzip -oq ../rockbox-full.zip)
1994 if [ "yes" = "$voice" ]; then
1996 cat >> Makefile <<EOF
1998 voice: tools features
1999 \$(SILENT)for f in \`cat \$(BUILDDIR)/${apps}/features\`; do feat="\$\$feat:\$\$f" ; done ; \\
2000 for lang in \`echo \$(VOICELANGUAGE) |sed "s/,/ /g"\`; do \$(TOOLSDIR)/voice.pl -V -l=\$\$lang -t=\$(ARCHOS)\$\$feat -i=\$(TARGET_ID) -e=\$(ENCODER) -E="\$(ENC_OPTS)" -s=\$(TTS_ENGINE) -S="\$(TTS_OPTS)"; done \\
2005 echo "Created Makefile"