Fix the red Gigabeat bootloader: Add a dummy for button_backlight_on with the rest...
[kugel-rb.git] / tools / configure
bloba507fdd31a91be61050136a6746dbab36b37c94f
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 LDOPTS='-L/usr/X11R6/lib -lX11 -lm -lXt -lXmu -dl -lpthread'
120 Darwin)
121 echo "Darwin host detected"
122 # sdl version
123 GCCOPTS="$GCCOPTS `sdl-config --cflags`"
124 LDOPTS="`sdl-config --libs`"
125 SHARED_FLAG="-dynamiclib -Wl\,-single_module"
129 echo "Unsupported system: $uname, fix configure and retry"
130 exit
132 esac
134 if [ "`uname -m`" = "x86_64" ]; then
135 GCCOPTS="$GCCOPTS -fPIC" # needed to make shared objects link
138 GCCOPTS="$GCCOPTS -I\$(SIMDIR)"
140 if test "X$crosscompile" != "Xyes"; then
141 id=$$
142 cat >/tmp/conftest-$id.c <<EOF
143 #include <stdio.h>
144 int main(int argc, char **argv)
146 int var=0;
147 char *varp = (char *)&var;
148 *varp=1;
150 printf("%d\n", var);
151 return 0;
155 $CC -o /tmp/conftest-$id /tmp/conftest-$id.c 2>/dev/null
157 if test `/tmp/conftest-$id 2>/dev/null` -gt "1"; then
158 # big endian
159 endian="big"
160 else
161 # little endian
162 endian="little"
164 echo "Simulator environment deemed $endian endian"
166 # use wildcard here to make it work even if it was named *.exe like
167 # on cygwin
168 rm -f /tmp/conftest-$id*
172 shcc () {
173 prefixtools sh-elf-
174 GCCOPTS="$CCOPTS -m1"
175 GCCOPTIMIZE="-fomit-frame-pointer -fschedule-insns"
176 endian="big"
179 calmrisccc () {
180 prefixtools calmrisc16-unknown-elf-
181 GCCOPTS="-Wl\,--no-check-sections $CCOPTS"
182 GCCOPTIMIZE="-fomit-frame-pointer"
183 endian="big"
186 coldfirecc () {
187 prefixtools m68k-elf-
188 GCCOPTS="$CCOPTS -m5206e -Wa\,-m5249 -malign-int -mstrict-align"
189 GCCOPTIMIZE="-fomit-frame-pointer"
190 endian="big"
193 arm7tdmicc () {
194 prefixtools arm-elf-
195 GCCOPTS="$CCOPTS -mcpu=arm7tdmi"
196 if test "X$1" != "Xshort"; then
197 GCCOPTS="$GCCOPTS -mlong-calls"
199 GCCOPTIMIZE="-fomit-frame-pointer"
200 endian="little"
203 arm9tdmicc () {
204 prefixtools arm-elf-
205 GCCOPTS="$CCOPTS -mcpu=arm9tdmi -mlong-calls"
206 GCCOPTIMIZE="-fomit-frame-pointer"
207 endian="little"
210 whichadvanced () {
211 ##################################################################
212 # Prompt for specific developer options
214 echo ""
215 echo "Enter your developer options (press enter when done)"
216 echo -n "(D)EBUG, (L)ogf, (S)imulator, (P)rofiling"
217 if [ "$memory" = "2" ]; then
218 echo -n ", (8)MB MOD"
220 if [ "$archos" = "h120" ]; then
221 echo -n ", (R)TC MOD"
223 echo ""
225 cont=1
227 while [ $cont = "1" ]; do
229 option=`input`;
231 case $option in
232 [Dd])
233 if [ "yes" = "$profile" ]; then
234 echo "Debug is incompatible with profiling"
235 else
236 echo "define DEBUG"
237 use_debug="yes"
240 [Ll])
241 echo "logf() support enabled"
242 logf="yes"
244 [Ss])
245 echo "Simulator build enabled"
246 simulator="yes"
248 [Pp])
249 if [ "yes" = "$use_debug" ]; then
250 echo "Profiling is incompatible with debug"
251 else
252 echo "Profiling support is enabled"
253 profile="yes"
257 if [ "$memory" = "2" ]; then
258 memory="8"
259 echo "Memory size selected: 8MB"
260 else
261 cont=0
264 [Rr])
265 if [ "$archos" = "h120" ]; then
266 config_rtc="#define CONFIG_RTC RTC_DS1339_DS3231"
267 have_rtc_alarm="#define HAVE_RTC_ALARM"
268 echo "RTC functions enabled (DS1339/DS3231)"
269 else
270 cont=0
274 cont=0
276 esac
277 done
278 echo "done"
280 if [ "yes" = "$use_debug" ]; then
281 debug="-DDEBUG"
282 GCCOPTS="$GCCOPTS -g -DDEBUG"
284 if [ "yes" = "$logf" ]; then
285 use_logf="#define ROCKBOX_HAS_LOGF 1"
287 if [ "yes" = "$simulator" ]; then
288 debug="-DDEBUG"
289 extradefines="$extradefines -DSIMULATOR"
291 if [ "yes" = "$profile" ]; then
292 extradefines="$extradefines -DRB_PROFILE"
293 PROFILE_OPTS="-finstrument-functions"
297 voiceconfig () {
298 echo "Building voice for $archos"
299 echo ""
301 if [ `which flite` ]; then
302 FLITE="F(l)ite "
303 FLITE_OPTS="FLITE_OPTS=\"\""
304 DEFAULT_TTS="flite"
305 DEFAULT_TTS_OPTS=$FLITE_OPTS
306 DEFAULT_NOISEFLOOR="500"
307 DEFAULT_CHOICE="L"
309 if [ `which speak` ]; then
310 ESPEAK="(e)Speak "
311 ESPEAK_OPTS="ESPEAK_OPTS=\"\""
312 DEFAULT_TTS="espeak"
313 DEFAULT_TTS_OPTS=$ESPEAK_OPTS
314 DEFAULT_NOISEFLOOR="500"
315 DEFAULT_CHOICE="e"
317 if [ `which festival` ]; then
318 FESTIVAL="(F)estival "
319 FESTIVAL_OPTS="FLITE_OPTS=\"\""
320 DEFAULT_TTS="festival"
321 DEFAULT_TTS_OPTS=$FESTIVAL_OPTS
322 DEFAULT_NOISEFLOOR="500"
323 DEFAULT_CHOICE="F"
326 if [ "$FESTIVAL" = "$FLITE" ] && [ "$FLITE" = "$ESPEAK" ]; then
327 echo "You need Festival, eSpeak or Flite in your path to build voice files"
328 exit
331 echo "TTS engine to use: ${FLITE}${FESTIVAL}${ESPEAK}(${DEFAULT_CHOICE})?"
332 option=`input`
333 case "$option" in
334 [Ll])
335 TTS_ENGINE="flite"
336 NOISEFLOOR="500" # TODO: check this value
337 TTS_OPTS=$FLITE_OPTS
339 [Ee])
340 TTS_ENGINE="espeak"
341 NOISEFLOOR="500"
342 TTS_OPTS=$ESPEAK_OPTS
344 [Ff])
345 TTS_ENGINE="festival"
346 NOISEFLOOR="500"
347 TTS_OPTS=$FESTIVAL_OPTS
350 TTS_ENGINE=$DEFAULT_TTS
351 TTS_OPTS=$DEFAULT_TTS_OPTS
352 NOISEFLOOR=$DEFAULT_NOISEFLOOR
353 esac
354 echo "Using $TTS_ENGINE for TTS"
356 echo ""
358 if [ `which oggenc` ]; then
359 OGGENC="(O)ggenc "
360 DEFAULT_ENC="oggenc"
361 VORBIS_OPTS="VORBIS_OPTS=\"-q0 --downmix\""
362 DEFAULT_ENC_OPTS=$VORBIS_OPTS
363 DEFAULT_CHOICE="O"
365 if [ `which speexenc` ]; then
366 SPEEXENC="(S)peexenc "
367 DEFAULT_ENC="speexenc"
368 SPEEX_OPTS="" # TODO: find appropriate options for speex
369 DEFAULT_ENC_OPTS=$SPEEX_OPTS
370 DEFAULT_CHOICE="S"
372 if [ `which lame` ]; then
373 LAME="(L)ame "
374 DEFAULT_ENC="lame"
375 LAME_OPTS="LAME_OPTS=\"--resample 12 -t -m m -h -V 9 -S\""
376 DEFAULT_ENC_OPTS=$LAME_OPTS
377 DEFAULT_CHOICE="L"
380 if [ "$LAME" = "" ]; then
381 echo "You need to have Lame installed to build voice files"
384 echo "Encoder to use: ${LAME}${OGGENC}${SPEEXENC}(${DEFAULT_CHOICE})?"
385 echo ""
386 echo "Note: Use Lame - the other options won't work"
387 option=`input`
388 case "$option" in
389 [Oo])
390 ENCODER="oggenc"
391 ENC_OPTS=$VORBIS_OPTS
393 [Ss])
394 ENCODER="speexenc"
395 ENC_OPTS=$SPEEX_OPTS
397 [Ll])
398 ENCODER="lame"
399 ENC_OPTS=$LAME_OPTS
402 ENCODER=$DEFAULT_ENC
403 ENC_OPTS=$DEFAULT_ENC_OPTS
404 esac
405 echo "Using $ENCODER for encoding voice clips"
407 cat > voicesettings.sh <<EOF
408 TTS_ENGINE="${TTS_ENGINE}"
409 ENCODER="${ENCODER}"
410 TEMPDIR="${pwd}"
411 NOISEFLOOR="${NOISEFLOOR}"
412 ${TTS_OPTS}
413 ${ENC_OPTS}
417 picklang() {
418 # figure out which languages that are around
419 for file in $rootdir/apps/lang/*.lang; do
420 clean=`echo $file | sed -e 's:.*/::g' | cut "-d." -f1`
421 langs="$langs $clean"
422 done
424 num=1
425 for one in $langs; do
426 echo "$num. $one"
427 num=`expr $num + 1`
428 done
430 read pick
431 return $pick;
434 whichlang() {
435 num=1
436 for one in $langs; do
437 if [ "$num" = "$pick" ]; then
438 echo $one
439 return
441 num=`expr $num + 1`
442 done
445 opt=$1
447 if test "$opt" = "--help"; then
448 echo "Rockbox configure script."
449 echo "Invoke this in a directory to generate a Makefile to build Rockbox"
450 echo "Do *NOT* run this within the tools directory!"
451 echo ""
452 echo "Usage: configure [--ccache][--no-ccache]"
453 exit
456 if test -r "configure"; then
457 # this is a check for a configure script in the current directory, it there
458 # is one, try to figure out if it is this one!
460 if { grep "^# Jukebox" configure >/dev/null 2>&1 ; } then
461 echo "WEEEEEEEEP. Don't run this configure script within the tools directory."
462 echo "It will only cause you pain and grief. Instead do this:"
463 echo ""
464 echo " cd .."
465 echo " mkdir build-dir"
466 echo " cd build-dir"
467 echo " ../tools/configure"
468 echo ""
469 echo "Much happiness will arise from this. Enjoy"
470 exit
474 # get our current directory
475 pwd=`pwd`;
477 if { echo $pwd | grep " "; } then
478 echo "You're running this script in a path that contains space. The build"
479 echo "system is unfortunately not clever enough to deal with this. Please"
480 echo "run the script from a different path, rename the path or fix the build"
481 echo "system!"
482 exit
485 if [ -z "$rootdir" ]; then
486 ##################################################################
487 # Figure out where the source code root is!
489 rootdir=`dirname $0`/../
491 #####################################################################
492 # Convert the possibly relative directory name to an absolute version
494 now=`pwd`
495 cd $rootdir
496 rootdir=`pwd`
498 # cd back to the build dir
499 cd $now
502 apps="apps"
503 appsdir='\$(ROOTDIR)/apps'
504 firmdir='\$(ROOTDIR)/firmware'
505 toolsdir='\$(ROOTDIR)/tools'
508 ##################################################################
509 # Figure out target platform
512 echo "Enter target platform:"
513 cat <<EOF
514 ==Archos== ==iriver== ==Apple iPod==
515 0) Player/Studio 10) H120/H140 20) Color/Photo
516 1) Recorder 11) H320/H340 21) Nano
517 2) FM Recorder 12) iHP-100/110/115 22) Video
518 3) Recorder v2 13) iFP-790 23) 3G
519 4) Ondio SP 14) H10 20Gb 24) 4G Grayscale
520 5) Ondio FM 15) H10 5/6Gb 25) Mini 1G
521 6) AV300 26) Mini 2G
523 ==iAudio== ==Toshiba== ==SanDisk==
524 30) X5/X5V/X5L 40) Gigabeat F 50) Sansa e200
525 31) M5/M5L 51) Sansa e200R
527 ==Tatung==
528 60) Elio TPJ-1022
531 buildfor=`input`;
533 # Set of tools built for all target platforms:
534 toolset="rdf2binary convbdf codepages"
536 # Toolsets for some target families:
537 archosbitmaptools="$toolset scramble descramble sh2d uclpack bmp2rb"
538 iriverbitmaptools="$toolset scramble descramble mkboot bmp2rb"
539 iaudiobitmaptools="$toolset scramble descramble mkboot bmp2rb"
540 ipodbitmaptools="$toolset scramble ipod_fw bmp2rb codepages"
541 gigabeatbitmaptools="$toolset scramble descramble bmp2rb"
542 # generic is used by IFP, H10, Sansa-e200
543 genericbitmaptools="$toolset bmp2rb"
546 # ---- For each target ----
548 # *Variables*
549 # target_id: a unique number identifying this target, DOES NOT necessarily
550 # have to be the menu number. Just use the currently highest
551 # number+1 when you add a new target.
552 # archos: short model name used all over to identify this target
553 # target: -Ddefine passed to the build commands to make the correct
554 # config-*.h file get included etc
555 # tool: the tool that takes a plain binary and converts that into a
556 # working "firmware" file for your target
557 # output: the final output file name
558 # boottool: the tool that takes a plain binary and generates a bootloader
559 # file for your target (or blank to use $tool)
560 # bootoutput:the final output file name for the bootloader (or blank to use
561 # $output)
562 # appextra: passed to the APPEXTRA variable in the Makefiles.
563 # TODO: add proper explanation
564 # archosrom: used only for Archos targets that build a special flashable .ucl
565 # image. Set to blank for other builds.
566 # flash: the same as archosrom. These two should be merged
567 # plugins: set to 'yes' to build the plugins. Early development builds can
568 # set this to no in the early stages to have an easier life for a
569 # while
570 # codecs: lists codecs to build for this target
571 # toolset: lists what particular tools in the tools/ directory that this
572 # target needs to have built prior to building Rockbox
574 # *Functions*
575 # *cc: sets up gcc and compiler options for your target builds. Note
576 # that if you select a simulator build, the compiler selection is
577 # overridden later in the script.
579 case $buildfor in
581 0|player)
582 target_id=1
583 archos="player"
584 target="-DARCHOS_PLAYER"
585 memory="2"
586 shcc
587 tool="$rootdir/tools/scramble"
588 output="archos.mod"
589 appextra="player:gui"
590 archosrom="$pwd/rombox.ucl"
591 flash="$pwd/rockbox.ucl"
592 plugins="yes"
593 codecs=""
595 # toolset is the tools within the tools directory that we build for
596 # this particular target.
597 toolset="$toolset scramble descramble sh2d player_unifont uclpack"
599 # Note: the convbdf is present in the toolset just because: 1) the
600 # firmware/Makefile assumes it is present always, and 2) we will need it when we
601 # build the player simulator
603 t_cpu="sh"
604 t_manufacturer="archos"
605 t_model="player"
608 1|recorder)
609 target_id=2
610 archos="recorder"
611 target="-DARCHOS_RECORDER"
612 memory="2"
613 shcc
614 tool="$rootdir/tools/scramble"
615 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
616 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
617 output="ajbrec.ajz"
618 appextra="recorder:gui"
619 archosrom=""#"$pwd/rombox.ucl"
620 flash="$pwd/rockbox.ucl"
621 plugins="yes"
622 codecs=""
623 # toolset is the tools within the tools directory that we build for
624 # this particular target.
625 toolset=$archosbitmaptools
626 t_cpu="sh"
627 t_manufacturer="archos"
628 t_model="recorder"
631 2|fmrecorder)
632 target_id=3
633 archos="fmrecorder"
634 target="-DARCHOS_FMRECORDER"
635 memory="2"
636 shcc
637 tool="$rootdir/tools/scramble -fm"
638 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
639 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
640 output="ajbrec.ajz"
641 appextra="recorder:gui"
642 archosrom=""#"$pwd/rombox.ucl"
643 flash="$pwd/rockbox.ucl"
644 plugins="yes"
645 codecs=""
646 # toolset is the tools within the tools directory that we build for
647 # this particular target.
648 toolset=$archosbitmaptools
649 t_cpu="sh"
650 t_manufacturer="archos"
651 t_model="fm_v2"
654 3|recorderv2)
655 target_id=4
656 archos="recorderv2"
657 target="-DARCHOS_RECORDERV2"
658 memory="2"
659 shcc
660 tool="$rootdir/tools/scramble -v2"
661 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
662 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
663 output="ajbrec.ajz"
664 appextra="recorder:gui"
665 archosrom=""#"$pwd/rombox.ucl"
666 flash="$pwd/rockbox.ucl"
667 plugins="yes"
668 codecs=""
669 # toolset is the tools within the tools directory that we build for
670 # this particular target.
671 toolset=$archosbitmaptools
672 t_cpu="sh"
673 t_manufacturer="archos"
674 t_model="fm_v2"
677 4|ondiosp)
678 target_id=7
679 archos="ondiosp"
680 target="-DARCHOS_ONDIOSP"
681 memory="2"
682 shcc
683 tool="$rootdir/tools/scramble -osp"
684 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
685 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
686 output="ajbrec.ajz"
687 appextra="recorder:gui"
688 archosrom="$pwd/rombox.ucl"
689 flash="$pwd/rockbox.ucl"
690 plugins="yes"
691 codecs=""
692 # toolset is the tools within the tools directory that we build for
693 # this particular target.
694 toolset=$archosbitmaptools
695 t_cpu="sh"
696 t_manufacturer="archos"
697 t_model="ondio"
700 5|ondiofm)
701 target_id=8
702 archos="ondiofm"
703 target="-DARCHOS_ONDIOFM"
704 memory="2"
705 shcc
706 tool="$rootdir/tools/scramble -ofm"
707 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
708 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
709 output="ajbrec.ajz"
710 appextra="recorder:gui"
711 archosrom=""#"$pwd/rombox.ucl"
712 flash="$pwd/rockbox.ucl"
713 plugins="yes"
714 codecs=""
715 toolset=$archosbitmaptools
716 t_cpu="sh"
717 t_manufacturer="archos"
718 t_model="ondio"
721 6|av300)
722 target_id=26
723 archos="av300"
724 target="-DARCHOS_AV300"
725 memory=16 # always
726 arm7tdmicc
727 tool="$rootdir/tools/scramble -mm=C"
728 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
729 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
730 output="cjbm.ajz"
731 appextra="recorder:gui"
732 archosrom=""
733 flash=""
734 plugins="yes"
735 codecs=""
736 # toolset is the tools within the tools directory that we build for
737 # this particular target.
738 toolset="$toolset scramble descramble bmp2rb codepages"
739 # architecture, manufacturer and model for the target-tree build
740 t_cpu="arm"
741 t_manufacturer="archos"
742 t_model="av300"
745 10|h120)
746 target_id=9
747 archos="h120"
748 target="-DIRIVER_H120"
749 memory=32 # always
750 coldfirecc
751 tool="$rootdir/tools/scramble -add=h120"
752 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
753 bmp2rb_native="$rootdir/tools/bmp2rb -f 2"
754 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
755 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
756 output="rockbox.iriver"
757 appextra="recorder:gui"
758 archosrom=""
759 flash="$pwd/rombox.iriver"
760 plugins="yes"
761 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
762 # toolset is the tools within the tools directory that we build for
763 # this particular target.
764 toolset=$iriverbitmaptools
765 t_cpu="coldfire"
766 t_manufacturer="iriver"
767 t_model="h100"
770 11|h300)
771 target_id=10
772 archos="h300"
773 target="-DIRIVER_H300"
774 memory=32 # always
775 coldfirecc
776 tool="$rootdir/tools/scramble -add=h300"
777 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
778 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
779 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
780 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
781 output="rockbox.iriver"
782 appextra="recorder:gui"
783 archosrom=""
784 flash=""
785 plugins="yes"
786 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
787 # toolset is the tools within the tools directory that we build for
788 # this particular target.
789 toolset=$iriverbitmaptools
790 t_cpu="coldfire"
791 t_manufacturer="iriver"
792 t_model="h300"
795 12|h100)
796 target_id=11
797 archos="h100"
798 target="-DIRIVER_H100"
799 memory=16 # always
800 coldfirecc
801 tool="$rootdir/tools/scramble -add=h100"
802 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
803 bmp2rb_native="$rootdir/tools/bmp2rb -f 2"
804 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
805 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
806 output="rockbox.iriver"
807 appextra="recorder:gui"
808 archosrom=""
809 flash=""
810 plugins="yes"
811 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
812 # toolset is the tools within the tools directory that we build for
813 # this particular target.
814 toolset=$iriverbitmaptools
815 t_cpu="coldfire"
816 t_manufacturer="iriver"
817 t_model="h100"
820 30|x5)
821 target_id=12
822 archos="x5"
823 target="-DIAUDIO_X5"
824 memory=16 # always
825 coldfirecc
826 tool="$rootdir/tools/scramble -add=iax5"
827 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
828 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
829 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
830 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 7"
831 output="rockbox.iaudio"
832 appextra="recorder:gui"
833 archosrom=""
834 flash=""
835 plugins="yes"
836 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
837 # toolset is the tools within the tools directory that we build for
838 # this particular target.
839 toolset="$iaudiobitmaptools"
840 # architecture, manufacturer and model for the target-tree build
841 t_cpu="coldfire"
842 t_manufacturer="iaudio"
843 t_model="x5"
846 31|m5)
847 target_id=28
848 archos="m5"
849 target="-DIAUDIO_M5"
850 memory=16 # always
851 coldfirecc
852 tool="$rootdir/tools/scramble -add=iam5"
853 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
854 bmp2rb_native="$rootdir/tools/bmp2rb -f 2"
855 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
856 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 7"
857 output="rockbox.iaudio"
858 appextra="recorder:gui"
859 archosrom=""
860 flash=""
861 plugins="yes"
862 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
863 # toolset is the tools within the tools directory that we build for
864 # this particular target.
865 toolset="$iaudiobitmaptools"
866 # architecture, manufacturer and model for the target-tree build
867 t_cpu="coldfire"
868 t_manufacturer="iaudio"
869 t_model="m5"
872 20|ipodcolor)
873 target_id=13
874 archos="ipodcolor"
875 target="-DIPOD_COLOR"
876 memory=32 # always
877 arm7tdmicc
878 tool="$rootdir/tools/scramble -add=ipco"
879 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
880 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
881 output="rockbox.ipod"
882 appextra="recorder:gui"
883 archosrom=""
884 flash=""
885 plugins="yes"
886 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
887 bootoutput="bootloader-$archos.ipod"
888 # toolset is the tools within the tools directory that we build for
889 # this particular target.
890 toolset=$ipodbitmaptools
891 # architecture, manufacturer and model for the target-tree build
892 t_cpu="arm"
893 t_manufacturer="ipod"
894 t_model="color"
897 21|ipodnano)
898 target_id=14
899 archos="ipodnano"
900 target="-DIPOD_NANO"
901 memory=32 # always
902 arm7tdmicc
903 tool="$rootdir/tools/scramble -add=nano"
904 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
905 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
906 output="rockbox.ipod"
907 appextra="recorder:gui"
908 archosrom=""
909 flash=""
910 plugins="yes"
911 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
912 bootoutput="bootloader-$archos.ipod"
913 # toolset is the tools within the tools directory that we build for
914 # this particular target.
915 toolset=$ipodbitmaptools
916 # architecture, manufacturer and model for the target-tree build
917 t_cpu="arm"
918 t_manufacturer="ipod"
919 t_model="nano"
922 22|ipodvideo)
923 target_id=15
924 archos="ipodvideo"
925 target="-DIPOD_VIDEO"
926 memory=32 # 30GB models have 32MB, 60GB have 64MB
927 arm7tdmicc
928 tool="$rootdir/tools/scramble -add=ipvd"
929 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
930 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
931 output="rockbox.ipod"
932 appextra="recorder:gui"
933 archosrom=""
934 flash=""
935 plugins="yes"
936 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
937 bootoutput="bootloader-$archos.ipod"
938 # toolset is the tools within the tools directory that we build for
939 # this particular target.
940 toolset=$ipodbitmaptools
941 # architecture, manufacturer and model for the target-tree build
942 t_cpu="arm"
943 t_manufacturer="ipod"
944 t_model="video"
947 23|ipod3g)
948 target_id=16
949 archos="ipod3g"
950 target="-DIPOD_3G"
951 memory=32 # always
952 arm7tdmicc
953 tool="$rootdir/tools/scramble -add=ip3g"
954 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
955 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
956 output="rockbox.ipod"
957 appextra="recorder:gui"
958 archosrom=""
959 flash=""
960 plugins="yes"
961 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
962 bootoutput="bootloader-$archos.ipod"
963 # toolset is the tools within the tools directory that we build for
964 # this particular target.
965 toolset=$ipodbitmaptools
966 # architecture, manufacturer and model for the target-tree build
967 t_cpu="arm"
968 t_manufacturer="ipod"
969 t_model="3g"
972 24|ipod4g)
973 target_id=17
974 archos="ipod4g"
975 target="-DIPOD_4G"
976 memory=32 # always
977 arm7tdmicc
978 tool="$rootdir/tools/scramble -add=ip4g"
979 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
980 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
981 output="rockbox.ipod"
982 appextra="recorder:gui"
983 archosrom=""
984 flash=""
985 plugins="yes"
986 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
987 bootoutput="bootloader-$archos.ipod"
988 # toolset is the tools within the tools directory that we build for
989 # this particular target.
990 toolset=$ipodbitmaptools
991 # architecture, manufacturer and model for the target-tree build
992 t_cpu="arm"
993 t_manufacturer="ipod"
994 t_model="4g"
997 25|ipodmini)
998 target_id=18
999 archos="ipodmini"
1000 target="-DIPOD_MINI"
1001 memory=32 # always
1002 arm7tdmicc
1003 tool="$rootdir/tools/scramble -add=mini"
1004 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1005 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1006 output="rockbox.ipod"
1007 appextra="recorder:gui"
1008 archosrom=""
1009 flash=""
1010 plugins="yes"
1011 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
1012 bootoutput="bootloader-$archos.ipod"
1013 # toolset is the tools within the tools directory that we build for
1014 # this particular target.
1015 toolset=$ipodbitmaptools
1016 # architecture, manufacturer and model for the target-tree build
1017 t_cpu="arm"
1018 t_manufacturer="ipod"
1019 t_model="mini"
1022 13|ifp7xx)
1023 target_id=19
1024 archos="ifp7xx"
1025 target="-DIRIVER_IFP7XX"
1026 memory=1
1027 arm7tdmicc short
1028 tool="cp"
1029 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1030 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
1031 output="rockbox.wma"
1032 appextra="recorder:gui"
1033 archosrom=""
1034 flash=""
1035 plugins="yes"
1036 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
1037 # toolset is the tools within the tools directory that we build for
1038 # this particular target.
1039 toolset=$genericbitmaptools
1040 t_cpu="arm"
1041 t_manufacturer="pnx0101"
1042 t_model="iriver-ifp7xx"
1045 40|gigabeatf)
1046 target_id=20
1047 archos="gigabeatf"
1048 target="-DGIGABEAT_F"
1049 memory=32 # always
1050 arm9tdmicc
1051 tool="$rootdir/tools/scramble -add=giga"
1052 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1053 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1054 output="rockbox.gigabeat"
1055 appextra="recorder:gui"
1056 archosrom=""
1057 flash=""
1058 plugins="yes"
1059 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
1060 toolset=$gigabeatbitmaptools
1061 boottool="$rootdir/tools/scramble -gigabeat"
1062 bootoutput="FWIMG01.DAT"
1063 # architecture, manufacturer and model for the target-tree build
1064 t_cpu="arm"
1065 t_manufacturer="s3c2440"
1066 t_model="gigabeat-fx"
1069 26|ipodmini2g)
1070 target_id=21
1071 archos="ipodmini2g"
1072 target="-DIPOD_MINI2G"
1073 memory=32 # always
1074 arm7tdmicc
1075 tool="$rootdir/tools/scramble -add=mn2g"
1076 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1077 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1078 output="rockbox.ipod"
1079 appextra="recorder:gui"
1080 archosrom=""
1081 flash=""
1082 plugins="yes"
1083 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
1084 bootoutput="bootloader-$archos.ipod"
1085 # toolset is the tools within the tools directory that we build for
1086 # this particular target.
1087 toolset=$ipodbitmaptools
1088 # architecture, manufacturer and model for the target-tree build
1089 t_cpu="arm"
1090 t_manufacturer="ipod"
1091 t_model="mini2g"
1094 14|h10)
1095 target_id=22
1096 archos="h10"
1097 target="-DIRIVER_H10"
1098 memory=32 # always
1099 arm7tdmicc
1100 tool="$rootdir/tools/scramble -mi4v3 -model=h10 -type=RBOS"
1101 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1102 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1103 output="rockbox.mi4"
1104 appextra="recorder:gui"
1105 archosrom=""
1106 flash=""
1107 plugins="yes"
1108 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
1109 boottool="$rootdir/tools/scramble -mi4v3 -model=h10 -type=RBBL"
1110 bootoutput="H10_20GC.mi4"
1111 # toolset is the tools within the tools directory that we build for
1112 # this particular target.
1113 toolset="$genericbitmaptools scramble"
1114 # architecture, manufacturer and model for the target-tree build
1115 t_cpu="arm"
1116 t_manufacturer="iriver"
1117 t_model="h10"
1120 15|h10_5gb)
1121 target_id=24
1122 archos="h10_5gb"
1123 target="-DIRIVER_H10_5GB"
1124 memory=32 # always
1125 arm7tdmicc
1126 tool="$rootdir/tools/scramble -mi4v2 -model=h105 -type=RBOS"
1127 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1128 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
1129 output="rockbox.mi4"
1130 appextra="recorder:gui"
1131 archosrom=""
1132 flash=""
1133 plugins="yes"
1134 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
1135 boottool="$rootdir/tools/scramble -mi4v2 -model=h105 -type=RBBL"
1136 bootoutput="H10.mi4"
1137 # toolset is the tools within the tools directory that we build for
1138 # this particular target.
1139 toolset="$genericbitmaptools scramble"
1140 # architecture, manufacturer and model for the target-tree build
1141 t_cpu="arm"
1142 t_manufacturer="iriver"
1143 t_model="h10"
1146 50|e200)
1147 target_id=23
1148 archos="e200"
1149 target="-DSANSA_E200"
1150 memory=32 # supposedly
1151 arm7tdmicc
1152 tool="$rootdir/tools/scramble -mi4v3 -model=e200 -type=RBOS"
1153 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1154 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1155 output="rockbox.mi4"
1156 appextra="recorder:gui"
1157 archosrom=""
1158 flash=""
1159 plugins="yes"
1160 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
1161 boottool="$rootdir/tools/scramble -mi4v3 -model=e200 -type=RBBL"
1162 bootoutput="PP5022.mi4"
1163 # toolset is the tools within the tools directory that we build for
1164 # this particular target.
1165 toolset="$genericbitmaptools scramble"
1166 # architecture, manufacturer and model for the target-tree build
1167 t_cpu="arm"
1168 t_manufacturer="sandisk"
1169 t_model="sansa-e200"
1172 51|e200r)
1173 # the e200R model is pretty much identical to the e200, it only has a
1174 # different option to the scramble tool when building a bootloader and
1175 # makes the bootloader output file name in all lower case.
1176 target_id=27
1177 archos="e200r"
1178 target="-DSANSA_E200"
1179 memory=32 # supposedly
1180 arm7tdmicc
1181 tool="$rootdir/tools/scramble -mi4v3 -model=e20r -type=RBOS"
1182 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1183 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1184 output="rockbox.mi4"
1185 appextra="recorder:gui"
1186 archosrom=""
1187 flash=""
1188 plugins="yes"
1189 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
1190 boottool="$rootdir/tools/scramble -mi4r -model=e20r -type=RBBL"
1191 bootoutput="pp5022.mi4"
1192 # toolset is the tools within the tools directory that we build for
1193 # this particular target.
1194 toolset="$genericbitmaptools scramble"
1195 # architecture, manufacturer and model for the target-tree build
1196 t_cpu="arm"
1197 t_manufacturer="sandisk"
1198 t_model="sansa-e200"
1201 60|tpj1022)
1202 target_id=25
1203 archos="tpj1022"
1204 target="-DELIO_TPJ1022"
1205 memory=32 # always
1206 arm7tdmicc
1207 tool="$rootdir/tools/scramble -add tpj2"
1208 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1209 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
1210 output="rockbox.elio"
1211 appextra="recorder:gui"
1212 archosrom=""
1213 flash=""
1214 plugins="yes"
1215 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
1216 boottool="$rootdir/tools/scramble -mi4v2"
1217 bootoutput="pp5020.mi4"
1218 # toolset is the tools within the tools directory that we build for
1219 # this particular target.
1220 toolset="$genericbitmaptools scramble"
1221 # architecture, manufacturer and model for the target-tree build
1222 t_cpu="arm"
1223 t_manufacturer="tatung"
1224 t_model="tpj1022"
1228 echo "Please select a supported target platform!"
1229 exit
1232 esac
1234 echo "Platform set to $archos"
1237 #remove start
1238 ############################################################################
1239 # Amount of memory, for those that can differ.
1242 if [ "$memory" = "2" ]; then
1243 size="2"
1244 if [ -z "$update" ]; then
1245 echo "Enter size of your RAM (in MB): (defaults to 2)"
1246 size=`input`;
1249 case $size in
1251 memory="8"
1254 memory="2"
1257 esac
1258 echo "Memory size selected: $memory MB"
1260 #remove end
1262 ##################################################################
1263 # Figure out build "type"
1266 # the ifp7x0 is the only platform that supports building a gdb stub like
1267 # this
1268 case $archos in
1269 ifp7xx)
1270 gdbstub="(G)DB stub, "
1274 esac
1276 echo ""
1277 echo "Build (N)ormal, (A)dvanced, (S)imulator, (B)ootloader, $gdbstub(M)anual, (V)oice? (N)"
1279 option=`input`;
1281 case $option in
1282 [Bb])
1283 if test -n "$archosrom"; then
1284 # Archos SH-based players do this somewhat differently for
1285 # some reason
1286 appsdir='\$(ROOTDIR)/flash/bootbox'
1287 apps="bootbox"
1288 else
1289 appsdir='\$(ROOTDIR)/bootloader'
1290 apps="bootloader"
1291 flash=""
1292 if test -n "$boottool"; then
1293 tool="$boottool"
1295 if test -n "$bootoutput"; then
1296 output=$bootoutput
1299 extradefines="-DBOOTLOADER -ffunction-sections -fdata-sections"
1300 bootloader="1"
1301 echo "Bootloader build selected"
1303 [Ss])
1304 debug="-DDEBUG"
1305 simulator="yes"
1306 extradefines="-DSIMULATOR"
1307 echo "Simulator build selected"
1309 [Aa])
1310 echo "Advanced build selected"
1311 whichadvanced
1313 [Gg])
1314 extradefines="-DSTUB" # for target makefile symbol EXTRA_DEFINES
1315 appsdir='\$(ROOTDIR)/gdb'
1316 apps="stub"
1317 case $archos in
1318 ifp7xx)
1319 output="stub.wma"
1323 esac
1324 echo "GDB stub build selected"
1326 [Mm])
1327 appsdir='\$(ROOTDIR)/manual'
1328 firmdir='\$(ROOTDIR)/manual/platform' # No Makefile here. Effectively ignores target
1329 toolsdir=$firmdir;
1330 toolset='';
1331 apps="manual"
1332 echo "Manual build selected"
1334 [Vv])
1335 echo "Voice build selected"
1336 voiceconfig
1337 toolset="${toolset} voicefont wavtrim"
1338 voice="yes"
1341 debug=""
1342 echo "Normal build selected"
1345 esac
1346 # to be able running "make manual" from non-manual configuration
1347 case $archos in
1348 fmrecorder)
1349 manualdev="recorderv2fm"
1351 recorderv2)
1352 manualdev="recorderv2fm"
1354 h1??)
1355 manualdev="h1xx"
1357 ipodmini2g)
1358 manualdev="ipodmini"
1361 manualdev=$archos
1363 esac
1365 if [ -z "$debug" ]; then
1366 GCCOPTS="$GCCOPTS $GCCOPTIMIZE"
1369 echo "Using source code root directory: $rootdir"
1371 # this was once possible to change at build-time, but no more:
1372 language="english"
1374 # Ask about language if building voice
1375 if [ "yes" = "$voice" ]; then
1376 echo "Select a number for the language to use (default is english)"
1378 picklang
1379 language=`whichlang`
1381 if [ -z "$language" ]; then
1382 # pick a default
1383 language="english"
1385 echo "Language set to $language"
1388 uname=`uname`
1390 if [ "yes" = "$simulator" ]; then
1391 # setup compiler and things for simulator
1392 simcc
1394 if [ -d "archos" ]; then
1395 echo "sub directory archos already present"
1396 else
1397 mkdir archos
1398 echo "created an archos subdirectory for simulating the hard disk"
1402 # Now, figure out version number of the (gcc) compiler we are about to use
1403 gccver=`$CC -dumpversion`;
1405 if [ -z "$gccver" ]; then
1406 echo "WARNING: The compiler you must use ($CC) is not in your path!"
1407 echo "WARNING: this may cause your build to fail since we cannot do the"
1408 echo "WARNING: checks we want now."
1409 else
1411 # gccver should now be "3.3.5", "3.4.3", "2.95.3-6" and similar, but don't
1412 # DEPEND on it
1414 num1=`echo $gccver | cut -d . -f1`
1415 num2=`echo $gccver | cut -d . -f2`
1416 gccnum=`(expr $num1 "*" 100 + $num2) 2>/dev/null`
1418 # This makes:
1419 # 3.3.X => 303
1420 # 3.4.X => 304
1421 # 2.95.3 => 295
1423 echo "Using $CC $gccver ($gccnum)"
1425 if test "$gccnum" -ge "400"; then
1426 # gcc 4.0 is just *so* much pickier on arguments that differ in signedness
1427 # so we ignore that warnings for now
1428 # -Wno-pointer-sign
1429 GCCOPTS="$GCCOPTS -Wno-pointer-sign"
1432 if test "$gccnum" -ge "401"; then
1433 # this is a lame hack to avoid "warning: dereferencing type-punned pointer
1434 # will break strict-aliasing rules"
1436 GCCOPTS="$GCCOPTS -fno-strict-aliasing"
1441 # check the compiler for SH platforms
1442 if test "$CC" = "sh-elf-gcc"; then
1443 if test "$gccnum" -lt "400"; then
1444 echo "WARNING: Consider upgrading your compiler to the 4.0.X series!"
1445 echo "WARNING: http://www.rockbox.org/twiki/bin/view/Main/CrossCompiler"
1446 else
1447 # figure out patch status
1448 gccpatch=`$CC --version`;
1450 if { echo $gccpatch | grep "rockbox" >/dev/null 2>&1; } then
1451 echo "gcc $gccver is rockbox patched"
1452 # then convert -O to -Os to get smaller binaries!
1453 GCCOPTS=`echo $GCCOPTS | sed 's/ -O / -Os /'`
1454 else
1455 echo "WARNING: You use an unpatched gcc compiler: $gccver"
1456 echo "WARNING: http://www.rockbox.org/twiki/bin/view/Main/CrossCompiler"
1461 if test "$1" = "--ccache"; then
1462 echo "Enable ccache for building"
1463 ccache="ccache"
1464 else
1465 if test "$1" != "--no-ccache"; then
1466 ccache=`findtool ccache`
1467 if test -n "$ccache"; then
1468 echo "Found and uses ccache ($ccache)"
1473 if test -n "$ccache"; then
1474 CC="$ccache $CC"
1477 if test "X$endian" = "Xbig"; then
1478 defendian="ROCKBOX_BIG_ENDIAN"
1479 else
1480 defendian="ROCKBOX_LITTLE_ENDIAN"
1483 sed > autoconf.h \
1484 -e "s,@ENDIAN@,${defendian},g" \
1485 -e "s,^#undef ROCKBOX_HAS_LOGF,$use_logf,g" \
1486 -e "s,@config_rtc@,$config_rtc,g" \
1487 -e "s,@have_rtc_alarm@,$have_rtc_alarm,g" \
1488 <<EOF
1489 /* This header was made by configure */
1490 #ifndef __BUILD_AUTOCONF_H
1491 #define __BUILD_AUTOCONF_H
1493 /* Define endianess for the target or simulator platform */
1494 #define @ENDIAN@ 1
1496 /* Define this if you build rockbox to support the logf logging and display */
1497 #undef ROCKBOX_HAS_LOGF
1499 /* optional defines for RTC mod for h1x0 */
1500 @config_rtc@
1501 @have_rtc_alarm@
1503 #endif /* __BUILD_AUTOCONF_H */
1506 if test -n "$t_cpu"; then
1507 TARGET_INC="-I\$(FIRMDIR)/target/$t_cpu/$t_manufacturer/$t_model"
1508 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/$t_cpu/$t_manufacturer"
1509 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/$t_cpu"
1510 GCCOPTS="$GCCOPTS"
1513 if test "$simulator" = "yes"; then
1514 # add simul make stuff on the #SIMUL# line
1515 simmagic1="s,@SIMUL1@,\$(SILENT)\$(MAKE) -C \$(SIMDIR) OBJDIR=\$(BUILDDIR)/sim,"
1516 simmagic2="s,@SIMUL2@,\$(SILENT)\$(MAKE) -C \$(ROOTDIR)/uisimulator/common OBJDIR=\$(BUILDDIR)/comsim,"
1517 else
1518 # delete the lines that match
1519 simmagic1='/@SIMUL1@/D'
1520 simmagic2='/@SIMUL2@/D'
1523 sed > Makefile \
1524 -e "s,@ROOTDIR@,${rootdir},g" \
1525 -e "s,@DEBUG@,${debug},g" \
1526 -e "s,@MEMORY@,${memory},g" \
1527 -e "s,@TARGET_ID@,${target_id},g" \
1528 -e "s,@TARGET@,${target},g" \
1529 -e "s,@CPU@,${t_cpu},g" \
1530 -e "s,@MANUFACTURER@,${t_manufacturer},g" \
1531 -e "s,@ARCHOS@,${archos},g" \
1532 -e "s,@LANGUAGE@,${language},g" \
1533 -e "s,@PWD@,${pwd},g" \
1534 -e "s,@CC@,${CC},g" \
1535 -e "s,@LD@,${LD},g" \
1536 -e "s,@AR@,${AR},g" \
1537 -e "s,@AS@,${AS},g" \
1538 -e "s,@OC@,${OC},g" \
1539 -e "s,@WINDRES@,${WINDRES},g" \
1540 -e "s,@DLLTOOL@,${DLLTOOL},g" \
1541 -e "s,@DLLWRAP@,${DLLWRAP},g" \
1542 -e "s,@RANLIB@,${RANLIB},g" \
1543 -e "s,@TOOL@,${tool},g" \
1544 -e "s,@BMP2RB_NATIVE@,${bmp2rb_native},g" \
1545 -e "s,@BMP2RB_MONO@,${bmp2rb_mono},g" \
1546 -e "s,@BMP2RB_REMOTENATIVE@,${bmp2rb_remotenative},g" \
1547 -e "s,@BMP2RB_REMOTEMONO@,${bmp2rb_remotemono},g" \
1548 -e "s,@OUTPUT@,${output},g" \
1549 -e "s,@APPEXTRA@,${appextra},g" \
1550 -e "s,@ARCHOSROM@,${archosrom},g" \
1551 -e "s,@FLASHFILE@,${flash},g" \
1552 -e "s,@PLUGINS@,${plugins},g" \
1553 -e "s,@CODECS@,${codecs},g" \
1554 -e "s,@PROFILE_OPTS@,${PROFILE_OPTS},g" \
1555 -e "s,@SHARED_FLAG@,${SHARED_FLAG},g" \
1556 -e "s,@GCCOPTS@,${GCCOPTS},g" \
1557 -e "s,@TARGET_INC@,${TARGET_INC},g" \
1558 -e "s!@LDOPTS@!${LDOPTS}!g" \
1559 -e "s,@LOADADDRESS@,${loadaddress},g" \
1560 -e "s,@EXTRADEF@,${extradefines},g" \
1561 -e "s,@APPSDIR@,${appsdir},g" \
1562 -e "s,@FIRMDIR@,${firmdir},g" \
1563 -e "s,@TOOLSDIR@,${toolsdir},g" \
1564 -e "s,@APPS@,${apps},g" \
1565 -e "s,@SIMVER@,${simver},g" \
1566 -e "s,@GCCVER@,${gccver},g" \
1567 -e "s,@GCCNUM@,${gccnum},g" \
1568 -e "s,@UNAME@,${uname},g" \
1569 -e "s,@ENDIAN@,${defendian},g" \
1570 -e "s,@TOOLSET@,${toolset},g" \
1571 -e "${simmagic1}" \
1572 -e "${simmagic2}" \
1573 -e "s,@MANUALDEV@,${manualdev},g" \
1574 <<EOF
1575 ## Automaticly generated. http://www.rockbox.org/
1577 ifndef V
1578 SILENT=@
1579 else
1580 VERBOSEOPT=-v
1581 endif
1583 # old 'make' versions don't have the built-in 'info' function
1584 info=old\$(shell echo >&2 "Consider upgrading to GNU make 3.81+ for optimum build performance.")
1585 ifeq (\$(call info),old)
1586 export info=echo "\$\$(1)";
1587 endif
1589 export ROOTDIR=@ROOTDIR@
1590 export FIRMDIR=@FIRMDIR@
1591 export APPSDIR=@APPSDIR@
1592 export TOOLSDIR=@TOOLSDIR@
1593 export DOCSDIR=\$(ROOTDIR)/docs
1594 export MANUALDIR=\${ROOTDIR}/manual
1595 export DEBUG=@DEBUG@
1596 export ARCHOS=@ARCHOS@
1597 export ARCHOSROM=@ARCHOSROM@
1598 export FLASHFILE=@FLASHFILE@
1599 export TARGET_ID=@TARGET_ID@
1600 export TARGET=@TARGET@
1601 export CPU=@CPU@
1602 export MANUFACTURER=@MANUFACTURER@
1603 export OBJDIR=@PWD@
1604 export BUILDDIR=@PWD@
1605 export LANGUAGE=@LANGUAGE@
1606 export MEMORYSIZE=@MEMORY@
1607 export VERSION=\$(shell \$(ROOTDIR)/tools/svnversion.sh \$(ROOTDIR))
1608 export BUILDDATE=\$(shell date -u +'-DYEAR=%Y -DMONTH=%m -DDAY=%d')
1609 export MKFIRMWARE=@TOOL@
1610 export BMP2RB_MONO=@BMP2RB_MONO@
1611 export BMP2RB_NATIVE=@BMP2RB_NATIVE@
1612 export BMP2RB_REMOTEMONO=@BMP2RB_REMOTEMONO@
1613 export BMP2RB_REMOTENATIVE=@BMP2RB_REMOTENATIVE@
1614 export BINARY=@OUTPUT@
1615 export APPEXTRA=@APPEXTRA@
1616 export ENABLEDPLUGINS=@PLUGINS@
1617 export SOFTWARECODECS=@CODECS@
1618 export EXTRA_DEFINES=@EXTRADEF@
1619 export HOSTCC=gcc
1620 export CC=@CC@
1621 export LD=@LD@
1622 export AR=@AR@
1623 export AS=@AS@
1624 export OC=@OC@
1625 export WINDRES=@WINDRES@
1626 export DLLTOOL=@DLLTOOL@
1627 export DLLWRAP=@DLLWRAP@
1628 export RANLIB=@RANLIB@
1629 export PROFILE_OPTS=@PROFILE_OPTS@
1630 export SIMVER=@SIMVER@
1631 export SIMDIR=\$(ROOTDIR)/uisimulator/sdl
1632 export GCCOPTS=@GCCOPTS@
1633 export TARGET_INC=@TARGET_INC@
1634 export LOADADDRESS=@LOADADDRESS@
1635 export SHARED_FLAG=@SHARED_FLAG@
1636 export LDOPTS=@LDOPTS@
1637 export GCCVER=@GCCVER@
1638 export GCCNUM=@GCCNUM@
1639 export UNAME=@UNAME@
1640 export MANUALDEV=@MANUALDEV@
1642 # Do not print "Entering directory ..."
1643 MAKEFLAGS += --no-print-directory
1645 .PHONY: all clean tags zip tools manual bin build info
1647 all: info
1649 info: build
1650 \$(SILENT)\$(TOOLSDIR)/mkinfo.pl \$(BUILDDIR)/rockbox-info.txt
1652 build: tools
1653 @SIMUL1@
1654 @SIMUL2@
1655 \$(SILENT)\$(MAKE) -C \$(FIRMDIR) OBJDIR=\$(BUILDDIR)/firmware
1656 \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@
1658 bin: tools
1659 @SIMUL1@
1660 @SIMUL2@
1661 \$(SILENT)\$(MAKE) -C \$(FIRMDIR) OBJDIR=\$(BUILDDIR)/firmware
1662 \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@ \$(BUILDDIR)/\$(BINARY)
1664 rocks: tools
1665 \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@ rocks
1667 veryclean: clean toolsclean
1669 toolsclean:
1670 \$(SILENT)\$(MAKE) -C \$(TOOLSDIR) clean
1672 clean:
1673 \$(SILENT)echo Cleaning build directory
1674 \$(SILENT)rm -rf rockbox.zip TAGS @APPS@ firmware comsim sim lang.[ch]\
1675 manual *.pdf *.a credits.raw @OUTPUT@ bitmaps pluginbitmaps \
1676 @ARCHOSROM@ @FLASHFILE@ UI256.bmp rockbox-full.zip \
1677 html txt rockbox-manual*.zip sysfont.h rockbox-info.txt
1679 voice: tools
1680 \$(TOOLSDIR)/genvoice.sh \$(ROOTDIR) \$(LANGUAGE) \$(ARCHOS) voicesettings.sh
1682 tools:
1683 \$(SILENT)\$(MAKE) -C \$(TOOLSDIR) CC=\$(HOSTCC) @TOOLSET@
1685 tags:
1686 \$(SILENT)rm -f TAGS
1687 \$(SILENT)\$(MAKE) -C \$(FIRMDIR) tags
1688 \$(SILENT)\$(MAKE) -C \$(APPSDIR) tags
1689 \$(SILENT)\$(MAKE) -C \$(APPSDIR)/plugins tags
1690 \$(SILENT)\$(MAKE) -C \$(APPSDIR)/plugins/lib tags
1692 fontzip:
1693 \$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -r "\$(ROOTDIR)" -f 1 -o rockbox-fonts.zip \$(TARGET) \$(BINARY)
1695 zip:
1696 \$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
1698 mapzip:
1699 \$(SILENT)find . -name "*.map" | xargs zip rockbox-maps.zip
1701 fullzip:
1702 \$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -r "\$(ROOTDIR)" -f 2 -o rockbox-full.zip \$(TARGET) \$(BINARY)
1704 7zip:
1705 \$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -o "rockbox.7z" -z "7za a" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
1707 tar:
1708 \$(SILENT)rm -f rockbox.tar
1709 \$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -o "rockbox.tar" -z "tar --no-recursion -uf" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
1711 bzip2: tar
1712 \$(SILENT)bzip2 -f9 rockbox.tar
1714 gzip: tar
1715 \$(SILENT)gzip -f9 rockbox.tar
1717 manual: manual-pdf
1718 manual-pdf:
1719 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-pdf
1720 manual-html:
1721 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-html
1722 manual-zhtml: manual-zip
1723 manual-txt:
1724 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-txt
1725 manual-ztxt:
1726 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-txt-zip
1727 manual-zip:
1728 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-zip
1730 help:
1731 @echo "A few helpful make targets"
1732 @echo ""
1733 @echo "all - builds a full Rockbox (default), including tools"
1734 @echo "bin - builds only the Rockbox.<target name> file"
1735 @echo "clean - cleans a build directory (not tools)"
1736 @echo "veryclean - cleans the build and tools directories"
1737 @echo "manual - builds a manual"
1738 @echo "manual-html - HTML manual"
1739 @echo "manual-zip - HTML manual (zipped)"
1740 @echo "manual-txt - txt manual"
1741 @echo "fullzip - creates a rockbox.zip of your build with fonts"
1742 @echo "zip - creates a rockbox.zip of your build (no fonts)"
1743 @echo "gzip - creates a rockbox.tar.gz of your build (no fonts)"
1744 @echo "bzip2 - creates a rockbox.tar.bz2 of your build (no fonts)"
1745 @echo "7zip - creates a rockbox.7z of your build (no fonts)"
1746 @echo "fontzip - creates rockbox-fonts.zip"
1747 @echo "mapzip - creates rockbox-maps.zip with all .map files"
1748 @echo "tools - builds the tools only"
1749 @echo "install - installs your build (for simulator builds only)"
1753 if [ "yes" = "$simulator" ]; then
1755 cat >> Makefile <<EOF
1757 install:
1758 @echo "installing a full setup in your archos dir"
1759 @(\$(MAKE) fullzip && cd archos && unzip -oq ../rockbox-full.zip)
1764 echo "Created Makefile"