Forgot to add a file as usual.
[Rockbox.git] / tools / configure
blob3c75d9b00d32f31f982488434a6c835d89f9bf7b
1 #!/bin/sh
2 # __________ __ ___.
3 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 # \/ \/ \/ \/ \/
8 # $Id$
11 # global CC options for all platforms
12 CCOPTS="-W -Wall -Wundef -O -nostdlib -ffreestanding -Wstrict-prototypes"
14 use_logf="#undef ROCKBOX_HAS_LOGF"
16 scriptver=`echo '$Revision$' | sed -e 's:\\$::g' -e 's/Revision: //'`
19 # Begin Function Definitions
21 input() {
22 read response
23 echo $response
26 prefixtools () {
27 prefix="$1"
28 CC=${prefix}gcc
29 WINDRES=${prefix}windres
30 DLLTOOL=${prefix}dlltool
31 DLLWRAP=${prefix}dllwrap
32 RANLIB=${prefix}ranlib
33 LD=${prefix}ld
34 AR=${prefix}ar
35 AS=${prefix}as
36 OC=${prefix}objcopy
39 crosswincc () {
40 # naive approach to selecting a mingw cross-compiler on linux/*nix
41 echo "Enabling win32 crosscompiling"
43 prefixtools i586-mingw32msvc-
45 LDOPTS="-lgdi32 -luser32 -mwindows"
46 # add cross-compiler option(s)
47 GCCOPTS="$GCCOPTS -mno-cygwin"
49 output="rockboxui.exe" # use this as output binary name
50 crosscompile="yes"
51 endian="little" # windows is little endian
54 # scan the $PATH for the given command
55 findtool(){
56 file="$1"
58 IFS=":"
59 for path in $PATH
61 # echo "checks for $file in $path" >&2
62 if test -f "$path/$file"; then
63 echo "$path/$file"
64 return
66 done
70 simcc () {
72 # default tool setup for native building
73 prefixtools ""
75 simver=sdl
76 GCCOPTS='-W -Wall -g -fno-builtin'
78 output="rockboxui" # use this as default output binary name
80 # generic sdl-config checker
81 sdl=`findtool sdl-config`
83 if [ -z "$sdl" ]; then
84 echo "configure didn't find sdl-config, which indicates that you"
85 echo "don't have SDL (properly) installed. Please correct and"
86 echo "re-run configure!"
87 exit
90 # default share option, override below if needed
91 SHARED_FLAG="-shared"
93 case $uname in
94 CYGWIN*)
95 echo "Cygwin host detected"
97 # sdl version
98 GCCOPTS="$GCCOPTS `sdl-config --cflags`"
99 LDOPTS="`sdl-config --libs` -mconsole"
101 output="rockboxui.exe" # use this as output binary name
104 Linux)
105 echo "Linux host detected"
106 GCCOPTS="$GCCOPTS"
107 if [ "0" != `sdl-config --libs |grep -c mwindows` ]; then
108 # Enable crosscompiling if sdl-config is from Windows SDL
109 crosswincc
111 GCCOPTS="$GCCOPTS `sdl-config --cflags`"
112 LDOPTS="`sdl-config --libs`"
115 FreeBSD)
116 echo "FreeBSD host detected"
117 # sdl version
118 GCCOPTS="$GCCOPTS `sdl-config --cflags`"
119 LDOPTS="`sdl-config --libs`"
122 Darwin)
123 echo "Darwin host detected"
124 # sdl version
125 GCCOPTS="$GCCOPTS `sdl-config --cflags`"
126 LDOPTS="`sdl-config --libs`"
127 SHARED_FLAG="-dynamiclib -Wl\,-single_module"
131 echo "Unsupported system: $uname, fix configure and retry"
132 exit
134 esac
136 if [ "`uname -m`" = "x86_64" ]; then
137 GCCOPTS="$GCCOPTS -fPIC" # needed to make shared objects link
140 GCCOPTS="$GCCOPTS -I\$(SIMDIR)"
142 if test "X$crosscompile" != "Xyes"; then
143 id=$$
144 cat >/tmp/conftest-$id.c <<EOF
145 #include <stdio.h>
146 int main(int argc, char **argv)
148 int var=0;
149 char *varp = (char *)&var;
150 *varp=1;
152 printf("%d\n", var);
153 return 0;
157 $CC -o /tmp/conftest-$id /tmp/conftest-$id.c 2>/dev/null
159 if test `/tmp/conftest-$id 2>/dev/null` -gt "1"; then
160 # big endian
161 endian="big"
162 else
163 # little endian
164 endian="little"
166 echo "Simulator environment deemed $endian endian"
168 # use wildcard here to make it work even if it was named *.exe like
169 # on cygwin
170 rm -f /tmp/conftest-$id*
174 shcc () {
175 prefixtools sh-elf-
176 GCCOPTS="$CCOPTS -m1"
177 GCCOPTIMIZE="-fomit-frame-pointer -fschedule-insns"
178 endian="big"
181 calmrisccc () {
182 prefixtools calmrisc16-unknown-elf-
183 GCCOPTS="-Wl\,--no-check-sections $CCOPTS"
184 GCCOPTIMIZE="-fomit-frame-pointer"
185 endian="big"
188 coldfirecc () {
189 prefixtools m68k-elf-
190 GCCOPTS="$CCOPTS -m5206e -Wa\,-m5249 -malign-int -mstrict-align"
191 GCCOPTIMIZE="-fomit-frame-pointer"
192 endian="big"
195 arm7tdmicc () {
196 prefixtools arm-elf-
197 GCCOPTS="$CCOPTS -mcpu=arm7tdmi"
198 if test "X$1" != "Xshort"; then
199 GCCOPTS="$GCCOPTS -mlong-calls"
201 GCCOPTIMIZE="-fomit-frame-pointer"
202 endian="little"
205 arm9tdmicc () {
206 prefixtools arm-elf-
207 GCCOPTS="$CCOPTS -mcpu=arm9tdmi -mlong-calls"
208 GCCOPTIMIZE="-fomit-frame-pointer"
209 endian="little"
212 whichadvanced () {
213 ##################################################################
214 # Prompt for specific developer options
216 echo ""
217 echo "Enter your developer options (press enter when done)"
218 echo -n "(D)EBUG, (L)ogf, (S)imulator, (P)rofiling"
219 if [ "$memory" = "2" ]; then
220 echo -n ", (8)MB MOD"
222 if [ "$archos" = "h120" ]; then
223 echo -n ", (R)TC MOD"
225 echo ""
227 cont=1
229 while [ $cont = "1" ]; do
231 option=`input`;
233 case $option in
234 [Dd])
235 if [ "yes" = "$profile" ]; then
236 echo "Debug is incompatible with profiling"
237 else
238 echo "define DEBUG"
239 use_debug="yes"
242 [Ll])
243 echo "logf() support enabled"
244 logf="yes"
246 [Ss])
247 echo "Simulator build enabled"
248 simulator="yes"
250 [Pp])
251 if [ "yes" = "$use_debug" ]; then
252 echo "Profiling is incompatible with debug"
253 else
254 echo "Profiling support is enabled"
255 profile="yes"
259 if [ "$memory" = "2" ]; then
260 memory="8"
261 echo "Memory size selected: 8MB"
262 else
263 cont=0
266 [Rr])
267 if [ "$archos" = "h120" ]; then
268 config_rtc="#define CONFIG_RTC RTC_DS1339_DS3231"
269 have_rtc_alarm="#define HAVE_RTC_ALARM"
270 echo "RTC functions enabled (DS1339/DS3231)"
271 else
272 cont=0
276 cont=0
278 esac
279 done
280 echo "done"
282 if [ "yes" = "$use_debug" ]; then
283 debug="-DDEBUG"
284 GCCOPTS="$GCCOPTS -g -DDEBUG"
286 if [ "yes" = "$logf" ]; then
287 use_logf="#define ROCKBOX_HAS_LOGF 1"
289 if [ "yes" = "$simulator" ]; then
290 debug="-DDEBUG"
291 extradefines="$extradefines -DSIMULATOR"
293 if [ "yes" = "$profile" ]; then
294 extradefines="$extradefines -DRB_PROFILE"
295 PROFILE_OPTS="-finstrument-functions"
299 voiceconfig () {
300 echo "Building voice for $archos"
301 echo ""
303 if [ `which flite` ]; then
304 FLITE="F(l)ite "
305 FLITE_OPTS="FLITE_OPTS=\"\""
306 DEFAULT_TTS="flite"
307 DEFAULT_TTS_OPTS=$FLITE_OPTS
308 DEFAULT_NOISEFLOOR="500"
309 DEFAULT_CHOICE="L"
311 if [ `which speak` ]; then
312 ESPEAK="(e)Speak "
313 ESPEAK_OPTS="ESPEAK_OPTS=\"\""
314 DEFAULT_TTS="espeak"
315 DEFAULT_TTS_OPTS=$ESPEAK_OPTS
316 DEFAULT_NOISEFLOOR="500"
317 DEFAULT_CHOICE="e"
319 if [ `which festival` ]; then
320 FESTIVAL="(F)estival "
321 FESTIVAL_OPTS="FLITE_OPTS=\"\""
322 DEFAULT_TTS="festival"
323 DEFAULT_TTS_OPTS=$FESTIVAL_OPTS
324 DEFAULT_NOISEFLOOR="500"
325 DEFAULT_CHOICE="F"
328 if [ "$FESTIVAL" = "$FLITE" ] && [ "$FLITE" = "$ESPEAK" ]; then
329 echo "You need Festival, eSpeak or Flite in your path to build voice files"
330 exit
333 echo "TTS engine to use: ${FLITE}${FESTIVAL}${ESPEAK}(${DEFAULT_CHOICE})?"
334 option=`input`
335 case "$option" in
336 [Ll])
337 TTS_ENGINE="flite"
338 NOISEFLOOR="500" # TODO: check this value
339 TTS_OPTS=$FLITE_OPTS
341 [Ee])
342 TTS_ENGINE="espeak"
343 NOISEFLOOR="500"
344 TTS_OPTS=$ESPEAK_OPTS
346 [Ff])
347 TTS_ENGINE="festival"
348 NOISEFLOOR="500"
349 TTS_OPTS=$FESTIVAL_OPTS
352 TTS_ENGINE=$DEFAULT_TTS
353 TTS_OPTS=$DEFAULT_TTS_OPTS
354 NOISEFLOOR=$DEFAULT_NOISEFLOOR
355 esac
356 echo "Using $TTS_ENGINE for TTS"
358 echo ""
360 if [ `which oggenc` ]; then
361 OGGENC="(O)ggenc "
362 DEFAULT_ENC="oggenc"
363 VORBIS_OPTS="VORBIS_OPTS=\"-q0 --downmix\""
364 DEFAULT_ENC_OPTS=$VORBIS_OPTS
365 DEFAULT_CHOICE="O"
367 if [ `which speexenc` ]; then
368 SPEEXENC="(S)peexenc "
369 DEFAULT_ENC="speexenc"
370 SPEEX_OPTS="" # TODO: find appropriate options for speex
371 DEFAULT_ENC_OPTS=$SPEEX_OPTS
372 DEFAULT_CHOICE="S"
374 if [ `which lame` ]; then
375 LAME="(L)ame "
376 DEFAULT_ENC="lame"
377 LAME_OPTS="LAME_OPTS=\"--resample 12 -t -m m -h -V 9 -S\""
378 DEFAULT_ENC_OPTS=$LAME_OPTS
379 DEFAULT_CHOICE="L"
382 if [ "$LAME" = "" ]; then
383 echo "You need to have Lame installed to build voice files"
386 echo "Encoder to use: ${LAME}${OGGENC}${SPEEXENC}(${DEFAULT_CHOICE})?"
387 echo ""
388 echo "Note: Use Lame - the other options won't work"
389 option=`input`
390 case "$option" in
391 [Oo])
392 ENCODER="oggenc"
393 ENC_OPTS=$VORBIS_OPTS
395 [Ss])
396 ENCODER="speexenc"
397 ENC_OPTS=$SPEEX_OPTS
399 [Ll])
400 ENCODER="lame"
401 ENC_OPTS=$LAME_OPTS
404 ENCODER=$DEFAULT_ENC
405 ENC_OPTS=$DEFAULT_ENC_OPTS
406 esac
407 echo "Using $ENCODER for encoding voice clips"
409 cat > voicesettings.sh <<EOF
410 TTS_ENGINE="${TTS_ENGINE}"
411 ENCODER="${ENCODER}"
412 TEMPDIR="${pwd}"
413 NOISEFLOOR="${NOISEFLOOR}"
414 ${TTS_OPTS}
415 ${ENC_OPTS}
419 picklang() {
420 # figure out which languages that are around
421 for file in $rootdir/apps/lang/*.lang; do
422 clean=`echo $file | sed -e 's:.*/::g' | cut "-d." -f1`
423 langs="$langs $clean"
424 done
426 num=1
427 for one in $langs; do
428 echo "$num. $one"
429 num=`expr $num + 1`
430 done
432 read pick
433 return $pick;
436 whichlang() {
437 num=1
438 for one in $langs; do
439 if [ "$num" = "$pick" ]; then
440 echo $one
441 return
443 num=`expr $num + 1`
444 done
447 opt=$1
449 if test "$opt" = "--help"; then
450 echo "Rockbox configure script."
451 echo "Invoke this in a directory to generate a Makefile to build Rockbox"
452 echo "Do *NOT* run this within the tools directory!"
453 echo ""
454 echo "Usage: configure [--ccache][--no-ccache]"
455 exit
458 if test -r "configure"; then
459 # this is a check for a configure script in the current directory, it there
460 # is one, try to figure out if it is this one!
462 if { grep "^# Jukebox" configure >/dev/null 2>&1 ; } then
463 echo "WEEEEEEEEP. Don't run this configure script within the tools directory."
464 echo "It will only cause you pain and grief. Instead do this:"
465 echo ""
466 echo " cd .."
467 echo " mkdir build-dir"
468 echo " cd build-dir"
469 echo " ../tools/configure"
470 echo ""
471 echo "Much happiness will arise from this. Enjoy"
472 exit
476 # get our current directory
477 pwd=`pwd`;
479 if { echo $pwd | grep " "; } then
480 echo "You're running this script in a path that contains space. The build"
481 echo "system is unfortunately not clever enough to deal with this. Please"
482 echo "run the script from a different path, rename the path or fix the build"
483 echo "system!"
484 exit
487 if [ -z "$rootdir" ]; then
488 ##################################################################
489 # Figure out where the source code root is!
491 rootdir=`dirname $0`/../
493 #####################################################################
494 # Convert the possibly relative directory name to an absolute version
496 now=`pwd`
497 cd $rootdir
498 rootdir=`pwd`
500 # cd back to the build dir
501 cd $now
504 apps="apps"
505 appsdir='\$(ROOTDIR)/apps'
506 firmdir='\$(ROOTDIR)/firmware'
507 toolsdir='\$(ROOTDIR)/tools'
510 ##################################################################
511 # Figure out target platform
514 echo "Enter target platform:"
515 cat <<EOF
516 ==Archos== ==iriver== ==Apple iPod==
517 0) Player/Studio 10) H120/H140 20) Color/Photo
518 1) Recorder 11) H320/H340 21) Nano
519 2) FM Recorder 12) iHP-100/110/115 22) Video
520 3) Recorder v2 13) iFP-790 23) 3G
521 4) Ondio SP 14) H10 20Gb 24) 4G Grayscale
522 5) Ondio FM 15) H10 5/6Gb 25) Mini 1G
523 6) AV300 26) Mini 2G
525 ==iAudio== ==Toshiba== ==SanDisk==
526 30) X5/X5V/X5L 40) Gigabeat F 50) Sansa e200
527 31) M5/M5L 51) Sansa e200R
529 ==Tatung==
530 60) Elio TPJ-1022
533 buildfor=`input`;
535 # Set of tools built for all target platforms:
536 toolset="rdf2binary convbdf codepages"
538 # Toolsets for some target families:
539 archosbitmaptools="$toolset scramble descramble sh2d uclpack bmp2rb"
540 iriverbitmaptools="$toolset scramble descramble mkboot bmp2rb"
541 iaudiobitmaptools="$toolset scramble descramble mkboot bmp2rb"
542 ipodbitmaptools="$toolset scramble ipod_fw bmp2rb codepages"
543 gigabeatbitmaptools="$toolset scramble descramble bmp2rb"
544 # generic is used by IFP, H10, Sansa-e200
545 genericbitmaptools="$toolset bmp2rb"
548 # ---- For each target ----
550 # *Variables*
551 # target_id: a unique number identifying this target, DOES NOT necessarily
552 # have to be the menu number. Just use the currently highest
553 # number+1 when you add a new target.
554 # archos: short model name used all over to identify this target
555 # memory: number of megabytes of RAM this target has. If the amount can
556 # be selected by the size prompt, let memory be unset here
557 # target: -Ddefine passed to the build commands to make the correct
558 # config-*.h file get included etc
559 # tool: the tool that takes a plain binary and converts that into a
560 # working "firmware" file for your target
561 # output: the final output file name
562 # boottool: the tool that takes a plain binary and generates a bootloader
563 # file for your target (or blank to use $tool)
564 # bootoutput:the final output file name for the bootloader (or blank to use
565 # $output)
566 # appextra: passed to the APPEXTRA variable in the Makefiles.
567 # TODO: add proper explanation
568 # archosrom: used only for Archos targets that build a special flashable .ucl
569 # image. Set to blank for other builds.
570 # flash: the same as archosrom. These two should be merged
571 # plugins: set to 'yes' to build the plugins. Early development builds can
572 # set this to no in the early stages to have an easier life for a
573 # while
574 # codecs: lists codecs to build for this target
575 # toolset: lists what particular tools in the tools/ directory that this
576 # target needs to have built prior to building Rockbox
578 # *Functions*
579 # *cc: sets up gcc and compiler options for your target builds. Note
580 # that if you select a simulator build, the compiler selection is
581 # overridden later in the script.
583 case $buildfor in
585 0|player)
586 target_id=1
587 archos="player"
588 target="-DARCHOS_PLAYER"
589 shcc
590 tool="$rootdir/tools/scramble"
591 output="archos.mod"
592 appextra="player:gui"
593 archosrom="$pwd/rombox.ucl"
594 flash="$pwd/rockbox.ucl"
595 plugins="yes"
596 codecs=""
598 # toolset is the tools within the tools directory that we build for
599 # this particular target.
600 toolset="$toolset scramble descramble sh2d player_unifont uclpack"
602 # Note: the convbdf is present in the toolset just because: 1) the
603 # firmware/Makefile assumes it is present always, and 2) we will need it when we
604 # build the player simulator
606 t_cpu="sh"
607 t_manufacturer="archos"
608 t_model="player"
611 1|recorder)
612 target_id=2
613 archos="recorder"
614 target="-DARCHOS_RECORDER"
615 shcc
616 tool="$rootdir/tools/scramble"
617 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
618 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
619 output="ajbrec.ajz"
620 appextra="recorder:gui"
621 archosrom=""#"$pwd/rombox.ucl"
622 flash="$pwd/rockbox.ucl"
623 plugins="yes"
624 codecs=""
625 # toolset is the tools within the tools directory that we build for
626 # this particular target.
627 toolset=$archosbitmaptools
628 t_cpu="sh"
629 t_manufacturer="archos"
630 t_model="recorder"
633 2|fmrecorder)
634 target_id=3
635 archos="fmrecorder"
636 target="-DARCHOS_FMRECORDER"
637 shcc
638 tool="$rootdir/tools/scramble -fm"
639 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
640 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
641 output="ajbrec.ajz"
642 appextra="recorder:gui"
643 archosrom=""#"$pwd/rombox.ucl"
644 flash="$pwd/rockbox.ucl"
645 plugins="yes"
646 codecs=""
647 # toolset is the tools within the tools directory that we build for
648 # this particular target.
649 toolset=$archosbitmaptools
650 t_cpu="sh"
651 t_manufacturer="archos"
652 t_model="fm_v2"
655 3|recorderv2)
656 target_id=4
657 archos="recorderv2"
658 target="-DARCHOS_RECORDERV2"
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 shcc
682 tool="$rootdir/tools/scramble -osp"
683 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
684 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
685 output="ajbrec.ajz"
686 appextra="recorder:gui"
687 archosrom="$pwd/rombox.ucl"
688 flash="$pwd/rockbox.ucl"
689 plugins="yes"
690 codecs=""
691 # toolset is the tools within the tools directory that we build for
692 # this particular target.
693 toolset=$archosbitmaptools
694 t_cpu="sh"
695 t_manufacturer="archos"
696 t_model="ondio"
699 5|ondiofm)
700 target_id=8
701 archos="ondiofm"
702 target="-DARCHOS_ONDIOFM"
703 shcc
704 tool="$rootdir/tools/scramble -ofm"
705 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
706 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
707 output="ajbrec.ajz"
708 appextra="recorder:gui"
709 archosrom=""#"$pwd/rombox.ucl"
710 flash="$pwd/rockbox.ucl"
711 plugins="yes"
712 codecs=""
713 toolset=$archosbitmaptools
714 t_cpu="sh"
715 t_manufacturer="archos"
716 t_model="ondio"
719 6|av300)
720 target_id=26
721 archos="av300"
722 target="-DARCHOS_AV300"
723 memory=16 # always
724 arm7tdmicc
725 tool="$rootdir/tools/scramble -mm=C"
726 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
727 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
728 output="cjbm.ajz"
729 appextra="recorder:gui"
730 archosrom=""
731 flash=""
732 plugins="yes"
733 codecs=""
734 # toolset is the tools within the tools directory that we build for
735 # this particular target.
736 toolset="$toolset scramble descramble bmp2rb codepages"
737 # architecture, manufacturer and model for the target-tree build
738 t_cpu="arm"
739 t_manufacturer="archos"
740 t_model="av300"
743 10|h120)
744 target_id=9
745 archos="h120"
746 target="-DIRIVER_H120"
747 memory=32 # always
748 coldfirecc
749 tool="$rootdir/tools/scramble -add=h120"
750 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
751 bmp2rb_native="$rootdir/tools/bmp2rb -f 2"
752 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
753 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
754 output="rockbox.iriver"
755 appextra="recorder:gui"
756 archosrom=""
757 flash="$pwd/rombox.iriver"
758 plugins="yes"
759 codecs="libmad liba52 libffmpegFLAC libwma libTremor libwavpack libmusepack libalac libfaad libm4a libspeex libdemac"
760 # toolset is the tools within the tools directory that we build for
761 # this particular target.
762 toolset=$iriverbitmaptools
763 t_cpu="coldfire"
764 t_manufacturer="iriver"
765 t_model="h100"
768 11|h300)
769 target_id=10
770 archos="h300"
771 target="-DIRIVER_H300"
772 memory=32 # always
773 coldfirecc
774 tool="$rootdir/tools/scramble -add=h300"
775 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
776 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
777 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
778 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
779 output="rockbox.iriver"
780 appextra="recorder:gui"
781 archosrom=""
782 flash=""
783 plugins="yes"
784 codecs="libmad liba52 libffmpegFLAC libwma libTremor libwavpack libmusepack libalac libfaad libm4a libspeex libdemac"
785 # toolset is the tools within the tools directory that we build for
786 # this particular target.
787 toolset=$iriverbitmaptools
788 t_cpu="coldfire"
789 t_manufacturer="iriver"
790 t_model="h300"
793 12|h100)
794 target_id=11
795 archos="h100"
796 target="-DIRIVER_H100"
797 memory=16 # always
798 coldfirecc
799 tool="$rootdir/tools/scramble -add=h100"
800 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
801 bmp2rb_native="$rootdir/tools/bmp2rb -f 2"
802 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
803 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
804 output="rockbox.iriver"
805 appextra="recorder:gui"
806 archosrom=""
807 flash=""
808 plugins="yes"
809 codecs="libmad liba52 libffmpegFLAC libwma libTremor libwavpack libmusepack libalac libfaad libm4a libspeex libdemac"
810 # toolset is the tools within the tools directory that we build for
811 # this particular target.
812 toolset=$iriverbitmaptools
813 t_cpu="coldfire"
814 t_manufacturer="iriver"
815 t_model="h100"
818 30|x5)
819 target_id=12
820 archos="x5"
821 target="-DIAUDIO_X5"
822 memory=16 # always
823 coldfirecc
824 tool="$rootdir/tools/scramble -add=iax5"
825 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
826 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
827 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
828 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 7"
829 output="rockbox.iaudio"
830 appextra="recorder:gui"
831 archosrom=""
832 flash=""
833 plugins="yes"
834 codecs="libmad liba52 libffmpegFLAC libwma libTremor libwavpack libmusepack libalac libfaad libm4a libspeex libdemac"
835 # toolset is the tools within the tools directory that we build for
836 # this particular target.
837 toolset="$iaudiobitmaptools"
838 # architecture, manufacturer and model for the target-tree build
839 t_cpu="coldfire"
840 t_manufacturer="iaudio"
841 t_model="x5"
844 31|m5)
845 target_id=28
846 archos="m5"
847 target="-DIAUDIO_M5"
848 memory=16 # always
849 coldfirecc
850 tool="$rootdir/tools/scramble -add=iam5"
851 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
852 bmp2rb_native="$rootdir/tools/bmp2rb -f 2"
853 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
854 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 7"
855 output="rockbox.iaudio"
856 appextra="recorder:gui"
857 archosrom=""
858 flash=""
859 plugins="yes"
860 codecs="libmad liba52 libffmpegFLAC libwma libTremor libwavpack libmusepack libalac libfaad libm4a libspeex libdemac"
861 # toolset is the tools within the tools directory that we build for
862 # this particular target.
863 toolset="$iaudiobitmaptools"
864 # architecture, manufacturer and model for the target-tree build
865 t_cpu="coldfire"
866 t_manufacturer="iaudio"
867 t_model="m5"
870 20|ipodcolor)
871 target_id=13
872 archos="ipodcolor"
873 target="-DIPOD_COLOR"
874 memory=32 # always
875 arm7tdmicc
876 tool="$rootdir/tools/scramble -add=ipco"
877 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
878 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
879 output="rockbox.ipod"
880 appextra="recorder:gui"
881 archosrom=""
882 flash=""
883 plugins="yes"
884 codecs="libmad liba52 libffmpegFLAC libwma libTremor libwavpack libmusepack libalac libfaad libm4a libspeex libdemac"
885 bootoutput="bootloader-$archos.ipod"
886 # toolset is the tools within the tools directory that we build for
887 # this particular target.
888 toolset=$ipodbitmaptools
889 # architecture, manufacturer and model for the target-tree build
890 t_cpu="arm"
891 t_manufacturer="ipod"
892 t_model="color"
895 21|ipodnano)
896 target_id=14
897 archos="ipodnano"
898 target="-DIPOD_NANO"
899 memory=32 # always
900 arm7tdmicc
901 tool="$rootdir/tools/scramble -add=nano"
902 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
903 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
904 output="rockbox.ipod"
905 appextra="recorder:gui"
906 archosrom=""
907 flash=""
908 plugins="yes"
909 codecs="libmad liba52 libffmpegFLAC libwma libTremor libwavpack libmusepack libalac libfaad libm4a libspeex libdemac"
910 bootoutput="bootloader-$archos.ipod"
911 # toolset is the tools within the tools directory that we build for
912 # this particular target.
913 toolset=$ipodbitmaptools
914 # architecture, manufacturer and model for the target-tree build
915 t_cpu="arm"
916 t_manufacturer="ipod"
917 t_model="nano"
920 22|ipodvideo)
921 target_id=15
922 archos="ipodvideo"
923 target="-DIPOD_VIDEO"
924 arm7tdmicc
925 tool="$rootdir/tools/scramble -add=ipvd"
926 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
927 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
928 output="rockbox.ipod"
929 appextra="recorder:gui"
930 archosrom=""
931 flash=""
932 plugins="yes"
933 codecs="libmad liba52 libffmpegFLAC libwma libTremor libwavpack libmusepack libalac libfaad libm4a libspeex libdemac"
934 bootoutput="bootloader-$archos.ipod"
935 # toolset is the tools within the tools directory that we build for
936 # this particular target.
937 toolset=$ipodbitmaptools
938 # architecture, manufacturer and model for the target-tree build
939 t_cpu="arm"
940 t_manufacturer="ipod"
941 t_model="video"
944 23|ipod3g)
945 target_id=16
946 archos="ipod3g"
947 target="-DIPOD_3G"
948 memory=32 # always
949 arm7tdmicc
950 tool="$rootdir/tools/scramble -add=ip3g"
951 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
952 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
953 output="rockbox.ipod"
954 appextra="recorder:gui"
955 archosrom=""
956 flash=""
957 plugins="yes"
958 codecs="libmad liba52 libffmpegFLAC libwma libTremor libwavpack libmusepack libalac libfaad libm4a libspeex libdemac"
959 bootoutput="bootloader-$archos.ipod"
960 # toolset is the tools within the tools directory that we build for
961 # this particular target.
962 toolset=$ipodbitmaptools
963 # architecture, manufacturer and model for the target-tree build
964 t_cpu="arm"
965 t_manufacturer="ipod"
966 t_model="3g"
969 24|ipod4g)
970 target_id=17
971 archos="ipod4g"
972 target="-DIPOD_4G"
973 memory=32 # always
974 arm7tdmicc
975 tool="$rootdir/tools/scramble -add=ip4g"
976 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
977 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
978 output="rockbox.ipod"
979 appextra="recorder:gui"
980 archosrom=""
981 flash=""
982 plugins="yes"
983 codecs="libmad liba52 libffmpegFLAC libwma libTremor libwavpack libmusepack libalac libfaad libm4a libspeex libdemac"
984 bootoutput="bootloader-$archos.ipod"
985 # toolset is the tools within the tools directory that we build for
986 # this particular target.
987 toolset=$ipodbitmaptools
988 # architecture, manufacturer and model for the target-tree build
989 t_cpu="arm"
990 t_manufacturer="ipod"
991 t_model="4g"
994 25|ipodmini)
995 target_id=18
996 archos="ipodmini"
997 target="-DIPOD_MINI"
998 memory=32 # always
999 arm7tdmicc
1000 tool="$rootdir/tools/scramble -add=mini"
1001 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1002 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1003 output="rockbox.ipod"
1004 appextra="recorder:gui"
1005 archosrom=""
1006 flash=""
1007 plugins="yes"
1008 codecs="libmad liba52 libffmpegFLAC libwma libTremor libwavpack libmusepack libalac libfaad libm4a libspeex libdemac"
1009 bootoutput="bootloader-$archos.ipod"
1010 # toolset is the tools within the tools directory that we build for
1011 # this particular target.
1012 toolset=$ipodbitmaptools
1013 # architecture, manufacturer and model for the target-tree build
1014 t_cpu="arm"
1015 t_manufacturer="ipod"
1016 t_model="mini"
1019 13|ifp7xx)
1020 target_id=19
1021 archos="ifp7xx"
1022 target="-DIRIVER_IFP7XX"
1023 memory=1
1024 arm7tdmicc short
1025 tool="cp"
1026 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1027 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
1028 output="rockbox.wma"
1029 appextra="recorder:gui"
1030 archosrom=""
1031 flash=""
1032 plugins="yes"
1033 codecs="libmad liba52 libffmpegFLAC libwma libTremor libwavpack libmusepack libalac libfaad libm4a libspeex libdemac"
1034 # toolset is the tools within the tools directory that we build for
1035 # this particular target.
1036 toolset=$genericbitmaptools
1037 t_cpu="arm"
1038 t_manufacturer="pnx0101"
1039 t_model="iriver-ifp7xx"
1042 40|gigabeatf)
1043 target_id=20
1044 archos="gigabeatf"
1045 target="-DGIGABEAT_F"
1046 memory=32 # always
1047 arm9tdmicc
1048 tool="$rootdir/tools/scramble -add=giga"
1049 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1050 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1051 output="rockbox.gigabeat"
1052 appextra="recorder:gui"
1053 archosrom=""
1054 flash=""
1055 plugins="yes"
1056 codecs="libmad liba52 libffmpegFLAC libwma libTremor libwavpack libmusepack libalac libfaad libm4a libspeex libdemac"
1057 toolset=$gigabeatbitmaptools
1058 boottool="$rootdir/tools/scramble -gigabeat"
1059 bootoutput="FWIMG01.DAT"
1060 # architecture, manufacturer and model for the target-tree build
1061 t_cpu="arm"
1062 t_manufacturer="s3c2440"
1063 t_model="gigabeat-fx"
1066 26|ipodmini2g)
1067 target_id=21
1068 archos="ipodmini2g"
1069 target="-DIPOD_MINI2G"
1070 memory=32 # always
1071 arm7tdmicc
1072 tool="$rootdir/tools/scramble -add=mn2g"
1073 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1074 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1075 output="rockbox.ipod"
1076 appextra="recorder:gui"
1077 archosrom=""
1078 flash=""
1079 plugins="yes"
1080 codecs="libmad liba52 libffmpegFLAC libwma libTremor libwavpack libmusepack libalac libfaad libm4a libspeex libdemac"
1081 bootoutput="bootloader-$archos.ipod"
1082 # toolset is the tools within the tools directory that we build for
1083 # this particular target.
1084 toolset=$ipodbitmaptools
1085 # architecture, manufacturer and model for the target-tree build
1086 t_cpu="arm"
1087 t_manufacturer="ipod"
1088 t_model="mini2g"
1091 14|h10)
1092 target_id=22
1093 archos="h10"
1094 target="-DIRIVER_H10"
1095 memory=32 # always
1096 arm7tdmicc
1097 tool="$rootdir/tools/scramble -mi4v3 -model=h10 -type=RBOS"
1098 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1099 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1100 output="rockbox.mi4"
1101 appextra="recorder:gui"
1102 archosrom=""
1103 flash=""
1104 plugins="yes"
1105 codecs="libmad liba52 libffmpegFLAC libwma libTremor libwavpack libmusepack libalac libfaad libm4a libspeex libdemac"
1106 boottool="$rootdir/tools/scramble -mi4v3 -model=h10 -type=RBBL"
1107 bootoutput="H10_20GC.mi4"
1108 # toolset is the tools within the tools directory that we build for
1109 # this particular target.
1110 toolset="$genericbitmaptools scramble"
1111 # architecture, manufacturer and model for the target-tree build
1112 t_cpu="arm"
1113 t_manufacturer="iriver"
1114 t_model="h10"
1117 15|h10_5gb)
1118 target_id=24
1119 archos="h10_5gb"
1120 target="-DIRIVER_H10_5GB"
1121 memory=32 # always
1122 arm7tdmicc
1123 tool="$rootdir/tools/scramble -mi4v2 -model=h105 -type=RBOS"
1124 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1125 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
1126 output="rockbox.mi4"
1127 appextra="recorder:gui"
1128 archosrom=""
1129 flash=""
1130 plugins="yes"
1131 codecs="libmad liba52 libffmpegFLAC libwma libTremor libwavpack libmusepack libalac libfaad libm4a libspeex libdemac"
1132 boottool="$rootdir/tools/scramble -mi4v2 -model=h105 -type=RBBL"
1133 bootoutput="H10.mi4"
1134 # toolset is the tools within the tools directory that we build for
1135 # this particular target.
1136 toolset="$genericbitmaptools scramble"
1137 # architecture, manufacturer and model for the target-tree build
1138 t_cpu="arm"
1139 t_manufacturer="iriver"
1140 t_model="h10"
1143 50|e200)
1144 target_id=23
1145 archos="e200"
1146 target="-DSANSA_E200"
1147 memory=32 # supposedly
1148 arm7tdmicc
1149 tool="$rootdir/tools/scramble -mi4v3 -model=e200 -type=RBOS"
1150 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1151 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1152 output="rockbox.mi4"
1153 appextra="recorder:gui"
1154 archosrom=""
1155 flash=""
1156 plugins="yes"
1157 codecs="libmad liba52 libffmpegFLAC libwma libTremor libwavpack libmusepack libalac libfaad libm4a libspeex libdemac"
1158 boottool="$rootdir/tools/scramble -mi4v3 -model=e200 -type=RBBL"
1159 bootoutput="PP5022.mi4"
1160 # toolset is the tools within the tools directory that we build for
1161 # this particular target.
1162 toolset="$genericbitmaptools scramble"
1163 # architecture, manufacturer and model for the target-tree build
1164 t_cpu="arm"
1165 t_manufacturer="sandisk"
1166 t_model="sansa-e200"
1169 51|e200r)
1170 # the e200R model is pretty much identical to the e200, it only has a
1171 # different option to the scramble tool when building a bootloader and
1172 # makes the bootloader output file name in all lower case.
1173 target_id=27
1174 archos="e200r"
1175 target="-DSANSA_E200"
1176 memory=32 # supposedly
1177 arm7tdmicc
1178 tool="$rootdir/tools/scramble -mi4v3 -model=e20r -type=RBOS"
1179 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1180 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1181 output="rockbox.mi4"
1182 appextra="recorder:gui"
1183 archosrom=""
1184 flash=""
1185 plugins="yes"
1186 codecs="libmad liba52 libffmpegFLAC libwma libTremor libwavpack libmusepack libalac libfaad libm4a libspeex libdemac"
1187 boottool="$rootdir/tools/scramble -mi4r -model=e20r -type=RBBL"
1188 bootoutput="pp5022.mi4"
1189 # toolset is the tools within the tools directory that we build for
1190 # this particular target.
1191 toolset="$genericbitmaptools scramble"
1192 # architecture, manufacturer and model for the target-tree build
1193 t_cpu="arm"
1194 t_manufacturer="sandisk"
1195 t_model="sansa-e200"
1198 60|tpj1022)
1199 target_id=25
1200 archos="tpj1022"
1201 target="-DELIO_TPJ1022"
1202 memory=32 # always
1203 arm7tdmicc
1204 tool="$rootdir/tools/scramble -add tpj2"
1205 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1206 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
1207 output="rockbox.elio"
1208 appextra="recorder:gui"
1209 archosrom=""
1210 flash=""
1211 plugins="yes"
1212 codecs="libmad liba52 libffmpegFLAC libwma libTremor libwavpack libmusepack libalac libfaad libm4a libspeex libdemac"
1213 boottool="$rootdir/tools/scramble -mi4v2"
1214 bootoutput="pp5020.mi4"
1215 # toolset is the tools within the tools directory that we build for
1216 # this particular target.
1217 toolset="$genericbitmaptools scramble"
1218 # architecture, manufacturer and model for the target-tree build
1219 t_cpu="arm"
1220 t_manufacturer="tatung"
1221 t_model="tpj1022"
1225 echo "Please select a supported target platform!"
1226 exit
1229 esac
1231 echo "Platform set to $archos"
1234 #remove start
1235 ############################################################################
1236 # Amount of memory, for those that can differ. They have $memory unset at
1237 # this point.
1240 if [ -z "$memory" ]; then
1242 case $target_id in
1244 echo "Enter size of your RAM (in MB): (Defaults to 32)"
1245 size=`input`;
1246 case $size in
1247 60|64)
1248 memory="64"
1251 memory="32"
1253 esac
1257 echo "Enter size of your RAM (in MB): (defaults to 2)"
1258 size=`input`;
1259 case $size in
1261 memory="8"
1264 memory="2"
1266 esac
1268 esac
1270 echo "Memory size selected: $memory MB"
1272 #remove end
1274 ##################################################################
1275 # Figure out build "type"
1278 # the ifp7x0 is the only platform that supports building a gdb stub like
1279 # this
1280 case $archos in
1281 ifp7xx)
1282 gdbstub="(G)DB stub, "
1286 esac
1288 echo ""
1289 echo "Build (N)ormal, (A)dvanced, (S)imulator, (B)ootloader, $gdbstub(M)anual, (V)oice? (N)"
1291 option=`input`;
1293 case $option in
1294 [Bb])
1295 if test -n "$archosrom"; then
1296 # Archos SH-based players do this somewhat differently for
1297 # some reason
1298 appsdir='\$(ROOTDIR)/flash/bootbox'
1299 apps="bootbox"
1300 else
1301 appsdir='\$(ROOTDIR)/bootloader'
1302 apps="bootloader"
1303 flash=""
1304 if test -n "$boottool"; then
1305 tool="$boottool"
1307 if test -n "$bootoutput"; then
1308 output=$bootoutput
1311 extradefines="-DBOOTLOADER -ffunction-sections -fdata-sections"
1312 bootloader="1"
1313 echo "Bootloader build selected"
1315 [Ss])
1316 debug="-DDEBUG"
1317 simulator="yes"
1318 extradefines="-DSIMULATOR"
1319 echo "Simulator build selected"
1321 [Aa])
1322 echo "Advanced build selected"
1323 whichadvanced
1325 [Gg])
1326 extradefines="-DSTUB" # for target makefile symbol EXTRA_DEFINES
1327 appsdir='\$(ROOTDIR)/gdb'
1328 apps="stub"
1329 case $archos in
1330 ifp7xx)
1331 output="stub.wma"
1335 esac
1336 echo "GDB stub build selected"
1338 [Mm])
1339 appsdir='\$(ROOTDIR)/manual'
1340 firmdir='\$(ROOTDIR)/manual/platform' # No Makefile here. Effectively ignores target
1341 toolsdir=$firmdir;
1342 toolset='';
1343 apps="manual"
1344 echo "Manual build selected"
1346 [Vv])
1347 echo "Voice build selected"
1348 voiceconfig
1349 toolset="${toolset} voicefont wavtrim"
1350 voice="yes"
1353 debug=""
1354 echo "Normal build selected"
1357 esac
1358 # to be able running "make manual" from non-manual configuration
1359 case $archos in
1360 fmrecorder)
1361 manualdev="recorderv2fm"
1363 recorderv2)
1364 manualdev="recorderv2fm"
1366 h1??)
1367 manualdev="h1xx"
1369 ipodmini2g)
1370 manualdev="ipodmini"
1373 manualdev=$archos
1375 esac
1377 if [ -z "$debug" ]; then
1378 GCCOPTS="$GCCOPTS $GCCOPTIMIZE"
1381 echo "Using source code root directory: $rootdir"
1383 # this was once possible to change at build-time, but no more:
1384 language="english"
1386 # Ask about language if building voice
1387 if [ "yes" = "$voice" ]; then
1388 echo "Select a number for the language to use (default is english)"
1390 picklang
1391 language=`whichlang`
1393 if [ -z "$language" ]; then
1394 # pick a default
1395 language="english"
1397 echo "Language set to $language"
1400 uname=`uname`
1402 if [ "yes" = "$simulator" ]; then
1403 # setup compiler and things for simulator
1404 simcc
1406 if [ -d "archos" ]; then
1407 echo "sub directory archos already present"
1408 else
1409 mkdir archos
1410 echo "created an archos subdirectory for simulating the hard disk"
1414 # Now, figure out version number of the (gcc) compiler we are about to use
1415 gccver=`$CC -dumpversion`;
1417 if [ -z "$gccver" ]; then
1418 echo "WARNING: The compiler you must use ($CC) is not in your path!"
1419 echo "WARNING: this may cause your build to fail since we cannot do the"
1420 echo "WARNING: checks we want now."
1421 else
1423 # gccver should now be "3.3.5", "3.4.3", "2.95.3-6" and similar, but don't
1424 # DEPEND on it
1426 num1=`echo $gccver | cut -d . -f1`
1427 num2=`echo $gccver | cut -d . -f2`
1428 gccnum=`(expr $num1 "*" 100 + $num2) 2>/dev/null`
1430 # This makes:
1431 # 3.3.X => 303
1432 # 3.4.X => 304
1433 # 2.95.3 => 295
1435 echo "Using $CC $gccver ($gccnum)"
1437 if test "$gccnum" -ge "400"; then
1438 # gcc 4.0 is just *so* much pickier on arguments that differ in signedness
1439 # so we ignore that warnings for now
1440 # -Wno-pointer-sign
1441 GCCOPTS="$GCCOPTS -Wno-pointer-sign"
1444 if test "$gccnum" -ge "401"; then
1445 # this is a lame hack to avoid "warning: dereferencing type-punned pointer
1446 # will break strict-aliasing rules"
1448 GCCOPTS="$GCCOPTS -fno-strict-aliasing"
1453 # check the compiler for SH platforms
1454 if test "$CC" = "sh-elf-gcc"; then
1455 if test "$gccnum" -lt "400"; then
1456 echo "WARNING: Consider upgrading your compiler to the 4.0.X series!"
1457 echo "WARNING: http://www.rockbox.org/twiki/bin/view/Main/CrossCompiler"
1458 else
1459 # figure out patch status
1460 gccpatch=`$CC --version`;
1462 if { echo $gccpatch | grep "rockbox" >/dev/null 2>&1; } then
1463 echo "gcc $gccver is rockbox patched"
1464 # then convert -O to -Os to get smaller binaries!
1465 GCCOPTS=`echo $GCCOPTS | sed 's/ -O / -Os /'`
1466 else
1467 echo "WARNING: You use an unpatched gcc compiler: $gccver"
1468 echo "WARNING: http://www.rockbox.org/twiki/bin/view/Main/CrossCompiler"
1473 if test "$CC" = "m68k-elf-gcc"; then
1474 # convert -O to -Os to get smaller binaries!
1475 GCCOPTS=`echo $GCCOPTS | sed 's/ -O / -Os /'`
1478 if test "$1" = "--ccache"; then
1479 echo "Enable ccache for building"
1480 ccache="ccache"
1481 else
1482 if test "$1" != "--no-ccache"; then
1483 ccache=`findtool ccache`
1484 if test -n "$ccache"; then
1485 echo "Found and uses ccache ($ccache)"
1490 if test -n "$ccache"; then
1491 CC="$ccache $CC"
1494 if test "X$endian" = "Xbig"; then
1495 defendian="ROCKBOX_BIG_ENDIAN"
1496 else
1497 defendian="ROCKBOX_LITTLE_ENDIAN"
1500 sed > autoconf.h \
1501 -e "s,@ENDIAN@,${defendian},g" \
1502 -e "s,^#undef ROCKBOX_HAS_LOGF,$use_logf,g" \
1503 -e "s,@config_rtc@,$config_rtc,g" \
1504 -e "s,@have_rtc_alarm@,$have_rtc_alarm,g" \
1505 <<EOF
1506 /* This header was made by configure */
1507 #ifndef __BUILD_AUTOCONF_H
1508 #define __BUILD_AUTOCONF_H
1510 /* Define endianess for the target or simulator platform */
1511 #define @ENDIAN@ 1
1513 /* Define this if you build rockbox to support the logf logging and display */
1514 #undef ROCKBOX_HAS_LOGF
1516 /* optional defines for RTC mod for h1x0 */
1517 @config_rtc@
1518 @have_rtc_alarm@
1520 #endif /* __BUILD_AUTOCONF_H */
1523 if test -n "$t_cpu"; then
1524 TARGET_INC="-I\$(FIRMDIR)/target/$t_cpu/$t_manufacturer/$t_model"
1525 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/$t_cpu/$t_manufacturer"
1526 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/$t_cpu"
1527 GCCOPTS="$GCCOPTS"
1530 if test "$simulator" = "yes"; then
1531 # add simul make stuff on the #SIMUL# line
1532 simmagic1="s,@SIMUL1@,\$(SILENT)\$(MAKE) -C \$(SIMDIR) OBJDIR=\$(BUILDDIR)/sim,"
1533 simmagic2="s,@SIMUL2@,\$(SILENT)\$(MAKE) -C \$(ROOTDIR)/uisimulator/common OBJDIR=\$(BUILDDIR)/comsim,"
1534 else
1535 # delete the lines that match
1536 simmagic1='/@SIMUL1@/D'
1537 simmagic2='/@SIMUL2@/D'
1540 sed > Makefile \
1541 -e "s,@ROOTDIR@,${rootdir},g" \
1542 -e "s,@DEBUG@,${debug},g" \
1543 -e "s,@MEMORY@,${memory},g" \
1544 -e "s,@TARGET_ID@,${target_id},g" \
1545 -e "s,@TARGET@,${target},g" \
1546 -e "s,@CPU@,${t_cpu},g" \
1547 -e "s,@MANUFACTURER@,${t_manufacturer},g" \
1548 -e "s,@ARCHOS@,${archos},g" \
1549 -e "s,@LANGUAGE@,${language},g" \
1550 -e "s,@PWD@,${pwd},g" \
1551 -e "s,@CC@,${CC},g" \
1552 -e "s,@LD@,${LD},g" \
1553 -e "s,@AR@,${AR},g" \
1554 -e "s,@AS@,${AS},g" \
1555 -e "s,@OC@,${OC},g" \
1556 -e "s,@WINDRES@,${WINDRES},g" \
1557 -e "s,@DLLTOOL@,${DLLTOOL},g" \
1558 -e "s,@DLLWRAP@,${DLLWRAP},g" \
1559 -e "s,@RANLIB@,${RANLIB},g" \
1560 -e "s,@TOOL@,${tool},g" \
1561 -e "s,@BMP2RB_NATIVE@,${bmp2rb_native},g" \
1562 -e "s,@BMP2RB_MONO@,${bmp2rb_mono},g" \
1563 -e "s,@BMP2RB_REMOTENATIVE@,${bmp2rb_remotenative},g" \
1564 -e "s,@BMP2RB_REMOTEMONO@,${bmp2rb_remotemono},g" \
1565 -e "s,@OUTPUT@,${output},g" \
1566 -e "s,@APPEXTRA@,${appextra},g" \
1567 -e "s,@ARCHOSROM@,${archosrom},g" \
1568 -e "s,@FLASHFILE@,${flash},g" \
1569 -e "s,@PLUGINS@,${plugins},g" \
1570 -e "s,@CODECS@,${codecs},g" \
1571 -e "s,@PROFILE_OPTS@,${PROFILE_OPTS},g" \
1572 -e "s,@SHARED_FLAG@,${SHARED_FLAG},g" \
1573 -e "s,@GCCOPTS@,${GCCOPTS},g" \
1574 -e "s,@TARGET_INC@,${TARGET_INC},g" \
1575 -e "s!@LDOPTS@!${LDOPTS}!g" \
1576 -e "s,@LOADADDRESS@,${loadaddress},g" \
1577 -e "s,@EXTRADEF@,${extradefines},g" \
1578 -e "s,@APPSDIR@,${appsdir},g" \
1579 -e "s,@FIRMDIR@,${firmdir},g" \
1580 -e "s,@TOOLSDIR@,${toolsdir},g" \
1581 -e "s,@APPS@,${apps},g" \
1582 -e "s,@SIMVER@,${simver},g" \
1583 -e "s,@GCCVER@,${gccver},g" \
1584 -e "s,@GCCNUM@,${gccnum},g" \
1585 -e "s,@UNAME@,${uname},g" \
1586 -e "s,@ENDIAN@,${defendian},g" \
1587 -e "s,@TOOLSET@,${toolset},g" \
1588 -e "${simmagic1}" \
1589 -e "${simmagic2}" \
1590 -e "s,@MANUALDEV@,${manualdev},g" \
1591 <<EOF
1592 ## Automaticly generated. http://www.rockbox.org/
1594 ifndef V
1595 SILENT=@
1596 else
1597 VERBOSEOPT=-v
1598 endif
1600 # old 'make' versions don't have the built-in 'info' function
1601 info=old\$(shell echo >&2 "Consider upgrading to GNU make 3.81+ for optimum build performance.")
1602 ifeq (\$(call info),old)
1603 export info=echo "\$\$(1)";
1604 endif
1606 export ROOTDIR=@ROOTDIR@
1607 export FIRMDIR=@FIRMDIR@
1608 export APPSDIR=@APPSDIR@
1609 export TOOLSDIR=@TOOLSDIR@
1610 export DOCSDIR=\$(ROOTDIR)/docs
1611 export MANUALDIR=\${ROOTDIR}/manual
1612 export DEBUG=@DEBUG@
1613 export ARCHOS=@ARCHOS@
1614 export ARCHOSROM=@ARCHOSROM@
1615 export FLASHFILE=@FLASHFILE@
1616 export TARGET_ID=@TARGET_ID@
1617 export TARGET=@TARGET@
1618 export CPU=@CPU@
1619 export MANUFACTURER=@MANUFACTURER@
1620 export OBJDIR=@PWD@
1621 export BUILDDIR=@PWD@
1622 export LANGUAGE=@LANGUAGE@
1623 export MEMORYSIZE=@MEMORY@
1624 export VERSION=\$(shell \$(ROOTDIR)/tools/svnversion.sh \$(ROOTDIR))
1625 export BUILDDATE=\$(shell date -u +'-DYEAR=%Y -DMONTH=%m -DDAY=%d')
1626 export MKFIRMWARE=@TOOL@
1627 export BMP2RB_MONO=@BMP2RB_MONO@
1628 export BMP2RB_NATIVE=@BMP2RB_NATIVE@
1629 export BMP2RB_REMOTEMONO=@BMP2RB_REMOTEMONO@
1630 export BMP2RB_REMOTENATIVE=@BMP2RB_REMOTENATIVE@
1631 export BINARY=@OUTPUT@
1632 export APPEXTRA=@APPEXTRA@
1633 export ENABLEDPLUGINS=@PLUGINS@
1634 export SOFTWARECODECS=@CODECS@
1635 export EXTRA_DEFINES=@EXTRADEF@
1636 export HOSTCC=gcc
1637 export CC=@CC@
1638 export LD=@LD@
1639 export AR=@AR@
1640 export AS=@AS@
1641 export OC=@OC@
1642 export WINDRES=@WINDRES@
1643 export DLLTOOL=@DLLTOOL@
1644 export DLLWRAP=@DLLWRAP@
1645 export RANLIB=@RANLIB@
1646 export PROFILE_OPTS=@PROFILE_OPTS@
1647 export SIMVER=@SIMVER@
1648 export SIMDIR=\$(ROOTDIR)/uisimulator/sdl
1649 export GCCOPTS=@GCCOPTS@
1650 export TARGET_INC=@TARGET_INC@
1651 export LOADADDRESS=@LOADADDRESS@
1652 export SHARED_FLAG=@SHARED_FLAG@
1653 export LDOPTS=@LDOPTS@
1654 export GCCVER=@GCCVER@
1655 export GCCNUM=@GCCNUM@
1656 export UNAME=@UNAME@
1657 export MANUALDEV=@MANUALDEV@
1659 # Do not print "Entering directory ..."
1660 MAKEFLAGS += --no-print-directory
1662 .PHONY: all clean tags zip tools manual bin build info
1664 all: info
1666 info: build
1667 \$(SILENT)\$(TOOLSDIR)/mkinfo.pl \$(BUILDDIR)/rockbox-info.txt
1669 build: tools
1670 @SIMUL1@
1671 @SIMUL2@
1672 \$(SILENT)\$(MAKE) -C \$(FIRMDIR) OBJDIR=\$(BUILDDIR)/firmware
1673 \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@
1675 bin: tools
1676 @SIMUL1@
1677 @SIMUL2@
1678 \$(SILENT)\$(MAKE) -C \$(FIRMDIR) OBJDIR=\$(BUILDDIR)/firmware
1679 \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@ \$(BUILDDIR)/\$(BINARY)
1681 rocks: tools
1682 \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@ rocks
1684 veryclean: clean toolsclean
1686 toolsclean:
1687 \$(SILENT)\$(MAKE) -C \$(TOOLSDIR) clean
1689 clean:
1690 \$(SILENT)echo Cleaning build directory
1691 \$(SILENT)rm -rf rockbox.zip TAGS @APPS@ firmware comsim sim lang.[ch]\
1692 manual *.pdf *.a credits.raw @OUTPUT@ bitmaps pluginbitmaps \
1693 @ARCHOSROM@ @FLASHFILE@ UI256.bmp rockbox-full.zip \
1694 html txt rockbox-manual*.zip sysfont.h rockbox-info.txt
1696 voice: tools
1697 \$(TOOLSDIR)/genvoice.sh \$(ROOTDIR) \$(LANGUAGE) \$(ARCHOS) voicesettings.sh
1699 tools:
1700 \$(SILENT)\$(MAKE) -C \$(TOOLSDIR) CC=\$(HOSTCC) @TOOLSET@
1702 tags:
1703 \$(SILENT)rm -f TAGS
1704 \$(SILENT)\$(MAKE) -C \$(FIRMDIR) tags
1705 \$(SILENT)\$(MAKE) -C \$(APPSDIR) tags
1706 \$(SILENT)\$(MAKE) -C \$(APPSDIR)/plugins tags
1707 \$(SILENT)\$(MAKE) -C \$(APPSDIR)/plugins/lib tags
1709 fontzip:
1710 \$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -r "\$(ROOTDIR)" -f 1 -o rockbox-fonts.zip \$(TARGET) \$(BINARY)
1712 zip:
1713 \$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
1715 mapzip:
1716 \$(SILENT)find . -name "*.map" | xargs zip rockbox-maps.zip
1718 fullzip:
1719 \$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -r "\$(ROOTDIR)" -f 2 -o rockbox-full.zip \$(TARGET) \$(BINARY)
1721 7zip:
1722 \$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -o "rockbox.7z" -z "7za a" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
1724 tar:
1725 \$(SILENT)rm -f rockbox.tar
1726 \$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -o "rockbox.tar" -z "tar --no-recursion -uf" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
1728 bzip2: tar
1729 \$(SILENT)bzip2 -f9 rockbox.tar
1731 gzip: tar
1732 \$(SILENT)gzip -f9 rockbox.tar
1734 manual: manual-pdf
1735 manual-pdf:
1736 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-pdf
1737 manual-html:
1738 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-html
1739 manual-zhtml: manual-zip
1740 manual-txt:
1741 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-txt
1742 manual-ztxt:
1743 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-txt-zip
1744 manual-zip:
1745 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-zip
1747 help:
1748 @echo "A few helpful make targets"
1749 @echo ""
1750 @echo "all - builds a full Rockbox (default), including tools"
1751 @echo "bin - builds only the Rockbox.<target name> file"
1752 @echo "clean - cleans a build directory (not tools)"
1753 @echo "veryclean - cleans the build and tools directories"
1754 @echo "manual - builds a manual"
1755 @echo "manual-html - HTML manual"
1756 @echo "manual-zip - HTML manual (zipped)"
1757 @echo "manual-txt - txt manual"
1758 @echo "fullzip - creates a rockbox.zip of your build with fonts"
1759 @echo "zip - creates a rockbox.zip of your build (no fonts)"
1760 @echo "gzip - creates a rockbox.tar.gz of your build (no fonts)"
1761 @echo "bzip2 - creates a rockbox.tar.bz2 of your build (no fonts)"
1762 @echo "7zip - creates a rockbox.7z of your build (no fonts)"
1763 @echo "fontzip - creates rockbox-fonts.zip"
1764 @echo "mapzip - creates rockbox-maps.zip with all .map files"
1765 @echo "tools - builds the tools only"
1766 @echo "install - installs your build (for simulator builds only)"
1770 if [ "yes" = "$simulator" ]; then
1772 cat >> Makefile <<EOF
1774 install:
1775 @echo "installing a full setup in your archos dir"
1776 @(\$(MAKE) fullzip && cd archos && unzip -oq ../rockbox-full.zip)
1781 echo "Created Makefile"