fix player builds
[Rockbox.git] / tools / configure
blob22261888a53b9a728312ad4d3ed5bd2ee2ade1ba
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"
15 use_simsound="#undef ROCKBOX_HAS_SIMSOUND"
17 scriptver=`echo '$Revision$' | sed -e 's:\\$::g' -e 's/Revision: //'`
20 # Begin Function Definitions
22 input() {
23 read response
24 echo $response
27 prefixtools () {
28 prefix="$1"
29 CC=${prefix}gcc
30 WINDRES=${prefix}windres
31 DLLTOOL=${prefix}dlltool
32 DLLWRAP=${prefix}dllwrap
33 RANLIB=${prefix}ranlib
34 LD=${prefix}ld
35 AR=${prefix}ar
36 AS=${prefix}as
37 OC=${prefix}objcopy
40 crosswincc () {
41 # naive approach to selecting a mingw cross-compiler on linux/*nix
42 echo "Enabling win32 crosscompiling"
44 prefixtools i586-mingw32msvc-
46 LDOPTS="-lgdi32 -luser32 -mwindows"
47 # add cross-compiler option(s)
48 GCCOPTS="$GCCOPTS -mno-cygwin"
50 output="rockboxui.exe" # use this as output binary name
51 crosscompile="yes"
52 endian="little" # windows is little endian
55 checksoundcard () {
56 if test -n "$codecs"; then
57 if test -f "/usr/include/sys/soundcard.h"; then
58 # We have a header file so we can build the sound code
59 use_simsound="#define ROCKBOX_HAS_SIMSOUND 1"
60 echo "Enabled PCM sound playback in simulator"
61 fi # header file present
62 fi # has codecs
65 # scan the $PATH for the given command
66 findtool(){
67 file="$1"
69 IFS=":"
70 for path in $PATH
72 # echo "checks for $file in $path" >&2
73 if test -f "$path/$file"; then
74 echo "$path/$file"
75 return
77 done
81 simcc () {
83 # default tool setup for native building
84 prefixtools ""
86 GCCOPTS='-W -Wall -g -fno-builtin'
88 output="rockboxui" # use this as default output binary name
90 if [ "$simver" = "sdl" ]; then
91 # generic sdl-config checker
92 sdl=`findtool sdl-config`
94 if [ -z "$sdl" ]; then
95 echo "configure didn't find sdl-config, which indicates that you"
96 echo "don't have SDL (properly) installed. Please correct and"
97 echo "re-run configure!"
98 exit
102 case $uname in
103 CYGWIN*)
104 echo "Cygwin host detected"
106 SHARED_FLAG="-shared"
107 if [ "$simver" = "win32" ]; then
108 # win32 version
109 GCCOPTS="$GCCOPTS -mno-cygwin -DNOCYGWIN"
110 LDOPTS="-lgdi32 -luser32 -mno-cygwin"
111 elif [ "$simver" = "sdl" ]; then
112 # sdl version
113 GCCOPTS="$GCCOPTS `sdl-config --cflags`"
114 LDOPTS="`sdl-config --libs` -mconsole"
115 checksoundcard
116 else
117 # x11 version
118 GCCOPTS="$GCCOPTS"
119 LDOPTS='-L/usr/X11R6/lib -lSM -lICE -lXt -lX11 -lXmu -lSM -lICE -lX11 -lpthread'
120 checksoundcard
122 output="rockboxui.exe" # use this as output binary name
125 Linux)
126 echo "Linux host detected"
127 GCCOPTS="$GCCOPTS"
128 SHARED_FLAG="-shared"
129 if [ "$simver" = "win32" ]; then
130 LDOPTS='-L/usr/X11R6/lib -lX11 -lm -lXt -lXmu -lnsl -ldl -lpthread'
131 crosswincc # setup cross-compiler
132 elif [ "$simver" = "sdl" ]; then
133 if [ "0" != `sdl-config --libs |grep -c mwindows` ]; then
134 # Enable crosscompiling if sdl-config is from Windows SDL
135 crosswincc
137 GCCOPTS="$GCCOPTS `sdl-config --cflags`"
138 LDOPTS="`sdl-config --libs`"
139 checksoundcard
140 else
141 LDOPTS='-L/usr/X11R6/lib -lX11 -lm -lXt -lXmu -lnsl -ldl -lpthread'
142 checksoundcard
143 fi # not a cross-compiler
146 FreeBSD)
147 echo "FreeBSD host detected"
148 LDOPTS='-L/usr/X11R6/lib -lX11 -lm -lXt -lXmu -dl -lpthread'
149 SHARED_FLAG="-shared"
150 if [ "$simver" = "win32" ]; then
151 crosswincc # setup cross-compiler
155 Darwin)
156 echo "Darwin host detected"
157 # sdl version
158 GCCOPTS="$GCCOPTS `sdl-config --cflags`"
159 LDOPTS="`sdl-config --libs`"
160 SHARED_FLAG="-dynamiclib -Wl\,-single_module"
161 use_simsound="#define ROCKBOX_HAS_SIMSOUND 1"
162 echo "Enabled PCM sound playback in simulator"
166 echo "Unsupported system: $uname, fix configure and retry"
167 exit
169 esac
171 if [ "`uname -m`" = "x86_64" ]; then
172 GCCOPTS="$GCCOPTS -fPIC" # needed to make shared objects link
175 if test "X$crosscompile" != "Xyes"; then
176 id=$$
177 cat >/tmp/conftest-$id.c <<EOF
178 #include <stdio.h>
179 int main(int argc, char **argv)
181 int var=0;
182 char *varp = (char *)&var;
183 *varp=1;
185 printf("%d\n", var);
186 return 0;
190 $CC -o /tmp/conftest-$id /tmp/conftest-$id.c 2>/dev/null
192 if test `/tmp/conftest-$id 2>/dev/null` -gt "1"; then
193 # big endian
194 endian="big"
195 else
196 # little endian
197 endian="little"
199 echo "Simulator environment deemed $endian endian"
201 # use wildcard here to make it work even if it was named *.exe like
202 # on cygwin
203 rm -f /tmp/conftest-$id*
207 shcc () {
208 prefixtools sh-elf-
209 GCCOPTS="$CCOPTS -m1"
210 GCCOPTIMIZE="-fomit-frame-pointer -fschedule-insns"
211 endian="big"
214 calmrisccc () {
215 prefixtools calmrisc16-unknown-elf-
216 GCCOPTS="-Wl\,--no-check-sections $CCOPTS"
217 GCCOPTIMIZE="-fomit-frame-pointer"
218 endian="big"
221 coldfirecc () {
222 prefixtools m68k-elf-
223 GCCOPTS="$CCOPTS -m5206e -Wa\,-m5249 -malign-int -mstrict-align"
224 GCCOPTIMIZE="-fomit-frame-pointer"
225 endian="big"
228 arm7tdmicc () {
229 prefixtools arm-elf-
230 GCCOPTS="$CCOPTS -mcpu=arm7tdmi"
231 if test "X$1" != "Xshort"; then
232 GCCOPTS="$GCCOPTS -mlong-calls"
234 GCCOPTIMIZE="-fomit-frame-pointer"
235 endian="little"
238 arm9tdmicc () {
239 prefixtools arm-elf-
240 GCCOPTS="$CCOPTS -mcpu=arm9tdmi -mlong-calls"
241 GCCOPTIMIZE="-fomit-frame-pointer"
242 endian="little"
245 whichadvanced () {
246 ##################################################################
247 # Prompt for specific developer options
249 echo ""
250 echo "Enter your developer options (press enter when done)"
251 echo -n "(D)EBUG, (L)ogf, (S)imulator, (P)rofiling"
252 if [ "$memory" = "2" ]; then
253 echo -n ", (8)MB MOD"
255 if [ "$archos" = "h120" ]; then
256 echo -n ", (R)TC MOD"
258 echo ""
260 cont=1
262 while [ $cont = "1" ]; do
264 option=`input`;
266 case $option in
267 [Dd])
268 if [ "yes" = "$profile" ]; then
269 echo "Debug is incompatible with profiling"
270 else
271 echo "define DEBUG"
272 use_debug="yes"
275 [Ll])
276 echo "logf() support enabled"
277 logf="yes"
279 [Ss])
280 echo "Simulator build enabled"
281 simulator="yes"
283 [Pp])
284 if [ "yes" = "$use_debug" ]; then
285 echo "Profiling is incompatible with debug"
286 else
287 echo "Profiling support is enabled"
288 profile="yes"
292 if [ "$memory" = "2" ]; then
293 memory="8"
294 echo "Memory size selected: 8MB"
295 else
296 cont=0
299 [Rr])
300 if [ "$archos" = "h120" ]; then
301 config_rtc="#define CONFIG_RTC RTC_DS1339_DS3231"
302 have_rtc_alarm="#define HAVE_RTC_ALARM"
303 echo "RTC functions enabled (DS1339/DS3231)"
304 else
305 cont=0
309 cont=0
311 esac
312 done
313 echo "done"
315 if [ "yes" = "$use_debug" ]; then
316 debug="-DDEBUG"
317 GCCOPTS="$GCCOPTS -g -DDEBUG"
319 if [ "yes" = "$logf" ]; then
320 use_logf="#define ROCKBOX_HAS_LOGF 1"
322 if [ "yes" = "$simulator" ]; then
323 debug="-DDEBUG"
324 extradefines="$extradefines -DSIMULATOR"
325 whichsim
327 if [ "yes" = "$profile" ]; then
328 extradefines="$extradefines -DRB_PROFILE"
329 PROFILE_OPTS="-finstrument-functions"
333 whichsim () {
335 if [ -z "$simver" ]; then
337 ##################################################################
338 # Figure out what simulator version
340 # x11 is deprecated so hide it from the question
341 # win32 is also deprecated
343 echo ""
344 echo "Build (S)DL version? (S)"
346 option=`input`;
348 case $option in
349 [Ww])
350 simver="win32"
352 WINDRES=windres
353 DLLTOOL=dlltool
354 DLLWRAP=dllwrap
356 # make sure the code knows this is for win32
357 extradefines="$extradefines -DWIN32"
359 [Xx])
360 simver="x11"
361 extradefines="$extradefines -DX11"
363 [Ss]|*)
364 simver="sdl"
365 extradefines="$extradefines -DSDL"
367 esac
368 echo "Selected $simver simulator"
372 voiceconfig () {
373 echo "Building voice for $archos"
374 echo ""
376 if [ `which flite` ]; then
377 FLITE="F(l)ite "
378 FLITE_OPTS="FLITE_OPTS=\"\""
379 DEFAULT_TTS="flite"
380 DEFAULT_TTS_OPTS=$FLITE_OPTS
381 DEFAULT_NOISEFLOOR="500"
382 DEFAULT_CHOICE="L"
384 if [ `which speak` ]; then
385 ESPEAK="(e)Speak "
386 ESPEAK_OPTS="ESPEAK_OPTS=\"\""
387 DEFAULT_TTS="espeak"
388 DEFAULT_TTS_OPTS=$ESPEAK_OPTS
389 DEFAULT_NOISEFLOOR="500"
390 DEFAULT_CHOICE="e"
392 if [ `which festival` ]; then
393 FESTIVAL="(F)estival "
394 FESTIVAL_OPTS="FLITE_OPTS=\"\""
395 DEFAULT_TTS="festival"
396 DEFAULT_TTS_OPTS=$FESTIVAL_OPTS
397 DEFAULT_NOISEFLOOR="500"
398 DEFAULT_CHOICE="F"
401 if [ "$FESTIVAL" = "$FLITE" ] && [ "$FLITE" = "$ESPEAK" ]; then
402 echo "You need Festival, eSpeak or Flite in your path to build voice files"
403 exit
406 echo "TTS engine to use: ${FLITE}${FESTIVAL}${ESPEAK}(${DEFAULT_CHOICE})?"
407 option=`input`
408 case "$option" in
409 [Ll])
410 TTS_ENGINE="flite"
411 NOISEFLOOR="500" # TODO: check this value
412 TTS_OPTS=$FLITE_OPTS
414 [Ee])
415 TTS_ENGINE="espeak"
416 NOISEFLOOR="500"
417 TTS_OPTS=$ESPEAK_OPTS
419 [Ff])
420 TTS_ENGINE="festival"
421 NOISEFLOOR="500"
422 TTS_OPTS=$FESTIVAL_OPTS
425 TTS_ENGINE=$DEFAULT_TTS
426 TTS_OPTS=$DEFAULT_TTS_OPTS
427 NOISEFLOOR=$DEFAULT_NOISEFLOOR
428 esac
429 echo "Using $TTS_ENGINE for TTS"
431 echo ""
433 if [ `which oggenc` ]; then
434 OGGENC="(O)ggenc "
435 DEFAULT_ENC="oggenc"
436 VORBIS_OPTS="VORBIS_OPTS=\"-q0 --downmix\""
437 DEFAULT_ENC_OPTS=$VORBIS_OPTS
438 DEFAULT_CHOICE="O"
440 if [ `which speexenc` ]; then
441 SPEEXENC="(S)peexenc "
442 DEFAULT_ENC="speexenc"
443 SPEEX_OPTS="" # TODO: find appropriate options for speex
444 DEFAULT_ENC_OPTS=$SPEEX_OPTS
445 DEFAULT_CHOICE="S"
447 if [ `which lame` ]; then
448 LAME="(L)ame "
449 DEFAULT_ENC="lame"
450 LAME_OPTS="LAME_OPTS=\"--resample 12 -t -m m -h -V 9 -S\""
451 DEFAULT_ENC_OPTS=$LAME_OPTS
452 DEFAULT_CHOICE="L"
455 if [ "$LAME" = "" ]; then
456 echo "You need to have Lame installed to build voice files"
459 echo "Encoder to use: ${LAME}${OGGENC}${SPEEXENC}(${DEFAULT_CHOICE})?"
460 echo ""
461 echo "Note: Use Lame - the other options won't work"
462 option=`input`
463 case "$option" in
464 [Oo])
465 ENCODER="oggenc"
466 ENC_OPTS=$VORBIS_OPTS
468 [Ss])
469 ENCODER="speexenc"
470 ENC_OPTS=$SPEEX_OPTS
472 [Ll])
473 ENCODER="lame"
474 ENC_OPTS=$LAME_OPTS
477 ENCODER=$DEFAULT_ENC
478 ENC_OPTS=$DEFAULT_ENC_OPTS
479 esac
480 echo "Using $ENCODER for encoding voice clips"
482 cat > voicesettings.sh <<EOF
483 TTS_ENGINE="${TTS_ENGINE}"
484 ENCODER="${ENCODER}"
485 TEMPDIR="${pwd}"
486 NOISEFLOOR="${NOISEFLOOR}"
487 ${TTS_OPTS}
488 ${ENC_OPTS}
492 picklang() {
493 # figure out which languages that are around
494 for file in $rootdir/apps/lang/*.lang; do
495 clean=`echo $file | sed -e 's:.*/::g' | cut "-d." -f1`
496 langs="$langs $clean"
497 done
499 num=1
500 for one in $langs; do
501 echo "$num. $one"
502 num=`expr $num + 1`
503 done
505 read pick
506 return $pick;
509 whichlang() {
510 num=1
511 for one in $langs; do
512 if [ "$num" = "$pick" ]; then
513 echo $one
514 return
516 num=`expr $num + 1`
517 done
520 opt=$1
522 if test "$opt" = "--help"; then
523 echo "Rockbox configure script."
524 echo "Invoke this in a directory to generate a Makefile to build Rockbox"
525 echo "Do *NOT* run this within the tools directory!"
526 echo ""
527 echo "Usage: configure [--ccache][--no-ccache]"
528 exit
531 if test -r "configure"; then
532 # this is a check for a configure script in the current directory, it there
533 # is one, try to figure out if it is this one!
535 if { grep "^# Jukebox" configure >/dev/null 2>&1 ; } then
536 echo "WEEEEEEEEP. Don't run this configure script within the tools directory."
537 echo "It will only cause you pain and grief. Instead do this:"
538 echo ""
539 echo " cd .."
540 echo " mkdir build-dir"
541 echo " cd build-dir"
542 echo " ../tools/configure"
543 echo ""
544 echo "Much happiness will arise from this. Enjoy"
545 exit
549 # get our current directory
550 pwd=`pwd`;
552 if [ -z "$rootdir" ]; then
553 ##################################################################
554 # Figure out where the source code root is!
556 rootdir=`dirname $0`/../
558 #####################################################################
559 # Convert the possibly relative directory name to an absolute version
561 now=`pwd`
562 cd $rootdir
563 rootdir=`pwd`
565 # cd back to the build dir
566 cd $now
569 apps="apps"
570 appsdir='\$(ROOTDIR)/apps'
571 firmdir='\$(ROOTDIR)/firmware'
572 toolsdir='\$(ROOTDIR)/tools'
575 ##################################################################
576 # Figure out target platform
579 echo "Enter target platform:"
580 cat <<EOF
581 ==Archos== ==iriver== ==Apple iPod==
582 0) Player/Studio 10) H120/H140 20) Color/Photo
583 1) Recorder 11) H320/H340 21) Nano
584 2) FM Recorder 12) iHP-100/110/115 22) Video
585 3) Recorder v2 13) iFP-790 23) 3G
586 4) Ondio SP 14) H10 20Gb 24) 4G Grayscale
587 5) Ondio FM 15) H10 5/6Gb 25) Mini 1G
588 6) AV300 26) Mini 2G
590 ==iAudio== ==Toshiba== ==SanDisk==
591 30) X5/X5V/X5L 40) Gigabeat F 50) Sansa e200
592 51) Sansa e200R
593 ==Tatung==
594 60) Elio TPJ-1022
597 buildfor=`input`;
599 # Set of tools built for all target platforms:
600 toolset="rdf2binary convbdf"
602 # Toolsets for some target families:
603 archosbitmaptools="$toolset scramble descramble sh2d uclpack bmp2rb codepages"
604 iriverbitmaptools="$toolset scramble descramble mkboot bmp2rb codepages"
605 iaudiobitmaptools="$toolset scramble descramble mkboot bmp2rb codepages"
606 ipodbitmaptools="$toolset scramble ipod_fw bmp2rb codepages"
607 gigabeatbitmaptools="$toolset scramble descramble bmp2rb codepages"
608 # generic is used by IFP, H10, Sansa-e200
609 genericbitmaptools="$toolset bmp2rb codepages"
612 # ---- For each target ----
614 # *Variables*
615 # target_id: a unique number identifying this target, DOES NOT necessarily
616 # have to be the menu number. Just use the currently highest
617 # number+1 when you add a new target.
618 # archos: short model name used all over to identify this target
619 # target: -Ddefine passed to the build commands to make the correct
620 # config-*.h file get included etc
621 # tool: the tool that takes a plain binary and converts that into a
622 # working "firmware" file for your target
623 # output: the final output file name
624 # boottool: the tool that takes a plain binary and generates a bootloader
625 # file for your target (or blank to use $tool)
626 # bootoutput:the final output file name for the bootloader (or blank to use
627 # $output)
628 # appextra: passed to the APPEXTRA variable in the Makefiles.
629 # TODO: add proper explanation
630 # archosrom: used only for Archos targets that build a special flashable .ucl
631 # image. Set to blank for other builds.
632 # flash: the same as archosrom. These two should be merged
633 # plugins: set to 'yes' to build the plugins. Early development builds can
634 # set this to no in the early stages to have an easier life for a
635 # while
636 # codecs: lists codecs to build for this target
637 # toolset: lists what particular tools in the tools/ directory that this
638 # target needs to have built prior to building Rockbox
640 # *Functions*
641 # *cc: sets up gcc and compiler options for your target builds. Note
642 # that if you select a simulator build, the compiler selection is
643 # overridden later in the script.
645 case $buildfor in
647 0|player)
648 target_id=1
649 archos="player"
650 target="-DARCHOS_PLAYER"
651 memory="2"
652 shcc
653 tool="$rootdir/tools/scramble"
654 output="archos.mod"
655 appextra="player:gui"
656 archosrom="$pwd/rombox.ucl"
657 flash="$pwd/rockbox.ucl"
658 plugins="yes"
659 codecs=""
661 # toolset is the tools within the tools directory that we build for
662 # this particular target.
663 toolset="$toolset scramble descramble sh2d generate_rocklatin uclpack"
665 # Note: the convbdf is present in the toolset just because: 1) the
666 # firmware/Makefile assumes it is present always, and 2) we will need it when we
667 # build the player simulator
669 t_cpu="sh"
670 t_manufacturer="archos"
671 t_model="player"
674 1|recorder)
675 target_id=2
676 archos="recorder"
677 target="-DARCHOS_RECORDER"
678 memory="2"
679 shcc
680 tool="$rootdir/tools/scramble"
681 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
682 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
683 output="ajbrec.ajz"
684 appextra="recorder:gui"
685 archosrom="$pwd/rombox.ucl"
686 flash="$pwd/rockbox.ucl"
687 plugins="yes"
688 codecs=""
689 # toolset is the tools within the tools directory that we build for
690 # this particular target.
691 toolset=$archosbitmaptools
692 t_cpu="sh"
693 t_manufacturer="archos"
694 t_model="recorder"
697 2|fmrecorder)
698 target_id=3
699 archos="fmrecorder"
700 target="-DARCHOS_FMRECORDER"
701 memory="2"
702 shcc
703 tool="$rootdir/tools/scramble -fm"
704 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
705 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
706 output="ajbrec.ajz"
707 appextra="recorder:gui"
708 archosrom="$pwd/rombox.ucl"
709 flash="$pwd/rockbox.ucl"
710 plugins="yes"
711 codecs=""
712 # toolset is the tools within the tools directory that we build for
713 # this particular target.
714 toolset=$archosbitmaptools
715 t_cpu="sh"
716 t_manufacturer="archos"
717 t_model="fm_v2"
720 3|recorderv2)
721 target_id=4
722 archos="recorderv2"
723 target="-DARCHOS_RECORDERV2"
724 memory="2"
725 shcc
726 tool="$rootdir/tools/scramble -v2"
727 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
728 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
729 output="ajbrec.ajz"
730 appextra="recorder:gui"
731 archosrom="$pwd/rombox.ucl"
732 flash="$pwd/rockbox.ucl"
733 plugins="yes"
734 codecs=""
735 # toolset is the tools within the tools directory that we build for
736 # this particular target.
737 toolset=$archosbitmaptools
738 t_cpu="sh"
739 t_manufacturer="archos"
740 t_model="fm_v2"
743 4|ondiosp)
744 target_id=7
745 archos="ondiosp"
746 target="-DARCHOS_ONDIOSP"
747 memory="2"
748 shcc
749 tool="$rootdir/tools/scramble -osp"
750 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
751 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
752 output="ajbrec.ajz"
753 appextra="recorder:gui"
754 archosrom="$pwd/rombox.ucl"
755 flash="$pwd/rockbox.ucl"
756 plugins="yes"
757 codecs=""
758 # toolset is the tools within the tools directory that we build for
759 # this particular target.
760 toolset=$archosbitmaptools
761 t_cpu="sh"
762 t_manufacturer="archos"
763 t_model="ondio"
766 5|ondiofm)
767 target_id=8
768 archos="ondiofm"
769 target="-DARCHOS_ONDIOFM"
770 memory="2"
771 shcc
772 tool="$rootdir/tools/scramble -ofm"
773 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
774 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
775 output="ajbrec.ajz"
776 appextra="recorder:gui"
777 archosrom="$pwd/rombox.ucl"
778 flash="$pwd/rockbox.ucl"
779 plugins="yes"
780 codecs=""
781 toolset=$archosbitmaptools
782 t_cpu="sh"
783 t_manufacturer="archos"
784 t_model="ondio"
787 6|av300)
788 target_id=26
789 archos="av300"
790 target="-DARCHOS_AV300"
791 memory=16 # always
792 arm7tdmicc
793 tool="$rootdir/tools/scramble -mm=C"
794 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
795 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
796 output="cjbm.ajz"
797 appextra="recorder:gui"
798 archosrom=""
799 flash=""
800 plugins="yes"
801 codecs=""
802 # toolset is the tools within the tools directory that we build for
803 # this particular target.
804 toolset="$toolset scramble descramble bmp2rb codepages"
805 # architecture, manufacturer and model for the target-tree build
806 t_cpu="arm"
807 t_manufacturer="archos"
808 t_model="av300"
811 10|h120)
812 target_id=9
813 archos="h120"
814 target="-DIRIVER_H120"
815 memory=32 # always
816 coldfirecc
817 tool="$rootdir/tools/scramble -add=h120"
818 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
819 bmp2rb_native="$rootdir/tools/bmp2rb -f 2"
820 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
821 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
822 output="rockbox.iriver"
823 appextra="recorder:gui"
824 archosrom=""
825 flash="$pwd/rombox.iriver"
826 plugins="yes"
827 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
828 # toolset is the tools within the tools directory that we build for
829 # this particular target.
830 toolset=$iriverbitmaptools
831 t_cpu="coldfire"
832 t_manufacturer="iriver"
833 t_model="h100"
836 11|h300)
837 target_id=10
838 archos="h300"
839 target="-DIRIVER_H300"
840 memory=32 # always
841 coldfirecc
842 tool="$rootdir/tools/scramble -add=h300"
843 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
844 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
845 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
846 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
847 output="rockbox.iriver"
848 appextra="recorder:gui"
849 archosrom=""
850 flash=""
851 plugins="yes"
852 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
853 # toolset is the tools within the tools directory that we build for
854 # this particular target.
855 toolset=$iriverbitmaptools
856 t_cpu="coldfire"
857 t_manufacturer="iriver"
858 t_model="h300"
861 12|h100)
862 target_id=11
863 archos="h100"
864 target="-DIRIVER_H100"
865 memory=16 # always
866 coldfirecc
867 tool="$rootdir/tools/scramble -add=h100"
868 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
869 bmp2rb_native="$rootdir/tools/bmp2rb -f 2"
870 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
871 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
872 output="rockbox.iriver"
873 appextra="recorder:gui"
874 archosrom=""
875 flash=""
876 plugins="yes"
877 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
878 # toolset is the tools within the tools directory that we build for
879 # this particular target.
880 toolset=$iriverbitmaptools
881 t_cpu="coldfire"
882 t_manufacturer="iriver"
883 t_model="h100"
886 30|x5)
887 target_id=12
888 archos="x5"
889 target="-DIAUDIO_X5"
890 memory=16 # always
891 coldfirecc
892 tool="$rootdir/tools/scramble -add=iax5"
893 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
894 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
895 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
896 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 7"
897 output="rockbox.iaudio"
898 appextra="recorder:gui"
899 archosrom=""
900 flash=""
901 plugins="yes"
902 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
903 # toolset is the tools within the tools directory that we build for
904 # this particular target.
905 toolset="$iaudiobitmaptools"
906 # architecture, manufacturer and model for the target-tree build
907 t_cpu="coldfire"
908 t_manufacturer="iaudio"
909 t_model="x5"
912 20|ipodcolor)
913 target_id=13
914 archos="ipodcolor"
915 target="-DIPOD_COLOR"
916 memory=32 # always
917 arm7tdmicc
918 tool="$rootdir/tools/scramble -add=ipco"
919 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
920 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
921 output="rockbox.ipod"
922 appextra="recorder:gui"
923 archosrom=""
924 flash=""
925 plugins="yes"
926 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
927 bootoutput="bootloader-$archos.ipod"
928 # toolset is the tools within the tools directory that we build for
929 # this particular target.
930 toolset=$ipodbitmaptools
931 # architecture, manufacturer and model for the target-tree build
932 t_cpu="arm"
933 t_manufacturer="ipod"
934 t_model="color"
937 21|ipodnano)
938 target_id=14
939 archos="ipodnano"
940 target="-DIPOD_NANO"
941 memory=32 # always
942 arm7tdmicc
943 tool="$rootdir/tools/scramble -add=nano"
944 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
945 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
946 output="rockbox.ipod"
947 appextra="recorder:gui"
948 archosrom=""
949 flash=""
950 plugins="yes"
951 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
952 bootoutput="bootloader-$archos.ipod"
953 # toolset is the tools within the tools directory that we build for
954 # this particular target.
955 toolset=$ipodbitmaptools
956 # architecture, manufacturer and model for the target-tree build
957 t_cpu="arm"
958 t_manufacturer="ipod"
959 t_model="nano"
962 22|ipodvideo)
963 target_id=15
964 archos="ipodvideo"
965 target="-DIPOD_VIDEO"
966 memory=32 # 30GB models have 32MB, 60GB have 64MB
967 arm7tdmicc
968 tool="$rootdir/tools/scramble -add=ipvd"
969 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
970 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
971 output="rockbox.ipod"
972 appextra="recorder:gui"
973 archosrom=""
974 flash=""
975 plugins="yes"
976 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
977 bootoutput="bootloader-$archos.ipod"
978 # toolset is the tools within the tools directory that we build for
979 # this particular target.
980 toolset=$ipodbitmaptools
981 # architecture, manufacturer and model for the target-tree build
982 t_cpu="arm"
983 t_manufacturer="ipod"
984 t_model="video"
987 23|ipod3g)
988 target_id=16
989 archos="ipod3g"
990 target="-DIPOD_3G"
991 memory=32 # always
992 arm7tdmicc
993 tool="$rootdir/tools/scramble -add=ip3g"
994 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
995 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
996 output="rockbox.ipod"
997 appextra="recorder:gui"
998 archosrom=""
999 flash=""
1000 plugins="yes"
1001 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
1002 bootoutput="bootloader-$archos.ipod"
1003 # toolset is the tools within the tools directory that we build for
1004 # this particular target.
1005 toolset=$ipodbitmaptools
1006 # architecture, manufacturer and model for the target-tree build
1007 t_cpu="arm"
1008 t_manufacturer="ipod"
1009 t_model="3g"
1012 24|ipod4g)
1013 target_id=17
1014 archos="ipod4g"
1015 target="-DIPOD_4G"
1016 memory=32 # always
1017 arm7tdmicc
1018 tool="$rootdir/tools/scramble -add=ip4g"
1019 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1020 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1021 output="rockbox.ipod"
1022 appextra="recorder:gui"
1023 archosrom=""
1024 flash=""
1025 plugins="yes"
1026 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
1027 bootoutput="bootloader-$archos.ipod"
1028 # toolset is the tools within the tools directory that we build for
1029 # this particular target.
1030 toolset=$ipodbitmaptools
1031 # architecture, manufacturer and model for the target-tree build
1032 t_cpu="arm"
1033 t_manufacturer="ipod"
1034 t_model="4g"
1037 25|ipodmini)
1038 target_id=18
1039 archos="ipodmini"
1040 target="-DIPOD_MINI"
1041 memory=32 # always
1042 arm7tdmicc
1043 tool="$rootdir/tools/scramble -add=mini"
1044 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1045 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1046 output="rockbox.ipod"
1047 appextra="recorder:gui"
1048 archosrom=""
1049 flash=""
1050 plugins="yes"
1051 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
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="mini"
1062 13|ifp7xx)
1063 target_id=19
1064 archos="ifp7xx"
1065 target="-DIRIVER_IFP7XX"
1066 memory=1
1067 arm7tdmicc short
1068 tool="cp"
1069 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1070 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
1071 output="rockbox.wma"
1072 appextra="recorder:gui"
1073 archosrom=""
1074 flash=""
1075 plugins="yes"
1076 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
1077 # toolset is the tools within the tools directory that we build for
1078 # this particular target.
1079 toolset=$genericbitmaptools
1080 t_cpu="arm"
1081 t_manufacturer="iriver"
1082 t_model="ifp7xx"
1085 40|gigabeatf)
1086 target_id=20
1087 archos="gigabeatf"
1088 target="-DGIGABEAT_F"
1089 memory=32 # always
1090 arm9tdmicc
1091 tool="cp"
1092 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1093 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1094 output="rockbox.gigabeat"
1095 appextra="recorder:gui"
1096 archosrom=""
1097 flash=""
1098 plugins="yes"
1099 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
1100 toolset=$gigabeatbitmaptools
1101 boottool="$rootdir/tools/scramble -gigabeat"
1102 bootoutput="FWIMG01.DAT"
1103 # architecture, manufacturer and model for the target-tree build
1104 t_cpu="arm"
1105 t_manufacturer="gigabeat"
1106 t_model="meg-fx"
1109 26|ipodmini2g)
1110 target_id=21
1111 archos="ipodmini2g"
1112 target="-DIPOD_MINI2G"
1113 memory=32 # always
1114 arm7tdmicc
1115 tool="$rootdir/tools/scramble -add=mn2g"
1116 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1117 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1118 output="rockbox.ipod"
1119 appextra="recorder:gui"
1120 archosrom=""
1121 flash=""
1122 plugins="yes"
1123 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
1124 bootoutput="bootloader-$archos.ipod"
1125 # toolset is the tools within the tools directory that we build for
1126 # this particular target.
1127 toolset=$ipodbitmaptools
1128 # architecture, manufacturer and model for the target-tree build
1129 t_cpu="arm"
1130 t_manufacturer="ipod"
1131 t_model="mini2g"
1134 14|h10)
1135 target_id=22
1136 archos="h10"
1137 target="-DIRIVER_H10"
1138 memory=32 # always
1139 arm7tdmicc
1140 tool="$rootdir/tools/scramble -add=h10"
1141 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1142 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1143 output="rockbox.h10"
1144 appextra="recorder:gui"
1145 archosrom=""
1146 flash=""
1147 plugins="yes"
1148 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
1149 boottool="$rootdir/tools/scramble -mi4v3"
1150 bootoutput="H10_20GC.mi4"
1151 # toolset is the tools within the tools directory that we build for
1152 # this particular target.
1153 toolset="$genericbitmaptools scramble"
1154 # architecture, manufacturer and model for the target-tree build
1155 t_cpu="arm"
1156 t_manufacturer="iriver"
1157 t_model="h10"
1160 50|e200)
1161 target_id=23
1162 archos="e200"
1163 target="-DSANSA_E200"
1164 memory=32 # supposedly
1165 arm7tdmicc
1166 tool="$rootdir/tools/scramble -add=e200"
1167 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1168 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1169 output="rockbox.e200"
1170 appextra="recorder:gui"
1171 archosrom=""
1172 flash=""
1173 plugins="yes"
1174 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
1175 boottool="$rootdir/tools/scramble -mi4v3"
1176 bootoutput="PP5022.mi4"
1177 # toolset is the tools within the tools directory that we build for
1178 # this particular target.
1179 toolset="$genericbitmaptools scramble"
1180 # architecture, manufacturer and model for the target-tree build
1181 t_cpu="arm"
1182 t_manufacturer="sandisk"
1183 t_model="sansa-e200"
1186 51|e200r)
1187 # the e200R model is pretty much identical to the e200, it only has a
1188 # different option to the scramble tool when building a bootloader and
1189 # makes the bootloader output file name in all lower case.
1190 target_id=27
1191 archos="e200r"
1192 target="-DSANSA_E200"
1193 memory=32 # supposedly
1194 arm7tdmicc
1195 tool="$rootdir/tools/scramble -add=e200"
1196 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1197 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1198 output="rockbox.e200"
1199 appextra="recorder:gui"
1200 archosrom=""
1201 flash=""
1202 plugins="yes"
1203 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
1204 boottool="$rootdir/tools/scramble -mi4r"
1205 bootoutput="pp5022.mi4"
1206 # toolset is the tools within the tools directory that we build for
1207 # this particular target.
1208 toolset="$genericbitmaptools scramble"
1209 # architecture, manufacturer and model for the target-tree build
1210 t_cpu="arm"
1211 t_manufacturer="sandisk"
1212 t_model="sansa-e200"
1215 15|h10_5gb)
1216 target_id=24
1217 archos="h10_5gb"
1218 target="-DIRIVER_H10_5GB"
1219 memory=32 # always
1220 arm7tdmicc
1221 tool="$rootdir/tools/scramble -add=h10_5gb"
1222 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1223 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
1224 output="rockbox.h10"
1225 appextra="recorder:gui"
1226 archosrom=""
1227 flash=""
1228 plugins="yes"
1229 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
1230 boottool="$rootdir/tools/scramble -mi4v2"
1231 bootoutput="H10.mi4"
1232 # toolset is the tools within the tools directory that we build for
1233 # this particular target.
1234 toolset="$genericbitmaptools scramble"
1235 # architecture, manufacturer and model for the target-tree build
1236 t_cpu="arm"
1237 t_manufacturer="iriver"
1238 t_model="h10"
1241 60|tpj1022)
1242 target_id=25
1243 archos="tpj1022"
1244 target="-DELIO_TPJ1022"
1245 memory=32 # always
1246 arm7tdmicc
1247 tool="$rootdir/tools/scramble -add tpj2"
1248 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1249 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
1250 output="rockbox.elio"
1251 appextra="recorder:gui"
1252 archosrom=""
1253 flash=""
1254 plugins="yes"
1255 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
1256 boottool="$rootdir/tools/scramble -mi4v2"
1257 bootoutput="pp5020.mi4"
1258 # toolset is the tools within the tools directory that we build for
1259 # this particular target.
1260 toolset="$genericbitmaptools scramble"
1261 # architecture, manufacturer and model for the target-tree build
1262 t_cpu="arm"
1263 t_manufacturer="tatung"
1264 t_model="tpj1022"
1268 echo "Please select a supported target platform!"
1269 exit
1272 esac
1274 echo "Platform set to $archos"
1277 #remove start
1278 ############################################################################
1279 # Amount of memory, for those that can differ.
1282 if [ "$memory" = "2" ]; then
1283 size="2"
1284 if [ -z "$update" ]; then
1285 echo "Enter size of your RAM (in MB): (defaults to 2)"
1286 size=`input`;
1289 case $size in
1291 memory="8"
1294 memory="2"
1297 esac
1298 echo "Memory size selected: $memory MB"
1300 #remove end
1302 ##################################################################
1303 # Figure out build "type"
1306 # the ifp7x0 is the only platform that supports building a gdb stub like
1307 # this
1308 case $archos in
1309 ifp7xx)
1310 gdbstub="(G)DB stub, "
1314 esac
1316 echo ""
1317 echo "Build (N)ormal, (A)dvanced, (S)imulator, (B)ootloader, $gdbstub(M)anual, (V)oice? (N)"
1319 option=`input`;
1321 case $option in
1322 [Bb])
1323 if test -n "$archosrom"; then
1324 # Archos SH-based players do this somewhat differently for
1325 # some reason
1326 appsdir='\$(ROOTDIR)/flash/bootbox'
1327 apps="bootbox"
1328 else
1329 appsdir='\$(ROOTDIR)/bootloader'
1330 apps="bootloader"
1331 flash=""
1332 if test -n "$boottool"; then
1333 tool="$boottool"
1335 if test -n "$bootoutput"; then
1336 output=$bootoutput
1339 extradefines="-DBOOTLOADER -ffunction-sections -fdata-sections"
1340 bootloader="1"
1341 echo "Bootloader build selected"
1343 [Ss])
1344 debug="-DDEBUG"
1345 simulator="yes"
1346 extradefines="-DSIMULATOR"
1347 echo "Simulator build selected"
1348 whichsim
1350 [Aa])
1351 echo "Advanced build selected"
1352 whichadvanced
1354 [Gg])
1355 extradefines="-DSTUB" # for target makefile symbol EXTRA_DEFINES
1356 appsdir='\$(ROOTDIR)/gdb'
1357 apps="stub"
1358 case $archos in
1359 ifp7xx)
1360 output="stub.wma"
1364 esac
1365 echo "GDB stub build selected"
1367 [Mm])
1368 appsdir='\$(ROOTDIR)/manual'
1369 firmdir='\$(ROOTDIR)/manual/platform' # No Makefile here. Effectively ignores target
1370 toolsdir=$firmdir;
1371 toolset='';
1372 apps="manual"
1373 echo "Manual build selected"
1375 [Vv])
1376 echo "Voice build selected"
1377 voiceconfig
1378 toolset="${toolset} voicefont wavtrim"
1379 voice="yes"
1382 debug=""
1383 echo "Normal build selected"
1386 esac
1387 # to be able running "make manual" from non-manual configuration
1388 case $archos in
1389 fmrecorder)
1390 manualdev="recorderv2fm"
1392 recorderv2)
1393 manualdev="recorderv2fm"
1395 h1??)
1396 manualdev="h1xx"
1398 ipodmini2g)
1399 manualdev="ipodmini"
1402 manualdev=$archos
1404 esac
1406 if [ -z "$debug" ]; then
1407 GCCOPTS="$GCCOPTS $GCCOPTIMIZE"
1410 echo "Using source code root directory: $rootdir"
1412 # this was once possible to change at build-time, but no more:
1413 language="english"
1415 # Ask about language if building voice
1416 if [ "yes" = "$voice" ]; then
1417 echo "Select a number for the language to use (default is english)"
1419 picklang
1420 language=`whichlang`
1422 if [ -z "$language" ]; then
1423 # pick a default
1424 language="english"
1426 echo "Language set to $language"
1429 uname=`uname`
1431 if [ "yes" = "$simulator" ]; then
1432 # setup compiler and things for simulator
1433 simcc
1435 if [ -d "archos" ]; then
1436 echo "sub directory archos already present"
1437 else
1438 mkdir archos
1439 echo "created an archos subdirectory for simulating the hard disk"
1443 # Now, figure out version number of the (gcc) compiler we are about to use
1444 gccver=`$CC -dumpversion`;
1446 if [ -z "$gccver" ]; then
1447 echo "WARNING: The compiler you must use ($CC) is not in your path!"
1448 echo "WARNING: this may cause your build to fail since we cannot do the"
1449 echo "WARNING: checks we want now."
1450 else
1452 # gccver should now be "3.3.5", "3.4.3", "2.95.3-6" and similar, but don't
1453 # DEPEND on it
1455 num1=`echo $gccver | cut -d . -f1`
1456 num2=`echo $gccver | cut -d . -f2`
1457 gccnum=`(expr $num1 "*" 100 + $num2) 2>/dev/null`
1459 # This makes:
1460 # 3.3.X => 303
1461 # 3.4.X => 304
1462 # 2.95.3 => 295
1464 echo "Using $CC $gccver ($gccnum)"
1466 if test "$gccnum" -ge "400"; then
1467 # gcc 4.0 is just *so* much pickier on arguments that differ in signedness
1468 # so we ignore that warnings for now
1469 # -Wno-pointer-sign
1470 GCCOPTS="$GCCOPTS -Wno-pointer-sign"
1473 if test "$gccnum" -ge "401"; then
1474 # this is a lame hack to avoid "warning: dereferencing type-punned pointer
1475 # will break strict-aliasing rules"
1477 GCCOPTS="$GCCOPTS -fno-strict-aliasing"
1482 # check the compiler for SH platforms
1483 if test "$CC" = "sh-elf-gcc"; then
1484 if test "$gccnum" -lt "400"; then
1485 echo "WARNING: Consider upgrading your compiler to the 4.0.X series!"
1486 echo "WARNING: http://www.rockbox.org/twiki/bin/view/Main/CrossCompiler"
1487 else
1488 # figure out patch status
1489 gccpatch=`$CC --version`;
1491 if { echo $gccpatch | grep "rockbox" >/dev/null 2>&1; } then
1492 echo "gcc $gccver is rockbox patched"
1493 # then convert -O to -Os to get smaller binaries!
1494 GCCOPTS=`echo $GCCOPTS | sed 's/ -O / -Os /'`
1495 else
1496 echo "WARNING: You use an unpatched gcc compiler: $gccver"
1497 echo "WARNING: http://www.rockbox.org/twiki/bin/view/Main/CrossCompiler"
1502 if test "$1" = "--ccache"; then
1503 echo "Enable ccache for building"
1504 ccache="ccache"
1505 else
1506 if test "$1" != "--no-ccache"; then
1507 ccache=`findtool ccache`
1508 if test -n "$ccache"; then
1509 echo "Found and uses ccache ($ccache)"
1514 if test -n "$ccache"; then
1515 CC="$ccache $CC"
1518 if test "X$endian" = "Xbig"; then
1519 defendian="ROCKBOX_BIG_ENDIAN"
1520 else
1521 defendian="ROCKBOX_LITTLE_ENDIAN"
1524 sed > autoconf.h \
1525 -e "s,@ENDIAN@,${defendian},g" \
1526 -e "s,^#undef ROCKBOX_HAS_LOGF,$use_logf,g" \
1527 -e "s,@SIMSOUND@,$use_simsound,g" \
1528 -e "s,@config_rtc@,$config_rtc,g" \
1529 -e "s,@have_rtc_alarm@,$have_rtc_alarm,g" \
1530 <<EOF
1531 /* This header was made by configure */
1532 #ifndef __BUILD_AUTOCONF_H
1533 #define __BUILD_AUTOCONF_H
1535 /* Define endianess for the target or simulator platform */
1536 #define @ENDIAN@ 1
1538 /* Define this if you build rockbox to support the logf logging and display */
1539 #undef ROCKBOX_HAS_LOGF
1541 /* Define this if you have the linux/soundcard.h header and thus can compile
1542 the sound-playing code in the X11 sim */
1543 @SIMSOUND@
1545 /* optional defines for RTC mod for h1x0 */
1546 @config_rtc@
1547 @have_rtc_alarm@
1549 #endif /* __BUILD_AUTOCONF_H */
1552 if test -n "$t_cpu"; then
1553 TARGET_INC="-I\$(FIRMDIR)/target/$t_cpu/$t_manufacturer/$t_model"
1554 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/$t_cpu/$t_manufacturer"
1555 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/$t_cpu"
1556 GCCOPTS="$GCCOPTS"
1559 if test "$simulator" = "yes"; then
1560 # add simul make stuff on the #SIMUL# line
1561 simmagic1="s,@SIMUL1@,\$(SILENT)\$(MAKE) -C \$(SIMDIR) OBJDIR=\$(BUILDDIR)/sim,"
1562 simmagic2="s,@SIMUL2@,\$(SILENT)\$(MAKE) -C \$(ROOTDIR)/uisimulator/common OBJDIR=\$(BUILDDIR)/comsim,"
1563 else
1564 # delete the lines that match
1565 simmagic1='/@SIMUL1@/D'
1566 simmagic2='/@SIMUL2@/D'
1569 sed > Makefile \
1570 -e "s,@ROOTDIR@,${rootdir},g" \
1571 -e "s,@DEBUG@,${debug},g" \
1572 -e "s,@MEMORY@,${memory},g" \
1573 -e "s,@TARGET_ID@,${target_id},g" \
1574 -e "s,@TARGET@,${target},g" \
1575 -e "s,@ARCHOS@,${archos},g" \
1576 -e "s,@LANGUAGE@,${language},g" \
1577 -e "s,@PWD@,${pwd},g" \
1578 -e "s,@CC@,${CC},g" \
1579 -e "s,@LD@,${LD},g" \
1580 -e "s,@AR@,${AR},g" \
1581 -e "s,@AS@,${AS},g" \
1582 -e "s,@OC@,${OC},g" \
1583 -e "s,@WINDRES@,${WINDRES},g" \
1584 -e "s,@DLLTOOL@,${DLLTOOL},g" \
1585 -e "s,@DLLWRAP@,${DLLWRAP},g" \
1586 -e "s,@RANLIB@,${RANLIB},g" \
1587 -e "s,@TOOL@,${tool},g" \
1588 -e "s,@BMP2RB_NATIVE@,${bmp2rb_native},g" \
1589 -e "s,@BMP2RB_MONO@,${bmp2rb_mono},g" \
1590 -e "s,@BMP2RB_REMOTENATIVE@,${bmp2rb_remotenative},g" \
1591 -e "s,@BMP2RB_REMOTEMONO@,${bmp2rb_remotemono},g" \
1592 -e "s,@OUTPUT@,${output},g" \
1593 -e "s,@APPEXTRA@,${appextra},g" \
1594 -e "s,@ARCHOSROM@,${archosrom},g" \
1595 -e "s,@FLASHFILE@,${flash},g" \
1596 -e "s,@PLUGINS@,${plugins},g" \
1597 -e "s,@CODECS@,${codecs},g" \
1598 -e "s,@PROFILE_OPTS@,${PROFILE_OPTS},g" \
1599 -e "s,@SHARED_FLAG@,${SHARED_FLAG},g" \
1600 -e "s,@GCCOPTS@,${GCCOPTS},g" \
1601 -e "s,@TARGET_INC@,${TARGET_INC},g" \
1602 -e "s!@LDOPTS@!${LDOPTS}!g" \
1603 -e "s,@LOADADDRESS@,${loadaddress},g" \
1604 -e "s,@EXTRADEF@,${extradefines},g" \
1605 -e "s,@APPSDIR@,${appsdir},g" \
1606 -e "s,@FIRMDIR@,${firmdir},g" \
1607 -e "s,@TOOLSDIR@,${toolsdir},g" \
1608 -e "s,@APPS@,${apps},g" \
1609 -e "s,@SIMVER@,${simver},g" \
1610 -e "s,@GCCVER@,${gccver},g" \
1611 -e "s,@GCCNUM@,${gccnum},g" \
1612 -e "s,@UNAME@,${uname},g" \
1613 -e "s,@ENDIAN@,${defendian},g" \
1614 -e "s,@TOOLSET@,${toolset},g" \
1615 -e "${simmagic1}" \
1616 -e "${simmagic2}" \
1617 -e "s,@MANUALDEV@,${manualdev},g" \
1618 <<EOF
1619 ## Automaticly generated. http://www.rockbox.org/
1621 ifndef V
1622 SILENT=@
1623 else
1624 VERBOSEOPT=-v
1625 endif
1627 # old 'make' versions don't have the built-in 'info' function
1628 info=old\$(shell echo >&2 "Consider upgrading to GNU make 3.81+ for optimum build performance.")
1629 ifeq (\$(call info),old)
1630 export info=echo "\$\$(1)";
1631 endif
1633 export ROOTDIR=@ROOTDIR@
1634 export FIRMDIR=@FIRMDIR@
1635 export APPSDIR=@APPSDIR@
1636 export TOOLSDIR=@TOOLSDIR@
1637 export DOCSDIR=\$(ROOTDIR)/docs
1638 export MANUALDIR=\${ROOTDIR}/manual
1639 export DEBUG=@DEBUG@
1640 export ARCHOS=@ARCHOS@
1641 export ARCHOSROM=@ARCHOSROM@
1642 export FLASHFILE=@FLASHFILE@
1643 export TARGET_ID=@TARGET_ID@
1644 export TARGET=@TARGET@
1645 export OBJDIR=@PWD@
1646 export BUILDDIR=@PWD@
1647 export LANGUAGE=@LANGUAGE@
1648 export MEMORYSIZE=@MEMORY@
1649 export VERSION=\$(shell \$(ROOTDIR)/tools/svnversion.sh \$(ROOTDIR))
1650 export BUILDDATE=\$(shell date -u +'-DYEAR=%Y -DMONTH=%m -DDAY=%d')
1651 export MKFIRMWARE=@TOOL@
1652 export BMP2RB_MONO=@BMP2RB_MONO@
1653 export BMP2RB_NATIVE=@BMP2RB_NATIVE@
1654 export BMP2RB_REMOTEMONO=@BMP2RB_REMOTEMONO@
1655 export BMP2RB_REMOTENATIVE=@BMP2RB_REMOTENATIVE@
1656 export BINARY=@OUTPUT@
1657 export APPEXTRA=@APPEXTRA@
1658 export ENABLEDPLUGINS=@PLUGINS@
1659 export SOFTWARECODECS=@CODECS@
1660 export EXTRA_DEFINES=@EXTRADEF@
1661 export HOSTCC=gcc
1662 export CC=@CC@
1663 export LD=@LD@
1664 export AR=@AR@
1665 export AS=@AS@
1666 export OC=@OC@
1667 export WINDRES=@WINDRES@
1668 export DLLTOOL=@DLLTOOL@
1669 export DLLWRAP=@DLLWRAP@
1670 export RANLIB=@RANLIB@
1671 export PROFILE_OPTS=@PROFILE_OPTS@
1672 export GCCOPTS=@GCCOPTS@
1673 export TARGET_INC=@TARGET_INC@
1674 export LOADADDRESS=@LOADADDRESS@
1675 export SIMVER=@SIMVER@
1676 export SIMDIR=\$(ROOTDIR)/uisimulator/\$(SIMVER)
1677 export SHARED_FLAG=@SHARED_FLAG@
1678 export LDOPTS=@LDOPTS@
1679 export GCCVER=@GCCVER@
1680 export GCCNUM=@GCCNUM@
1681 export UNAME=@UNAME@
1682 export MANUALDEV=@MANUALDEV@
1684 # Do not print "Entering directory ..."
1685 MAKEFLAGS += --no-print-directory
1687 .PHONY: all clean tags zip tools manual
1689 all: tools
1690 @SIMUL1@
1691 @SIMUL2@
1692 \$(SILENT)\$(MAKE) -C \$(FIRMDIR) OBJDIR=\$(BUILDDIR)/firmware
1693 \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@
1695 bin: tools
1696 @SIMUL1@
1697 @SIMUL2@
1698 \$(SILENT)\$(MAKE) -C \$(FIRMDIR) OBJDIR=\$(BUILDDIR)/firmware
1699 \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@ \$(BUILDDIR)/\$(BINARY)
1701 veryclean: clean toolsclean
1703 toolsclean:
1704 \$(SILENT)\$(MAKE) -C \$(TOOLSDIR) clean
1706 clean:
1707 \$(SILENT)echo Cleaning build directory
1708 \$(SILENT)rm -rf rockbox.zip TAGS @APPS@ firmware comsim sim lang.[ch]\
1709 manual *.pdf *.a credits.raw @OUTPUT@ bitmaps pluginbitmaps \
1710 @ARCHOSROM@ @FLASHFILE@ UI256.bmp rockbox-full.zip \
1711 html txt rockbox-manual*.zip sysfont.h
1713 voice: tools
1714 \$(TOOLSDIR)/genvoice.sh \$(ROOTDIR) \$(LANGUAGE) \$(ARCHOS) voicesettings.sh
1716 tools:
1717 \$(SILENT)\$(MAKE) -C \$(TOOLSDIR) CC=\$(HOSTCC) @TOOLSET@
1719 tags:
1720 \$(SILENT)rm -f TAGS
1721 \$(SILENT)\$(MAKE) -C \$(FIRMDIR) tags
1722 \$(SILENT)\$(MAKE) -C \$(APPSDIR) tags
1723 \$(SILENT)\$(MAKE) -C \$(APPSDIR)/plugins tags
1724 \$(SILENT)\$(MAKE) -C \$(APPSDIR)/plugins/lib tags
1726 fontzip:
1727 \$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -r "\$(ROOTDIR)" -f 1 -o rockbox-fonts.zip \$(TARGET) \$(BINARY)
1729 zip:
1730 \$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
1732 mapzip:
1733 \$(SILENT)find . -name "*.map" | xargs zip rockbox-maps.zip
1735 fullzip:
1736 \$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -r "\$(ROOTDIR)" -f 2 -o rockbox-full.zip \$(TARGET) \$(BINARY)
1738 7zip:
1739 \$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -o "rockbox.7z" -z "7za a" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
1741 tar:
1742 \$(SILENT)rm -f rockbox.tar
1743 \$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -o "rockbox.tar" -z "tar --no-recursion -uf" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
1745 bzip2: tar
1746 \$(SILENT)bzip2 -f9 rockbox.tar
1748 gzip: tar
1749 \$(SILENT)gzip -f9 rockbox.tar
1751 manual: manual-pdf
1752 manual-pdf:
1753 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-pdf
1754 manual-html:
1755 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-html
1756 manual-zhtml: manual-zip
1757 manual-txt:
1758 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-txt
1759 manual-ztxt:
1760 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-txt-zip
1761 manual-zip:
1762 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-zip
1764 help:
1765 @echo "A few helpful make targets"
1766 @echo ""
1767 @echo "all - builds a full Rockbox (default), including tools"
1768 @echo "bin - builds only the Rockbox.<target name> file"
1769 @echo "clean - cleans a build directory (not tools)"
1770 @echo "veryclean - cleans the build and tools directories"
1771 @echo "manual - builds a manual"
1772 @echo "manual-html - HTML manual"
1773 @echo "manual-zip - HTML manual (zipped)"
1774 @echo "manual-txt - txt manual"
1775 @echo "fullzip - creates a rockbox.zip of your build with fonts"
1776 @echo "zip - creates a rockbox.zip of your build (no fonts)"
1777 @echo "gzip - creates a rockbox.tar.gz of your build (no fonts)"
1778 @echo "bzip2 - creates a rockbox.tar.bz2 of your build (no fonts)"
1779 @echo "7zip - creates a rockbox.7z of your build (no fonts)"
1780 @echo "fontzip - creates rockbox-fonts.zip"
1781 @echo "mapzip - creates rockbox-maps.zip with all .map files"
1782 @echo "tools - builds the tools only"
1783 @echo "install - installs your build (for simulator builds only)"
1787 if [ "yes" = "$simulator" ]; then
1789 cat >> Makefile <<EOF
1791 install:
1792 @echo "installing a full setup in your archos dir"
1793 @(\$(MAKE) fullzip && cd archos && unzip -oq ../rockbox-full.zip)
1798 echo "Created Makefile"