Last POSIX fix of the day. I think I'll never make that mistake again.
[Rockbox.git] / tools / configure
blob1d8a9dc77178ac13d0c95b1574767faa57e448c0
1 #!/bin/dash
2 # __________ __ ___.
3 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 # \/ \/ \/ \/ \/
8 # $Id$
11 # global CC options for all platforms
12 CCOPTS="-W -Wall -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 -ffunction-sections -mlong-calls"
234 GCCOPTIMIZE="-fomit-frame-pointer"
235 endian="little"
238 arm9tdmicc () {
239 prefixtools arm-elf-
240 GCCOPTS="$CCOPTS -mcpu=arm9tdmi -ffunction-sections -mlong-calls"
241 GCCOPTIMIZE="-fomit-frame-pointer"
242 endian="little"
245 whichaddr () {
246 case $archos in
247 gmini120|gminisp)
248 echo ""
249 echo "Where do you want the firmware to be flashed?"
250 echo "WARNING: Do not answer this question lightly,"
251 echo "unless you don't plan to flash your gmini."
252 echo "In this case, reply '0x10000' (no quotes) and "
253 echo "re-configure when you know better."
254 loadaddress=`input`
256 if [ "0$loadaddress" = "0" ]; then
257 #default
258 loadaddress="0x10000";
260 echo "You selected $loadaddress"
264 esac
267 whichdevel () {
268 ##################################################################
269 # Prompt for specific developer options
271 echo ""
272 echo "Enter your developer options (press enter when done)"
273 echo "(D)EBUG, (L)ogf, (S)imulator, (P)rofiling"
274 cont=1
276 while [ $cont = "1" ]; do
278 option=`input`;
280 case $option in
281 [Dd])
282 if [ "yes" = "$profile" ]; then
283 echo "Debug is incompatible with profiling"
284 else
285 echo "define DEBUG"
286 use_debug="yes"
289 [Ll])
290 echo "logf() support enabled"
291 logf="yes"
293 [Ss])
294 echo "Simulator build enabled"
295 simulator="yes"
297 [Pp])
298 if [ "yes" = "$use_debug" ]; then
299 echo "Profiling is incompatible with debug"
300 else
301 echo "Profiling support is enabled"
302 profile="yes"
306 echo "done"
307 cont=0
309 esac
310 done
312 if [ "yes" = "$use_debug" ]; then
313 debug="-DDEBUG"
314 GCCOPTS="$GCCOPTS -g -DDEBUG"
316 if [ "yes" = "$logf" ]; then
317 use_logf="#define ROCKBOX_HAS_LOGF 1"
319 if [ "yes" = "$simulator" ]; then
320 debug="-DDEBUG"
321 extradefines="$extradefines -DSIMULATOR"
322 whichsim
324 if [ "yes" = "$profile" ]; then
325 extradefines="$extradefines -DRB_PROFILE"
326 PROFILE_OPTS="-finstrument-functions"
330 whichsim () {
332 if [ -z "$simver" ]; then
334 ##################################################################
335 # Figure out what simulator version
337 # x11 is deprecated so hide it from the question
338 # win32 is also deprecated
340 echo ""
341 echo "Build (S)DL version? (S)"
343 option=`input`;
345 case $option in
346 [Ww])
347 simver="win32"
349 WINDRES=windres
350 DLLTOOL=dlltool
351 DLLWRAP=dllwrap
353 # make sure the code knows this is for win32
354 extradefines="$extradefines -DWIN32"
356 [Xx])
357 simver="x11"
358 extradefines="$extradefines -DX11"
360 [Ss]|*)
361 simver="sdl"
362 extradefines="$extradefines -DSDL"
364 esac
365 echo "Selected $simver simulator"
369 voiceconfig () {
370 echo "Building voice for $archos"
371 echo ""
373 if [ `which flite` ]; then
374 FLITE="F(l)ite "
375 FLITE_OPTS="FLITE_OPTS=\"\""
376 DEFAULT_TTS="flite"
377 DEFAULT_TTS_OPTS=$FLITE_OPTS
378 DEFAULT_NOISEFLOOR="500"
379 DEFAULT_CHOICE="L"
381 if [ `which speak` ]; then
382 ESPEAK="(e)Speak "
383 ESPEAK_OPTS="ESPEAK_OPTS=\"\""
384 DEFAULT_TTS="espeak"
385 DEFAULT_TTS_OPTS=$ESPEAK_OPTS
386 DEFAULT_NOISEFLOOR="500"
387 DEFAULT_CHOICE="e"
389 if [ `which festival` ]; then
390 FESTIVAL="(F)estival "
391 FESTIVAL_OPTS="FLITE_OPTS=\"\""
392 DEFAULT_TTS="festival"
393 DEFAULT_TTS_OPTS=$FESTIVAL_OPTS
394 DEFAULT_NOISEFLOOR="500"
395 DEFAULT_CHOICE="F"
398 if [ "$FESTIVAL" = "$FLITE" ] && [ "$FLITE" = "$ESPEAK" ]; then
399 echo "You need Festival, eSpeak or Flite in your path to build voice files"
400 exit
403 echo "TTS engine to use: ${FLITE}${FESTIVAL}${ESPEAK}(${DEFAULT_CHOICE})?"
404 option=`input`
405 case "$option" in
406 [Ll])
407 TTS_ENGINE="flite"
408 NOISEFLOOR="500" # TODO: check this value
409 TTS_OPTS=$FLITE_OPTS
411 [Ee])
412 TTS_ENGINE="espeak"
413 NOISEFLOOR="500"
414 TTS_OPTS=$ESPEAK_OPTS
416 [Ff])
417 TTS_ENGINE="festival"
418 NOISEFLOOR="500"
419 TTS_OPTS=$FESTIVAL_OPTS
422 TTS_ENGINE=$DEFAULT_TTS
423 TTS_OPTS=$DEFAULT_TTS_OPTS
424 NOISEFLOOR=$DEFAULT_NOISEFLOOR
425 esac
426 echo "Using $TTS_ENGINE for TTS"
428 echo ""
430 if [ `which oggenc` ]; then
431 OGGENC="(O)ggenc "
432 DEFAULT_ENC="oggenc"
433 VORBIS_OPTS="VORBIS_OPTS=\"-q0 --downmix\""
434 DEFAULT_ENC_OPTS=$VORBIS_OPTS
435 DEFAULT_CHOICE="O"
437 if [ `which speexenc` ]; then
438 SPEEXENC="(S)peexenc "
439 DEFAULT_ENC="speexenc"
440 SPEEX_OPTS="" # TODO: find appropriate options for speex
441 DEFAULT_ENC_OPTS=$SPEEX_OPTS
442 DEFAULT_CHOICE="S"
444 if [ `which lame` ]; then
445 LAME="(L)ame "
446 DEFAULT_ENC="lame"
447 LAME_OPTS="LAME_OPTS=\"--resample 12 -t -m m -h -V 9 -S\""
448 DEFAULT_ENC_OPTS=$LAME_OPTS
449 DEFAULT_CHOICE="L"
452 if [ "$LAME" = "" ]; then
453 echo "You need to have Lame installed to build voice files"
456 echo "Encoder to use: ${LAME}${OGGENC}${SPEEXENC}(${DEFAULT_CHOICE})?"
457 echo ""
458 echo "Note: Use Lame - the other options won't work"
459 option=`input`
460 case "$option" in
461 [Oo])
462 ENCODER="oggenc"
463 ENC_OPTS=$VORBIS_OPTS
465 [Ss])
466 ENCODER="speexenc"
467 ENC_OPTS=$SPEEX_OPTS
469 [Ll])
470 ENCODER="lame"
471 ENC_OPTS=$LAME_OPTS
474 ENCODER=$DEFAULT_ENC
475 ENC_OPTS=$DEFAULT_ENC_OPTS
476 esac
477 echo "Using $ENCODER for encoding voice clips"
479 cat > voicesettings.sh <<EOF
480 TTS_ENGINE="${TTS_ENGINE}"
481 ENCODER="${ENCODER}"
482 TEMPDIR="${pwd}"
483 NOISEFLOOR="${NOISEFLOOR}"
484 ${TTS_OPTS}
485 ${ENC_OPTS}
489 picklang() {
490 # figure out which languages that are around
491 for file in $rootdir/apps/lang/*.lang; do
492 clean=`echo $file | sed -e 's:.*/::g' | cut "-d." -f1`
493 langs="$langs $clean"
494 done
496 num=1
497 for one in $langs; do
498 echo "$num. $one"
499 num=`expr $num + 1`
500 done
502 read pick
503 return $pick;
506 whichlang() {
507 num=1
508 for one in $langs; do
509 if [ "$num" = "$pick" ]; then
510 echo $one
511 return
513 num=`expr $num + 1`
514 done
517 target=$1
519 if test "$target" = "--help"; then
520 echo "Rockbox configure script."
521 echo "Invoke this in a directory to generate a Makefile to build Rockbox"
522 echo "Do *NOT* run this within the tools directory!"
523 echo ""
524 echo "Usage: configure [--ccache][--no-ccache]"
525 exit
528 if test -r "configure"; then
529 # this is a check for a configure script in the current directory, it there
530 # is one, try to figure out if it is this one!
532 if { grep "^# Jukebox" configure >/dev/null 2>&1 ; } then
533 echo "WEEEEEEEEP. Don't run this configure script within the tools directory."
534 echo "It will only cause you pain and grief. Instead do this:"
535 echo ""
536 echo " cd .."
537 echo " mkdir build-dir"
538 echo " cd build-dir"
539 echo " ../tools/configure"
540 echo ""
541 echo "Much happiness will arise from this. Enjoy"
542 exit
546 # get our current directory
547 pwd=`pwd`;
549 if [ -z "$rootdir" ]; then
550 ##################################################################
551 # Figure out where the source code root is!
554 firmfile="crt0.S" # a file to check for in the firmware root dir
556 for dir in . .. ../.. ../rockbox*; do
557 if [ -f $dir/firmware/$firmfile ]; then
558 rootdir=$dir
559 break
561 done
563 if [ -z "$rootdir" ]; then
564 echo "This script couldn't find your source code root directory. Please enter the"
565 echo "full path to the source code directory here:"
567 firmdir=`input`
570 #####################################################################
571 # Convert the possibly relative directory name to an absolute version
573 now=`pwd`
574 cd $rootdir
575 rootdir=`pwd`
577 # cd back to the build dir
578 cd $now
581 apps="apps"
582 appsdir='\$(ROOTDIR)/apps'
583 firmdir='\$(ROOTDIR)/firmware'
584 toolsdir='\$(ROOTDIR)/tools'
587 ##################################################################
588 # Figure out target platform
591 echo "Enter target platform:"
592 cat <<EOF
593 ==Archos== ==iriver== ==Apple iPod==
594 0) Player/Studio 10) H120/H140 20) Color/Photo
595 1) Recorder 11) H320/H340 21) Nano
596 2) FM Recorder 12) iHP-100/110/115 22) Video
597 3) Recorder v2 13) iFP-790 23) 3G
598 4) Gmini 120 14) H10 20Gb 24) 4G Grayscale
599 5) Gmini SP 15) H10 5/6Gb 25) Mini 1G
600 6) Ondio SP 26) Mini 2G
601 7) Ondio FM
603 ==iAudio== ==Toshiba== ==SanDisk==
604 30) X5/X5V/X5L 40) Gigabeat F 50) Sansa e200
606 ==Tatung==
607 60) Elio TPJ-1022
610 buildfor=`input`;
612 # Set of tools built for all target platforms:
613 toolset="rdf2binary convbdf"
615 # Toolsets for some target families:
616 archosbitmaptools="$toolset scramble descramble sh2d uclpack bmp2rb codepages"
617 iriverbitmaptools="$toolset scramble descramble mkboot bmp2rb codepages"
618 iaudiobitmaptools="$toolset scramble descramble mkboot bmp2rb codepages"
619 ipodbitmaptools="$toolset scramble ipod_fw bmp2rb codepages"
620 gigabeatbitmaptools="$toolset scramble descramble bmp2rb codepages"
621 # generic is used by IFP, H10, Sansa-e200
622 genericbitmaptools="$toolset bmp2rb codepages"
625 # ---- For each target ----
627 # *Variables*
628 # target_id: a unique number identifying this target, DOES NOT necessarily
629 # have to be the menu number. Just use the currently highest
630 # number+1 when you add a new target.
631 # archos: short model name used all over to identify this target
632 # target: -Ddefine passed to the build commands to make the correct
633 # config-*.h file get included etc
634 # tool: the tool that takes a plain binary and converts that into a
635 # working "firmware" file for your target
636 # output: the final output file name
637 # boottool: the tool that takes a plain binary and generates a bootloader
638 # file for your target (or blank to use $tool)
639 # bootoutput:the final output file name for the bootloader (or blank to use
640 # $output)
641 # appextra: passed to the APPEXTRA variable in the Makefiles.
642 # TODO: add proper explanation
643 # archosrom: used only for Archos targets that build a special flashable .ucl
644 # image. Set to blank for other builds.
645 # flash: the same as archosrom. These two should be merged
646 # plugins: set to 'yes' to build the plugins. Early development builds can
647 # set this to no in the early stages to have an easier life for a
648 # while
649 # codecs: lists codecs to build for this target
650 # toolset: lists what particular tools in the tools/ directory that this
651 # target needs to have built prior to building Rockbox
653 # *Functions*
654 # *cc: sets up gcc and compiler options for your target builds. Note
655 # that if you select a simulator build, the compiler selection is
656 # overridden later in the script.
658 case $buildfor in
660 0|player)
661 target_id=1
662 archos="player"
663 target="-DARCHOS_PLAYER"
664 shcc
665 tool="$rootdir/tools/scramble"
666 output="archos.mod"
667 appextra="player:gui"
668 archosrom="$pwd/rombox.ucl"
669 flash="$pwd/rockbox.ucl"
670 plugins="yes"
671 codecs=""
673 # toolset is the tools within the tools directory that we build for
674 # this particular target.
675 toolset="$toolset scramble descramble sh2d generate_rocklatin uclpack"
677 # Note: the convbdf is present in the toolset just because: 1) the
678 # firmware/Makefile assumes it is present always, and 2) we will need it when we
679 # build the player simulator
683 1|recorder)
684 target_id=2
685 archos="recorder"
686 target="-DARCHOS_RECORDER"
687 shcc
688 tool="$rootdir/tools/scramble"
689 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
690 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
691 output="ajbrec.ajz"
692 appextra="recorder:gui"
693 archosrom="$pwd/rombox.ucl"
694 flash="$pwd/rockbox.ucl"
695 plugins="yes"
696 codecs=""
697 # toolset is the tools within the tools directory that we build for
698 # this particular target.
699 toolset=$archosbitmaptools
702 2|fmrecorder)
703 target_id=3
704 archos="fmrecorder"
705 target="-DARCHOS_FMRECORDER"
706 shcc
707 tool="$rootdir/tools/scramble -fm"
708 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
709 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
710 output="ajbrec.ajz"
711 appextra="recorder:gui"
712 archosrom="$pwd/rombox.ucl"
713 flash="$pwd/rockbox.ucl"
714 plugins="yes"
715 codecs=""
716 # toolset is the tools within the tools directory that we build for
717 # this particular target.
718 toolset=$archosbitmaptools
721 3|recorderv2)
722 target_id=4
723 archos="recorderv2"
724 target="-DARCHOS_RECORDERV2"
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
740 4|gmini120)
741 target_id=5
742 archos="gmini120"
743 target="-DARCHOS_GMINI120"
744 memory=16 # fixed size (16 is a guess, remove comment when checked)
745 calmrisccc
746 tool="cp" # might work for now!
747 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
748 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
749 output="rockbox.gmini"
750 appextra="recorder:gui"
751 archosrom=""
752 flash=""
753 plugins="" # disabled for now, enable later on
754 codecs="libmad"
755 # toolset is the tools within the tools directory that we build for
756 # this particular target.
757 toolset="$toolset bmp2rb codepages"
760 5|gminisp)
761 target_id=6
762 archos="gminisp"
763 target="-DARCHOS_GMINISP"
764 memory=16 # fixed size (16 is a guess, remove comment when checked)
765 calmrisccc
766 tool="cp" # might work for now!
767 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
768 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
769 output="rockbox.gmini"
770 appextra="recorder:gui"
771 archosrom=""
772 flash=""
773 plugins="" # disabled for now, enable later on
774 codecs="libmad"
775 # toolset is the tools within the tools directory that we build for
776 # this particular target.
777 toolset="$toolset bmp2rb codepages"
780 6|ondiosp)
781 target_id=7
782 archos="ondiosp"
783 target="-DARCHOS_ONDIOSP"
784 shcc
785 tool="$rootdir/tools/scramble -osp"
786 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
787 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
788 output="ajbrec.ajz"
789 appextra="recorder:gui"
790 archosrom="$pwd/rombox.ucl"
791 flash="$pwd/rockbox.ucl"
792 plugins="yes"
793 codecs=""
794 # toolset is the tools within the tools directory that we build for
795 # this particular target.
796 toolset=$archosbitmaptools
799 7|ondiofm)
800 target_id=8
801 archos="ondiofm"
802 target="-DARCHOS_ONDIOFM"
803 shcc
804 tool="$rootdir/tools/scramble -ofm"
805 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
806 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
807 output="ajbrec.ajz"
808 appextra="recorder:gui"
809 archosrom="$pwd/rombox.ucl"
810 flash="$pwd/rockbox.ucl"
811 plugins="yes"
812 codecs=""
813 toolset=$archosbitmaptools
816 10|h120)
817 target_id=9
818 archos="h120"
819 target="-DIRIVER_H120"
820 memory=32 # always
821 coldfirecc
822 tool="$rootdir/tools/scramble -add=h120"
823 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
824 bmp2rb_native="$rootdir/tools/bmp2rb -f 2"
825 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
826 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
827 output="rockbox.iriver"
828 appextra="recorder:gui"
829 archosrom=""
830 flash=""
831 plugins="yes"
832 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack dumb libmusepack libalac libfaad libm4a"
833 # toolset is the tools within the tools directory that we build for
834 # this particular target.
835 toolset=$iriverbitmaptools
836 t_cpu="coldfire"
837 t_manufacturer="iriver"
838 t_model="h100"
841 11|h300)
842 target_id=10
843 archos="h300"
844 target="-DIRIVER_H300"
845 memory=32 # always
846 coldfirecc
847 tool="$rootdir/tools/scramble -add=h300"
848 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
849 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
850 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
851 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
852 output="rockbox.iriver"
853 appextra="recorder:gui"
854 archosrom=""
855 flash=""
856 plugins="yes"
857 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack dumb libmusepack libalac libfaad libm4a"
858 # toolset is the tools within the tools directory that we build for
859 # this particular target.
860 toolset=$iriverbitmaptools
861 t_cpu="coldfire"
862 t_manufacturer="iriver"
863 t_model="h300"
866 12|h100)
867 target_id=11
868 archos="h100"
869 target="-DIRIVER_H100"
870 memory=16 # always
871 coldfirecc
872 tool="$rootdir/tools/scramble -add=h100"
873 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
874 bmp2rb_native="$rootdir/tools/bmp2rb -f 2"
875 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
876 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
877 output="rockbox.iriver"
878 appextra="recorder:gui"
879 archosrom=""
880 flash=""
881 plugins="yes"
882 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack dumb libmusepack libalac libfaad libm4a"
883 # toolset is the tools within the tools directory that we build for
884 # this particular target.
885 toolset=$iriverbitmaptools
886 t_cpu="coldfire"
887 t_manufacturer="iriver"
888 t_model="h100"
891 30|x5)
892 target_id=12
893 archos="x5"
894 target="-DIAUDIO_X5"
895 memory=16 # always
896 coldfirecc
897 tool="$rootdir/tools/scramble -add=iax5"
898 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
899 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
900 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
901 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 7"
902 output="rockbox.iaudio"
903 appextra="recorder:gui"
904 archosrom=""
905 flash=""
906 plugins="yes"
907 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack dumb libmusepack libalac libfaad libm4a"
908 # toolset is the tools within the tools directory that we build for
909 # this particular target.
910 toolset="$iaudiobitmaptools"
911 # architecture, manufacturer and model for the target-tree build
912 t_cpu="coldfire"
913 t_manufacturer="iaudio"
914 t_model="x5"
917 20|ipodcolor)
918 target_id=13
919 archos="ipodcolor"
920 target="-DIPOD_COLOR"
921 memory=32 # always
922 arm7tdmicc
923 tool="$rootdir/tools/scramble -add=ipco"
924 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
925 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
926 output="rockbox.ipod"
927 appextra="recorder:gui"
928 archosrom=""
929 flash=""
930 plugins="yes"
931 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack dumb libmusepack libalac libfaad libm4a"
932 boottool="$rootdir/tools/scramble -ipod4g"
933 bootoutput="bootloader.img"
934 # toolset is the tools within the tools directory that we build for
935 # this particular target.
936 toolset=$ipodbitmaptools
937 # architecture, manufacturer and model for the target-tree build
938 t_cpu="arm"
939 t_manufacturer="ipod"
940 t_model="color"
943 21|ipodnano)
944 target_id=14
945 archos="ipodnano"
946 target="-DIPOD_NANO"
947 memory=32 # always
948 arm7tdmicc
949 tool="$rootdir/tools/scramble -add=nano"
950 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
951 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
952 output="rockbox.ipod"
953 appextra="recorder:gui"
954 archosrom=""
955 flash=""
956 plugins="yes"
957 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack dumb libmusepack libalac libfaad libm4a"
958 boottool="$rootdir/tools/scramble -ipod4g"
959 bootoutput="bootloader.img"
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="nano"
969 22|ipodvideo)
970 target_id=15
971 archos="ipodvideo"
972 target="-DIPOD_VIDEO"
973 memory=32 # 30GB models have 32MB, 60GB have 64MB
974 arm7tdmicc
975 tool="$rootdir/tools/scramble -add=ipvd"
976 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
977 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
978 output="rockbox.ipod"
979 appextra="recorder:gui"
980 archosrom=""
981 flash=""
982 plugins="yes"
983 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack dumb libmusepack libalac libfaad libm4a"
984 boottool="$rootdir/tools/scramble -ipod5g"
985 bootoutput="bootloader.img"
986 # toolset is the tools within the tools directory that we build for
987 # this particular target.
988 toolset=$ipodbitmaptools
989 # architecture, manufacturer and model for the target-tree build
990 t_cpu="arm"
991 t_manufacturer="ipod"
992 t_model="video"
995 23|ipod3g)
996 target_id=16
997 archos="ipod3g"
998 target="-DIPOD_3G"
999 memory=32 # always
1000 arm7tdmicc
1001 tool="$rootdir/tools/scramble -add=ip3g"
1002 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1003 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1004 output="rockbox.ipod"
1005 appextra="recorder:gui"
1006 archosrom=""
1007 flash=""
1008 plugins="yes"
1009 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack dumb libmusepack libalac libfaad libm4a"
1010 boottool="$rootdir/tools/scramble -ipod3g"
1011 bootoutput="bootloader.img"
1012 # toolset is the tools within the tools directory that we build for
1013 # this particular target.
1014 toolset=$ipodbitmaptools
1015 # architecture, manufacturer and model for the target-tree build
1016 t_cpu="arm"
1017 t_manufacturer="ipod"
1018 t_model="3g"
1021 24|ipod4g)
1022 target_id=17
1023 archos="ipod4g"
1024 target="-DIPOD_4G"
1025 memory=32 # always
1026 arm7tdmicc
1027 tool="$rootdir/tools/scramble -add=ip4g"
1028 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1029 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1030 output="rockbox.ipod"
1031 appextra="recorder:gui"
1032 archosrom=""
1033 flash=""
1034 plugins="yes"
1035 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack dumb libmusepack libalac libfaad libm4a"
1036 boottool="$rootdir/tools/scramble -ipod4g"
1037 bootoutput="bootloader.img"
1038 # toolset is the tools within the tools directory that we build for
1039 # this particular target.
1040 toolset=$ipodbitmaptools
1041 # architecture, manufacturer and model for the target-tree build
1042 t_cpu="arm"
1043 t_manufacturer="ipod"
1044 t_model="4g"
1047 25|ipodmini)
1048 target_id=18
1049 archos="ipodmini"
1050 target="-DIPOD_MINI"
1051 memory=32 # always
1052 arm7tdmicc
1053 tool="$rootdir/tools/scramble -add=mini"
1054 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1055 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1056 output="rockbox.ipod"
1057 appextra="recorder:gui"
1058 archosrom=""
1059 flash=""
1060 plugins="yes"
1061 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack dumb libmusepack libalac libfaad libm4a"
1062 boottool="$rootdir/tools/scramble -ipod4g"
1063 bootoutput="bootloader.img"
1064 # toolset is the tools within the tools directory that we build for
1065 # this particular target.
1066 toolset=$ipodbitmaptools
1067 # architecture, manufacturer and model for the target-tree build
1068 t_cpu="arm"
1069 t_manufacturer="ipod"
1070 t_model="mini"
1073 13|ifp7xx)
1074 target_id=19
1075 archos="ifp7xx"
1076 target="-DIRIVER_IFP7XX"
1077 memory=1
1078 arm7tdmicc short
1079 tool="cp"
1080 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1081 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
1082 output="rockbox.wma"
1083 appextra="recorder:gui"
1084 archosrom=""
1085 flash=""
1086 plugins="yes"
1087 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack dumb libmusepack libalac libfaad libm4a"
1088 # toolset is the tools within the tools directory that we build for
1089 # this particular target.
1090 toolset=$genericbitmaptools
1093 40|gigabeatf)
1094 target_id=20
1095 archos="gigabeatf"
1096 target="-DGIGABEAT_F"
1097 memory=32 # always
1098 arm9tdmicc
1099 tool="cp"
1100 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1101 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1102 output="rockbox.gigabeat"
1103 appextra="recorder:gui"
1104 archosrom=""
1105 flash=""
1106 plugins="yes"
1107 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack dumb libmusepack libalac libfaad libm4a"
1108 toolset=$gigabeatbitmaptools
1109 boottool="$rootdir/tools/scramble -gigabeat"
1110 bootoutput="FWIMG01.DAT"
1111 # architecture, manufacturer and model for the target-tree build
1112 t_cpu="arm"
1113 t_manufacturer="gigabeat"
1114 t_model="meg-fx"
1117 26|ipodmini2g)
1118 target_id=21
1119 archos="ipodmini2g"
1120 target="-DIPOD_MINI2G"
1121 memory=32 # always
1122 arm7tdmicc
1123 tool="$rootdir/tools/scramble -add=mn2g"
1124 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1125 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1126 output="rockbox.ipod"
1127 appextra="recorder:gui"
1128 archosrom=""
1129 flash=""
1130 plugins="yes"
1131 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack dumb libmusepack libalac libfaad libm4a"
1132 boottool="$rootdir/tools/scramble -ipod4g"
1133 bootoutput="bootloader.img"
1134 # toolset is the tools within the tools directory that we build for
1135 # this particular target.
1136 toolset=$ipodbitmaptools
1137 # architecture, manufacturer and model for the target-tree build
1138 t_cpu="arm"
1139 t_manufacturer="ipod"
1140 t_model="mini2g"
1143 14|h10)
1144 target_id=22
1145 archos="h10"
1146 target="-DIRIVER_H10"
1147 memory=32 # always
1148 arm7tdmicc
1149 tool="$rootdir/tools/scramble -add=h10"
1150 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1151 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1152 output="rockbox.h10"
1153 appextra="recorder:gui"
1154 archosrom=""
1155 flash=""
1156 plugins="yes"
1157 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack dumb libmusepack libalac libfaad libm4a"
1158 boottool="$rootdir/tools/scramble -mi4v3"
1159 bootoutput="H10_20GC.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="iriver"
1166 t_model="h10"
1169 50|e200)
1170 target_id=23
1171 archos="e200"
1172 target="-DSANSA_E200"
1173 memory=32 # supposedly
1174 arm7tdmicc
1175 tool="$rootdir/tools/mkmi4.sh e200"
1176 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1177 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
1178 output="PP5022.mi4"
1179 appextra="recorder:gui"
1180 archosrom=""
1181 flash=""
1182 plugins="yes"
1183 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack dumb libmusepack libalac libfaad libm4a"
1184 boottool="$rootdir/tools/scramble -mi4v3"
1185 bootoutput="PP5022.mi4"
1186 # toolset is the tools within the tools directory that we build for
1187 # this particular target.
1188 toolset="$genericbitmaptools scramble"
1189 # architecture, manufacturer and model for the target-tree build
1190 t_cpu="arm"
1191 t_manufacturer="sandisk"
1192 t_model="sansa-e200"
1195 15|h10_5gb)
1196 target_id=24
1197 archos="h10_5gb"
1198 target="-DIRIVER_H10_5GB"
1199 memory=32 # always
1200 arm7tdmicc
1201 tool="$rootdir/tools/scramble -add=h10_5gb"
1202 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1203 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
1204 output="rockbox.h10"
1205 appextra="recorder:gui"
1206 archosrom=""
1207 flash=""
1208 plugins="yes"
1209 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack dumb libmusepack libalac libfaad libm4a"
1210 boottool="$rootdir/tools/scramble -mi4v2"
1211 bootoutput="H10.mi4"
1212 # toolset is the tools within the tools directory that we build for
1213 # this particular target.
1214 toolset="$genericbitmaptools scramble"
1215 # architecture, manufacturer and model for the target-tree build
1216 t_cpu="arm"
1217 t_manufacturer="iriver"
1218 t_model="h10"
1221 60|tpj1022)
1222 target_id=25
1223 archos="tpj1022"
1224 target="-DELIO_TPJ1022"
1225 memory=32 # always
1226 arm7tdmicc
1227 tool="$rootdir/tools/scramble -add tpj2"
1228 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1229 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
1230 output="rockbox.elio"
1231 appextra="recorder:gui"
1232 archosrom=""
1233 flash=""
1234 plugins="yes"
1235 codecs="libmad liba52 libffmpegFLAC libTremor libwavpack dumb libmusepack libalac libfaad libm4a"
1236 boottool="$rootdir/tools/scramble -mi4v2"
1237 bootoutput="pp5020.mi4"
1238 # toolset is the tools within the tools directory that we build for
1239 # this particular target.
1240 toolset="$genericbitmaptools scramble"
1241 # architecture, manufacturer and model for the target-tree build
1242 t_cpu="arm"
1243 t_manufacturer="tatung"
1244 t_model="tpj1022"
1248 echo "Please select a supported target platform!"
1249 exit
1252 esac
1254 echo "Platform set to $archos"
1257 ############################################################################
1258 # Amount of memory, for those that can differ.
1261 if [ -z "$memory" ]; then
1262 size="2"
1263 if [ -z "$update" ]; then
1264 echo "Enter size of your RAM (in MB): (defaults to 2)"
1265 size=`input`;
1268 case $size in
1270 memory="8"
1273 memory="2"
1276 esac
1277 echo "Memory size selected: $memory MB"
1280 ##################################################################
1281 # Figure out build "type"
1284 # the ifp7x0 is the only platform that supports building a gdb stub like
1285 # this
1286 case $archos in
1287 ifp7xx)
1288 gdbstub="(G)DB stub, "
1292 esac
1294 echo ""
1295 echo "Build (N)ormal, (D)evel, (S)imulator, (B)ootloader, $gdbstub(M)anual, (V)oice? (N)"
1297 option=`input`;
1299 case $option in
1300 [Bb])
1301 if test -n "$archosrom"; then
1302 # Archos SH-based players do this somewhat differently for
1303 # some reason
1304 extradefines="-DBOOTLOADER -ffunction-sections -fdata-sections"
1305 appsdir='\$(ROOTDIR)/flash/bootbox'
1306 apps="bootbox"
1307 else
1308 extradefines="-DBOOTLOADER" # for target makefile symbol EXTRA_DEFINES
1309 appsdir='\$(ROOTDIR)/bootloader'
1310 apps="bootloader"
1311 if test -n "$boottool"; then
1312 tool="$boottool"
1314 if test -n "$bootoutput"; then
1315 output=$bootoutput
1318 bootloader="1"
1319 echo "Bootloader build selected"
1321 [Ss])
1322 debug="-DDEBUG"
1323 simulator="yes"
1324 extradefines="-DSIMULATOR"
1325 echo "Simulator build selected"
1326 whichsim
1328 [Dd])
1329 echo "Devel build selected"
1330 whichdevel
1332 [Gg])
1333 extradefines="-DSTUB" # for target makefile symbol EXTRA_DEFINES
1334 appsdir='\$(ROOTDIR)/gdb'
1335 apps="stub"
1336 case $archos in
1337 ifp7xx)
1338 output="stub.wma"
1342 esac
1343 echo "GDB stub build selected"
1345 [Mm])
1346 appsdir='\$(ROOTDIR)/manual'
1347 firmdir='\$(ROOTDIR)/manual/platform' # No Makefile here. Effectively ignores target
1348 toolsdir=$firmdir;
1349 toolset='';
1350 apps="manual"
1351 echo "Manual build selected"
1353 [Vv])
1354 echo "Voice build selected"
1355 voiceconfig
1356 voice="yes"
1359 debug=""
1360 echo "Normal build selected"
1363 esac
1364 # to be able running "make manual" from non-manual configuration
1365 case $archos in
1366 fmrecorder)
1367 manualdev="recorderv2fm"
1369 recorderv2)
1370 manualdev="recorderv2fm"
1372 h1??)
1373 manualdev="h1xx"
1375 ipodmini2g)
1376 manualdev="ipodmini"
1379 manualdev=$archos
1381 esac
1383 if [ -z "$debug" ]; then
1384 GCCOPTS="$GCCOPTS $GCCOPTIMIZE"
1387 whichaddr
1389 echo "Using source code root directory: $rootdir"
1391 # this was once possible to change at build-time, but no more:
1392 language="english"
1394 # Ask about language if building voice
1395 if [ "yes" = "$voice" ]; then
1396 echo "Select a number for the language to use (default is english)"
1398 picklang
1399 language=`whichlang`
1401 if [ -z "$language" ]; then
1402 # pick a default
1403 language="english"
1405 echo "Language set to $language"
1408 uname=`uname`
1410 if [ "yes" = "$simulator" ]; then
1411 # setup compiler and things for simulator
1412 simcc
1414 if [ -d "archos" ]; then
1415 echo "sub directory archos already present"
1416 else
1417 mkdir archos
1418 echo "created an archos subdirectory for simulating the hard disk"
1422 # Now, figure out version number of the (gcc) compiler we are about to use
1423 gccver=`$CC -dumpversion`;
1425 if [ -z "$gccver" ]; then
1426 echo "WARNING: The compiler you must use ($CC) is not in your path!"
1427 echo "WARNING: this may cause your build to fail since we cannot do the"
1428 echo "WARNING: checks we want now."
1429 else
1431 # gccver should now be "3.3.5", "3.4.3", "2.95.3-6" and similar, but don't
1432 # DEPEND on it
1434 num1=`echo $gccver | cut -d . -f1`
1435 num2=`echo $gccver | cut -d . -f2`
1436 gccnum=`(expr $num1 "*" 100 + $num2) 2>/dev/null`
1438 # This makes:
1439 # 3.3.X => 303
1440 # 3.4.X => 304
1441 # 2.95.3 => 295
1443 echo "Using $CC $gccver ($gccnum)"
1445 if test "$gccnum" -ge "400"; then
1446 # gcc 4.0 is just *so* much pickier on arguments that differ in signedness
1447 # so we ignore that warnings for now
1448 # -Wno-pointer-sign
1449 GCCOPTS="$GCCOPTS -Wno-pointer-sign"
1452 if test "$gccnum" -ge "401"; then
1453 # this is a lame hack to avoid "warning: dereferencing type-punned pointer
1454 # will break strict-aliasing rules"
1456 GCCOPTS="$GCCOPTS -fno-strict-aliasing"
1461 # check the compiler for SH platforms
1462 if test "$CC" = "sh-elf-gcc"; then
1463 if test "$gccnum" -lt "400"; then
1464 echo "WARNING: Consider upgrading your compiler to the 4.0.X series!"
1465 echo "WARNING: http://www.rockbox.org/twiki/bin/view/Main/CrossCompiler"
1466 else
1467 # figure out patch status
1468 gccpatch=`$CC --version`;
1470 if { echo $gccpatch | grep "rockbox" >/dev/null 2>&1; } then
1471 echo "gcc $gccver is rockbox patched"
1472 # then convert -O to -Os to get smaller binaries!
1473 GCCOPTS=`echo $GCCOPTS | sed 's/ -O / -Os /'`
1474 else
1475 echo "WARNING: You use an unpatched gcc compiler: $gccver"
1476 echo "WARNING: http://www.rockbox.org/twiki/bin/view/Main/CrossCompiler"
1481 if test "$1" = "--ccache"; then
1482 echo "Enable ccache for building"
1483 ccache="ccache"
1484 else
1485 if test "$1" != "--no-ccache"; then
1486 ccache=`findtool ccache`
1487 if test -n "$ccache"; then
1488 echo "Found and uses ccache ($ccache)"
1493 if test -n "$ccache"; then
1494 CC="$ccache $CC"
1497 if test "X$endian" = "Xbig"; then
1498 defendian="ROCKBOX_BIG_ENDIAN"
1499 else
1500 defendian="ROCKBOX_LITTLE_ENDIAN"
1503 sed > autoconf.h \
1504 -e "s,@ENDIAN@,${defendian},g" \
1505 -e "s,^#undef ROCKBOX_HAS_LOGF,$use_logf,g" \
1506 -e "s,@SIMSOUND@,$use_simsound,g" \
1507 <<EOF
1508 /* This header was made by configure */
1509 #ifndef __BUILD_AUTOCONF_H
1510 #define __BUILD_AUTOCONF_H
1512 /* Define endianess for the target or simulator platform */
1513 #define @ENDIAN@ 1
1515 /* Define this if you build rockbox to support the logf logging and display */
1516 #undef ROCKBOX_HAS_LOGF
1518 /* Define this if you have the linux/soundcard.h header and thus can compile
1519 the sound-playing code in the X11 sim */
1520 @SIMSOUND@
1522 #endif /* __BUILD_AUTOCONF_H */
1525 if test -n "$t_cpu"; then
1526 TARGET_INC="-I\$(FIRMDIR)/target/$t_cpu/$t_manufacturer/$t_model"
1527 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/$t_cpu/$t_manufacturer"
1528 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/$t_cpu"
1529 GCCOPTS="$GCCOPTS"
1532 if test "$simulator" = "yes"; then
1533 # add simul make stuff on the #SIMUL# line
1534 simmagic1="s,@SIMUL1@,\$(SILENT)\$(MAKE) -C \$(SIMDIR) OBJDIR=\$(BUILDDIR)/sim,"
1535 simmagic2="s,@SIMUL2@,\$(SILENT)\$(MAKE) -C \$(ROOTDIR)/uisimulator/common OBJDIR=\$(BUILDDIR)/comsim,"
1536 else
1537 # delete the lines that match
1538 simmagic1='/@SIMUL1@/D'
1539 simmagic2='/@SIMUL2@/D'
1542 sed > Makefile \
1543 -e "s,@ROOTDIR@,${rootdir},g" \
1544 -e "s,@DEBUG@,${debug},g" \
1545 -e "s,@MEMORY@,${memory},g" \
1546 -e "s,@TARGET_ID@,${target_id},g" \
1547 -e "s,@TARGET@,${target},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 OBJDIR=@PWD@
1619 export BUILDDIR=@PWD@
1620 export LANGUAGE=@LANGUAGE@
1621 export MEMORYSIZE=@MEMORY@
1622 export VERSION=\$(shell date +%y%m%d-%H%M)
1623 export BUILDDATE=\$(shell date +'-DYEAR=%Y -DMONTH=%m -DDAY=%d')
1624 export MKFIRMWARE=@TOOL@
1625 export BMP2RB_MONO=@BMP2RB_MONO@
1626 export BMP2RB_NATIVE=@BMP2RB_NATIVE@
1627 export BMP2RB_REMOTEMONO=@BMP2RB_REMOTEMONO@
1628 export BMP2RB_REMOTENATIVE=@BMP2RB_REMOTENATIVE@
1629 export BINARY=@OUTPUT@
1630 export APPEXTRA=@APPEXTRA@
1631 export ENABLEDPLUGINS=@PLUGINS@
1632 export SOFTWARECODECS=@CODECS@
1633 export EXTRA_DEFINES=@EXTRADEF@
1634 export HOSTCC=gcc
1635 export CC=@CC@
1636 export LD=@LD@
1637 export AR=@AR@
1638 export AS=@AS@
1639 export OC=@OC@
1640 export WINDRES=@WINDRES@
1641 export DLLTOOL=@DLLTOOL@
1642 export DLLWRAP=@DLLWRAP@
1643 export RANLIB=@RANLIB@
1644 export PROFILE_OPTS=@PROFILE_OPTS@
1645 export GCCOPTS=@GCCOPTS@
1646 export TARGET_INC=@TARGET_INC@
1647 export LOADADDRESS=@LOADADDRESS@
1648 export SIMVER=@SIMVER@
1649 export SIMDIR=\$(ROOTDIR)/uisimulator/\$(SIMVER)
1650 export SHARED_FLAG=@SHARED_FLAG@
1651 export LDOPTS=@LDOPTS@
1652 export GCCVER=@GCCVER@
1653 export GCCNUM=@GCCNUM@
1654 export UNAME=@UNAME@
1655 export MANUALDEV=@MANUALDEV@
1657 # Do not print "Entering directory ..."
1658 MAKEFLAGS += --no-print-directory
1660 .PHONY: all clean tags zip tools manual
1662 all: tools
1663 @SIMUL1@
1664 @SIMUL2@
1665 \$(SILENT)\$(MAKE) -C \$(FIRMDIR) OBJDIR=\$(BUILDDIR)/firmware
1666 \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@
1668 bin: tools
1669 @SIMUL1@
1670 @SIMUL2@
1671 \$(SILENT)\$(MAKE) -C \$(FIRMDIR) OBJDIR=\$(BUILDDIR)/firmware
1672 \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@ \$(BUILDDIR)/\$(BINARY)
1674 veryclean: clean toolsclean
1676 toolsclean:
1677 \$(SILENT)\$(MAKE) -C \$(TOOLSDIR) clean
1679 clean:
1680 \$(SILENT)echo Cleaning build directory
1681 \$(SILENT)rm -rf rockbox.zip TAGS @APPS@ firmware comsim sim lang.[ch]\
1682 manual *.pdf *.a credits.raw @OUTPUT@ bitmaps pluginbitmaps \
1683 @ARCHOSROM@ @FLASHFILE@ UI256.bmp rockbox-full.zip \
1684 html txt rockbox-manual*.zip
1686 voice: tools
1687 \$(TOOLSDIR)/genvoice.sh \$(ROOTDIR) \$(LANGUAGE) \$(ARCHOS) voicesettings.sh
1689 tools:
1690 \$(SILENT)\$(MAKE) -C \$(TOOLSDIR) CC=\$(HOSTCC) @TOOLSET@
1692 tags:
1693 \$(SILENT)rm -f TAGS
1694 \$(SILENT)\$(MAKE) -C \$(FIRMDIR) tags
1695 \$(SILENT)\$(MAKE) -C \$(APPSDIR) tags
1696 \$(SILENT)\$(MAKE) -C \$(APPSDIR)/plugins tags
1697 \$(SILENT)\$(MAKE) -C \$(APPSDIR)/plugins/lib tags
1699 fontzip:
1700 \$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -r "\$(ROOTDIR)" -f 1 -o rockbox-fonts.zip \$(TARGET) \$(BINARY)
1702 zip:
1703 \$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
1705 mapzip:
1706 \$(SILENT)find . -name "*.map" | xargs zip rockbox-maps.zip
1708 fullzip:
1709 \$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -r "\$(ROOTDIR)" -f 2 -o rockbox-full.zip \$(TARGET) \$(BINARY)
1711 7zip:
1712 \$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -o "rockbox.7z" -z "7za a" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
1714 tar:
1715 \$(SILENT)rm -f rockbox.tar
1716 \$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -o "rockbox.tar" -z "tar --no-recursion -uf" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
1718 bzip2: tar
1719 \$(SILENT)bzip2 -f9 rockbox.tar
1721 gzip: tar
1722 \$(SILENT)gzip -f9 rockbox.tar
1724 manual: manual-pdf
1725 manual-pdf:
1726 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-pdf
1727 manual-html:
1728 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-html
1729 manual-zhtml: manual-zip
1730 manual-txt:
1731 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-txt
1732 manual-ztxt:
1733 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-txt-zip
1734 manual-zip:
1735 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-zip
1737 help:
1738 @echo "A few helpful make targets"
1739 @echo ""
1740 @echo "all - builds a full Rockbox (default), including tools"
1741 @echo "bin - builds only the Rockbox.<target name> file"
1742 @echo "clean - cleans a build directory (not tools)"
1743 @echo "veryclean - cleans the build and tools directories"
1744 @echo "manual - builds a manual"
1745 @echo "manual-html - HTML manual"
1746 @echo "manual-zip - HTML manual (zipped)"
1747 @echo "manual-txt - txt manual"
1748 @echo "fullzip - creates a rockbox.zip of your build with fonts"
1749 @echo "zip - creates a rockbox.zip of your build (no fonts)"
1750 @echo "gzip - creates a rockbox.tar.gz of your build (no fonts)"
1751 @echo "bzip2 - creates a rockbox.tar.bz2 of your build (no fonts)"
1752 @echo "7zip - creates a rockbox.7z of your build (no fonts)"
1753 @echo "fontzip - creates rockbox-fonts.zip"
1754 @echo "mapzip - creates rockbox-maps.zip with all .map files"
1755 @echo "tools - builds the tools only"
1756 @echo "install - installs your build (for simulator builds only)"
1760 if [ "yes" = "$simulator" ]; then
1762 cat >> Makefile <<EOF
1764 install:
1765 @echo "installing a full setup in your archos dir"
1766 @(\$(MAKE) fullzip && cd archos && unzip -oq ../rockbox-full.zip)
1771 echo "Created Makefile"