add a "help" entry to the about menu. For now this opens the system browser with...
[Rockbox.git] / tools / configure
blob6be536e109cdc022530f9f4c2f01edb7abb7215b
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, (V)oice"
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"
258 [Vv])
259 echo "Voice build selected"
260 voice="yes"
263 if [ "$memory" = "2" ]; then
264 memory="8"
265 echo "Memory size selected: 8MB"
266 else
267 cont=0
270 [Rr])
271 if [ "$archos" = "h120" ]; then
272 config_rtc="#define CONFIG_RTC RTC_DS1339_DS3231"
273 have_rtc_alarm="#define HAVE_RTC_ALARM"
274 echo "RTC functions enabled (DS1339/DS3231)"
275 else
276 cont=0
280 cont=0
282 esac
283 done
284 echo "done"
286 if [ "yes" = "$voice" ]; then
287 toolset="${toolset} voicefont wavtrim"
289 # Ask about languages to build
290 echo "Select a number for the language to use (default is english)"
291 # The multiple-language feature is currently broken
292 # echo "You may enter a comma-separated list of languages to build"
294 picklang
295 voicelanguage=`whichlang`
297 if [ -z "$voicelanguage" ]; then
298 # pick a default
299 voicelanguage="english"
301 echo "Voice language set to $voicelanguage"
303 # Configure encoder and TTS engine for each language
304 for thislang in `echo $voicelanguage | sed 's/,/ /g'`; do
305 voiceconfig "$thislang"
306 done
308 if [ "yes" = "$use_debug" ]; then
309 debug="-DDEBUG"
310 GCCOPTS="$GCCOPTS -g -DDEBUG"
312 if [ "yes" = "$logf" ]; then
313 use_logf="#define ROCKBOX_HAS_LOGF 1"
315 if [ "yes" = "$simulator" ]; then
316 debug="-DDEBUG"
317 extradefines="$extradefines -DSIMULATOR"
319 if [ "yes" = "$profile" ]; then
320 extradefines="$extradefines -DRB_PROFILE"
321 PROFILE_OPTS="-finstrument-functions"
325 # Configure voice settings
326 voiceconfig () {
327 thislang=$1
328 echo "Building $thislang voice for $archos. Select options"
329 echo ""
331 if [ -f "`which flite`" ]; then
332 FLITE="F(l)ite "
333 FLITE_OPTS=""
334 DEFAULT_TTS="flite"
335 DEFAULT_TTS_OPTS=$FLITE_OPTS
336 DEFAULT_NOISEFLOOR="500"
337 DEFAULT_CHOICE="L"
339 if [ -f "`which espeak`" ]; then
340 ESPEAK="(e)Speak "
341 ESPEAK_OPTS=""
342 DEFAULT_TTS="espeak"
343 DEFAULT_TTS_OPTS=$ESPEAK_OPTS
344 DEFAULT_NOISEFLOOR="500"
345 DEFAULT_CHOICE="e"
347 if [ -f "`which festival`" ]; then
348 FESTIVAL="(F)estival "
349 case "$thislang" in
350 "italiano")
351 FESTIVAL_OPTS="--language italian"
353 "espanol")
354 FESTIVAL_OPTS="--language spanish"
356 "finnish")
357 FESTIVAL_OPTS="--language finnish"
359 "czech")
360 FESTIVAL_OPTS="--language czech"
363 FESTIVAL_OPTS=""
365 esac
366 DEFAULT_TTS="festival"
367 DEFAULT_TTS_OPTS=$FESTIVAL_OPTS
368 DEFAULT_NOISEFLOOR="500"
369 DEFAULT_CHOICE="F"
371 # Allow SAPI if Windows is in use
372 if [ -f "`which winver`" ]; then
373 SAPI5="(S)API5 "
374 SAPI5_OPTS=""
375 DEFAULT_TTS="sapi5"
376 DEFAULT_TTS_OPTS=$SAPI5_OPTS
377 DEFAULT_NOISEFLOOR="500"
378 DEFAULT_CHOICE="S"
381 if [ "$FESTIVAL" = "$FLITE" ] && [ "$FLITE" = "$ESPEAK" ] && [ "$ESPEAK" = "$SAPI5" ]; then
382 echo "You need Festival, eSpeak or Flite in your path, or SAPI5 available to build voice files"
383 exit
386 echo "TTS engine to use: ${FLITE}${FESTIVAL}${ESPEAK}${SAPI5}(${DEFAULT_CHOICE})?"
387 option=`input`
388 case "$option" in
389 [Ll])
390 TTS_ENGINE="flite"
391 NOISEFLOOR="500" # TODO: check this value
392 TTS_OPTS=$FLITE_OPTS
394 [Ee])
395 TTS_ENGINE="espeak"
396 NOISEFLOOR="500"
397 TTS_OPTS=$ESPEAK_OPTS
399 [Ff])
400 TTS_ENGINE="festival"
401 NOISEFLOOR="500"
402 TTS_OPTS=$FESTIVAL_OPTS
404 [Ss])
405 TTS_ENGINE="sapi5"
406 NOISEFLOOR="500"
407 TTS_OPTS=$SAPI5_OPTS
410 TTS_ENGINE=$DEFAULT_TTS
411 TTS_OPTS=$DEFAULT_TTS_OPTS
412 NOISEFLOOR=$DEFAULT_NOISEFLOOR
413 esac
414 echo "Using $TTS_ENGINE for TTS"
416 # Allow the user to input manual commandline options
417 printf "Enter $TTS_ENGINE options (enter for defaults \"$TTS_OPTS\"): "
418 USER_TTS_OPTS=`input`
419 if [ -n "$USER_TTS_OPTS" ]; then
420 TTS_OPTS="$USER_TTS_OPTS"
423 echo ""
425 if [ -f "`which oggenc`" ]; then
426 OGGENC="(O)ggenc "
427 DEFAULT_ENC="oggenc"
428 VORBIS_OPTS="-q0 --downmix"
429 DEFAULT_ENC_OPTS=$VORBIS_OPTS
430 DEFAULT_CHOICE="O"
432 if [ -f "`which speexenc`" ]; then
433 SPEEXENC="(S)peexenc "
434 DEFAULT_ENC="speexenc"
435 SPEEX_OPTS="" # TODO: find appropriate options for speex
436 DEFAULT_ENC_OPTS=$SPEEX_OPTS
437 DEFAULT_CHOICE="S"
439 if [ -f "`which lame`" ]; then
440 LAME="(L)ame "
441 DEFAULT_ENC="lame"
442 LAME_OPTS="--resample 12 -t -m m -h -V 9 -S -B 64 --vbr-new"
443 DEFAULT_ENC_OPTS=$LAME_OPTS
444 DEFAULT_CHOICE="L"
447 if [ "$LAME" = "" ]; then
448 echo "You currently need to have Lame installed to build voice files"
451 # echo "Encoder to use: ${LAME}${OGGENC}${SPEEXENC}(${DEFAULT_CHOICE})?"
452 # echo ""
453 # echo "Note: Use Lame - the other options won't work"
454 # option=`input`
455 option="l"
456 case "$option" in
457 [Oo])
458 ENCODER="oggenc"
459 ENC_OPTS=$VORBIS_OPTS
461 [Ss])
462 ENCODER="speexenc"
463 ENC_OPTS=$SPEEX_OPTS
465 [Ll])
466 ENCODER="lame"
467 ENC_OPTS=$LAME_OPTS
470 ENCODER=$DEFAULT_ENC
471 ENC_OPTS=$DEFAULT_ENC_OPTS
472 esac
473 echo "Using $ENCODER for encoding voice clips"
475 # Allow the user to input manual commandline options
476 printf "Enter $ENCODER options (enter for defaults \"$ENC_OPTS\"): "
477 USER_ENC_OPTS=`input`
478 if [ -n "$USER_ENC_OPTS" ]; then
479 ENC_OPTS=$USER_ENC_OPTS
482 TEMPDIR="${pwd}"
483 if [ -f "`which cygpath`" ]; then
484 TEMPDIR=`cygpath . -a -w`
488 picklang() {
489 # figure out which languages that are around
490 for file in $rootdir/apps/lang/*.lang; do
491 clean=`echo $file | sed -e 's:.*/::g' | cut "-d." -f1`
492 langs="$langs $clean"
493 done
495 num=1
496 for one in $langs; do
497 echo "$num. $one"
498 num=`expr $num + 1`
499 done
501 read pick
504 whichlang() {
505 output=""
506 # Allow the user to pass a comma-separated list of langauges
507 for thispick in `echo $pick | sed 's/,/ /g'`; do
508 num=1
509 for one in $langs; do
510 # Accept both the language number and name
511 if [ "$num" = "$thispick" ] || [ "$thispick" = "$one" ]; then
512 if [ "$output" = "" ]; then
513 output=$one
514 else
515 output=$output,$one
518 num=`expr $num + 1`
519 done
520 done
521 echo $output
524 opt=$1
526 if test "$opt" = "--help"; then
527 echo "Rockbox configure script."
528 echo "Invoke this in a directory to generate a Makefile to build Rockbox"
529 echo "Do *NOT* run this within the tools directory!"
530 echo ""
531 echo "Usage: configure [--ccache][--no-ccache]"
532 exit
535 if test -r "configure"; then
536 # this is a check for a configure script in the current directory, it there
537 # is one, try to figure out if it is this one!
539 if { grep "^# Jukebox" configure >/dev/null 2>&1 ; } then
540 echo "WEEEEEEEEP. Don't run this configure script within the tools directory."
541 echo "It will only cause you pain and grief. Instead do this:"
542 echo ""
543 echo " cd .."
544 echo " mkdir build-dir"
545 echo " cd build-dir"
546 echo " ../tools/configure"
547 echo ""
548 echo "Much happiness will arise from this. Enjoy"
549 exit
553 # get our current directory
554 pwd=`pwd`;
556 if { echo $pwd | grep " "; } then
557 echo "You're running this script in a path that contains space. The build"
558 echo "system is unfortunately not clever enough to deal with this. Please"
559 echo "run the script from a different path, rename the path or fix the build"
560 echo "system!"
561 exit
564 if [ -z "$rootdir" ]; then
565 ##################################################################
566 # Figure out where the source code root is!
568 rootdir=`dirname $0`/../
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) Ondio SP 14) H10 20Gb 24) 4G Grayscale
599 5) Ondio FM 15) H10 5/6Gb 25) Mini 1G
600 6) AV300 26) Mini 2G
601 27) 1G, 2G
603 ==iAudio== ==Toshiba== ==SanDisk==
604 30) X5/X5V/X5L 40) Gigabeat F 50) Sansa e200
605 31) M5/M5L 51) Sansa e200R
607 ==Tatung==
608 60) Elio TPJ-1022
611 buildfor=`input`;
613 # Set of tools built for all target platforms:
614 toolset="rdf2binary convbdf codepages"
616 # Toolsets for some target families:
617 archosbitmaptools="$toolset scramble descramble sh2d uclpack bmp2rb"
618 iriverbitmaptools="$toolset scramble descramble mkboot bmp2rb"
619 iaudiobitmaptools="$toolset scramble descramble mkboot bmp2rb"
620 ipodbitmaptools="$toolset scramble ipod_fw bmp2rb codepages"
621 gigabeatbitmaptools="$toolset scramble descramble bmp2rb"
622 # generic is used by IFP, H10, Sansa-e200
623 genericbitmaptools="$toolset bmp2rb"
626 # ---- For each target ----
628 # *Variables*
629 # target_id: a unique number identifying this target, DOES NOT necessarily
630 # have to be the menu number. Just use the currently highest
631 # number+1 when you add a new target.
632 # archos: short model name used all over to identify this target
633 # memory: number of megabytes of RAM this target has. If the amount can
634 # be selected by the size prompt, let memory be unset here
635 # target: -Ddefine passed to the build commands to make the correct
636 # config-*.h file get included etc
637 # tool: the tool that takes a plain binary and converts that into a
638 # working "firmware" file for your target
639 # output: the final output file name
640 # boottool: the tool that takes a plain binary and generates a bootloader
641 # file for your target (or blank to use $tool)
642 # bootoutput:the final output file name for the bootloader (or blank to use
643 # $output)
644 # appextra: passed to the APPEXTRA variable in the Makefiles.
645 # TODO: add proper explanation
646 # archosrom: used only for Archos targets that build a special flashable .ucl
647 # image. Set to blank for other builds.
648 # flash: the same as archosrom. These two should be merged
649 # plugins: set to 'yes' to build the plugins. Early development builds can
650 # set this to no in the early stages to have an easier life for a
651 # while
652 # swcodec: set 'yes' on swcodec targets
653 # toolset: lists what particular tools in the tools/ directory that this
654 # target needs to have built prior to building Rockbox
656 # *Functions*
657 # *cc: sets up gcc and compiler options for your target builds. Note
658 # that if you select a simulator build, the compiler selection is
659 # overridden later in the script.
661 case $buildfor in
663 0|player)
664 target_id=1
665 archos="player"
666 target="-DARCHOS_PLAYER"
667 shcc
668 tool="$rootdir/tools/scramble"
669 output="archos.mod"
670 appextra="player:gui"
671 archosrom="$pwd/rombox.ucl"
672 flash="$pwd/rockbox.ucl"
673 plugins="yes"
674 swcodec=""
676 # toolset is the tools within the tools directory that we build for
677 # this particular target.
678 toolset="$toolset scramble descramble sh2d player_unifont uclpack"
680 # Note: the convbdf is present in the toolset just because: 1) the
681 # firmware/Makefile assumes it is present always, and 2) we will need it when we
682 # build the player simulator
684 t_cpu="sh"
685 t_manufacturer="archos"
686 t_model="player"
689 1|recorder)
690 target_id=2
691 archos="recorder"
692 target="-DARCHOS_RECORDER"
693 shcc
694 tool="$rootdir/tools/scramble"
695 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
696 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
697 output="ajbrec.ajz"
698 appextra="recorder:gui"
699 archosrom="" #"$pwd/rombox.ucl"
700 flash="$pwd/rockbox.ucl"
701 plugins="yes"
702 swcodec=""
703 # toolset is the tools within the tools directory that we build for
704 # this particular target.
705 toolset=$archosbitmaptools
706 t_cpu="sh"
707 t_manufacturer="archos"
708 t_model="recorder"
711 2|fmrecorder)
712 target_id=3
713 archos="fmrecorder"
714 target="-DARCHOS_FMRECORDER"
715 shcc
716 tool="$rootdir/tools/scramble -fm"
717 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
718 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
719 output="ajbrec.ajz"
720 appextra="recorder:gui"
721 archosrom="" #"$pwd/rombox.ucl"
722 flash="$pwd/rockbox.ucl"
723 plugins="yes"
724 swcodec=""
725 # toolset is the tools within the tools directory that we build for
726 # this particular target.
727 toolset=$archosbitmaptools
728 t_cpu="sh"
729 t_manufacturer="archos"
730 t_model="fm_v2"
733 3|recorderv2)
734 target_id=4
735 archos="recorderv2"
736 target="-DARCHOS_RECORDERV2"
737 shcc
738 tool="$rootdir/tools/scramble -v2"
739 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
740 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
741 output="ajbrec.ajz"
742 appextra="recorder:gui"
743 archosrom="" #"$pwd/rombox.ucl"
744 flash="$pwd/rockbox.ucl"
745 plugins="yes"
746 swcodec=""
747 # toolset is the tools within the tools directory that we build for
748 # this particular target.
749 toolset=$archosbitmaptools
750 t_cpu="sh"
751 t_manufacturer="archos"
752 t_model="fm_v2"
755 4|ondiosp)
756 target_id=7
757 archos="ondiosp"
758 target="-DARCHOS_ONDIOSP"
759 shcc
760 tool="$rootdir/tools/scramble -osp"
761 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
762 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
763 output="ajbrec.ajz"
764 appextra="recorder:gui"
765 archosrom="$pwd/rombox.ucl"
766 flash="$pwd/rockbox.ucl"
767 plugins="yes"
768 swcodec=""
769 # toolset is the tools within the tools directory that we build for
770 # this particular target.
771 toolset=$archosbitmaptools
772 t_cpu="sh"
773 t_manufacturer="archos"
774 t_model="ondio"
777 5|ondiofm)
778 target_id=8
779 archos="ondiofm"
780 target="-DARCHOS_ONDIOFM"
781 shcc
782 tool="$rootdir/tools/scramble -ofm"
783 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
784 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
785 output="ajbrec.ajz"
786 appextra="recorder:gui"
787 archosrom="" #"$pwd/rombox.ucl"
788 flash="$pwd/rockbox.ucl"
789 plugins="yes"
790 swcodec=""
791 toolset=$archosbitmaptools
792 t_cpu="sh"
793 t_manufacturer="archos"
794 t_model="ondio"
797 6|av300)
798 target_id=26
799 archos="av300"
800 target="-DARCHOS_AV300"
801 memory=16 # always
802 arm7tdmicc
803 tool="$rootdir/tools/scramble -mm=C"
804 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
805 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
806 output="cjbm.ajz"
807 appextra="recorder:gui"
808 archosrom=""
809 flash=""
810 plugins="yes"
811 swcodec=""
812 # toolset is the tools within the tools directory that we build for
813 # this particular target.
814 toolset="$toolset scramble descramble bmp2rb codepages"
815 # architecture, manufacturer and model for the target-tree build
816 t_cpu="arm"
817 t_manufacturer="archos"
818 t_model="av300"
821 10|h120)
822 target_id=9
823 archos="h120"
824 target="-DIRIVER_H120"
825 memory=32 # always
826 coldfirecc
827 tool="$rootdir/tools/scramble -add=h120"
828 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
829 bmp2rb_native="$rootdir/tools/bmp2rb -f 2"
830 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
831 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
832 output="rockbox.iriver"
833 appextra="recorder:gui"
834 archosrom=""
835 flash="$pwd/rombox.iriver"
836 plugins="yes"
837 swcodec="yes"
838 # toolset is the tools within the tools directory that we build for
839 # this particular target.
840 toolset=$iriverbitmaptools
841 t_cpu="coldfire"
842 t_manufacturer="iriver"
843 t_model="h100"
846 11|h300)
847 target_id=10
848 archos="h300"
849 target="-DIRIVER_H300"
850 memory=32 # always
851 coldfirecc
852 tool="$rootdir/tools/scramble -add=h300"
853 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
854 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
855 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
856 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
857 output="rockbox.iriver"
858 appextra="recorder:gui"
859 archosrom=""
860 flash=""
861 plugins="yes"
862 swcodec="yes"
863 # toolset is the tools within the tools directory that we build for
864 # this particular target.
865 toolset=$iriverbitmaptools
866 t_cpu="coldfire"
867 t_manufacturer="iriver"
868 t_model="h300"
871 12|h100)
872 target_id=11
873 archos="h100"
874 target="-DIRIVER_H100"
875 memory=16 # always
876 coldfirecc
877 tool="$rootdir/tools/scramble -add=h100"
878 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
879 bmp2rb_native="$rootdir/tools/bmp2rb -f 2"
880 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
881 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
882 output="rockbox.iriver"
883 appextra="recorder:gui"
884 archosrom=""
885 flash=""
886 plugins="yes"
887 swcodec="yes"
888 # toolset is the tools within the tools directory that we build for
889 # this particular target.
890 toolset=$iriverbitmaptools
891 t_cpu="coldfire"
892 t_manufacturer="iriver"
893 t_model="h100"
896 13|ifp7xx)
897 target_id=19
898 archos="ifp7xx"
899 target="-DIRIVER_IFP7XX"
900 memory=1
901 arm7tdmicc short
902 tool="cp"
903 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
904 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
905 output="rockbox.wma"
906 appextra="recorder:gui"
907 archosrom=""
908 flash=""
909 plugins="yes"
910 swcodec="yes"
911 # toolset is the tools within the tools directory that we build for
912 # this particular target.
913 toolset=$genericbitmaptools
914 t_cpu="arm"
915 t_manufacturer="pnx0101"
916 t_model="iriver-ifp7xx"
919 14|h10)
920 target_id=22
921 archos="h10"
922 target="-DIRIVER_H10"
923 memory=32 # always
924 arm7tdmicc
925 tool="$rootdir/tools/scramble -mi4v3 -model=h10 -type=RBOS"
926 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
927 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
928 output="rockbox.mi4"
929 appextra="recorder:gui"
930 archosrom=""
931 flash=""
932 plugins="yes"
933 swcodec="yes"
934 boottool="$rootdir/tools/scramble -mi4v3 -model=h10 -type=RBBL"
935 bootoutput="H10_20GC.mi4"
936 # toolset is the tools within the tools directory that we build for
937 # this particular target.
938 toolset="$genericbitmaptools scramble"
939 # architecture, manufacturer and model for the target-tree build
940 t_cpu="arm"
941 t_manufacturer="iriver"
942 t_model="h10"
945 15|h10_5gb)
946 target_id=24
947 archos="h10_5gb"
948 target="-DIRIVER_H10_5GB"
949 memory=32 # always
950 arm7tdmicc
951 tool="$rootdir/tools/scramble -mi4v2 -model=h105 -type=RBOS"
952 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
953 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
954 output="rockbox.mi4"
955 appextra="recorder:gui"
956 archosrom=""
957 flash=""
958 plugins="yes"
959 swcodec="yes"
960 boottool="$rootdir/tools/scramble -mi4v2 -model=h105 -type=RBBL"
961 bootoutput="H10.mi4"
962 # toolset is the tools within the tools directory that we build for
963 # this particular target.
964 toolset="$genericbitmaptools scramble"
965 # architecture, manufacturer and model for the target-tree build
966 t_cpu="arm"
967 t_manufacturer="iriver"
968 t_model="h10"
971 20|ipodcolor)
972 target_id=13
973 archos="ipodcolor"
974 target="-DIPOD_COLOR"
975 memory=32 # always
976 arm7tdmicc
977 tool="$rootdir/tools/scramble -add=ipco"
978 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
979 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
980 output="rockbox.ipod"
981 appextra="recorder:gui"
982 archosrom=""
983 flash=""
984 plugins="yes"
985 swcodec="yes"
986 bootoutput="bootloader-$archos.ipod"
987 # toolset is the tools within the tools directory that we build for
988 # this particular target.
989 toolset=$ipodbitmaptools
990 # architecture, manufacturer and model for the target-tree build
991 t_cpu="arm"
992 t_manufacturer="ipod"
993 t_model="color"
996 21|ipodnano)
997 target_id=14
998 archos="ipodnano"
999 target="-DIPOD_NANO"
1000 memory=32 # always
1001 arm7tdmicc
1002 tool="$rootdir/tools/scramble -add=nano"
1003 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1004 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
1005 output="rockbox.ipod"
1006 appextra="recorder:gui"
1007 archosrom=""
1008 flash=""
1009 plugins="yes"
1010 swcodec="yes"
1011 bootoutput="bootloader-$archos.ipod"
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="nano"
1021 22|ipodvideo)
1022 target_id=15
1023 archos="ipodvideo"
1024 target="-DIPOD_VIDEO"
1025 arm7tdmicc
1026 tool="$rootdir/tools/scramble -add=ipvd"
1027 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1028 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1029 output="rockbox.ipod"
1030 appextra="recorder:gui"
1031 archosrom=""
1032 flash=""
1033 plugins="yes"
1034 swcodec="yes"
1035 bootoutput="bootloader-$archos.ipod"
1036 # toolset is the tools within the tools directory that we build for
1037 # this particular target.
1038 toolset=$ipodbitmaptools
1039 # architecture, manufacturer and model for the target-tree build
1040 t_cpu="arm"
1041 t_manufacturer="ipod"
1042 t_model="video"
1045 23|ipod3g)
1046 target_id=16
1047 archos="ipod3g"
1048 target="-DIPOD_3G"
1049 memory=32 # always
1050 arm7tdmicc
1051 tool="$rootdir/tools/scramble -add=ip3g"
1052 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1053 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1054 output="rockbox.ipod"
1055 appextra="recorder:gui"
1056 archosrom=""
1057 flash=""
1058 plugins="yes"
1059 swcodec="yes"
1060 bootoutput="bootloader-$archos.ipod"
1061 # toolset is the tools within the tools directory that we build for
1062 # this particular target.
1063 toolset=$ipodbitmaptools
1064 # architecture, manufacturer and model for the target-tree build
1065 t_cpu="arm"
1066 t_manufacturer="ipod"
1067 t_model="3g"
1070 24|ipod4g)
1071 target_id=17
1072 archos="ipod4g"
1073 target="-DIPOD_4G"
1074 memory=32 # always
1075 arm7tdmicc
1076 tool="$rootdir/tools/scramble -add=ip4g"
1077 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1078 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1079 output="rockbox.ipod"
1080 appextra="recorder:gui"
1081 archosrom=""
1082 flash=""
1083 plugins="yes"
1084 swcodec="yes"
1085 bootoutput="bootloader-$archos.ipod"
1086 # toolset is the tools within the tools directory that we build for
1087 # this particular target.
1088 toolset=$ipodbitmaptools
1089 # architecture, manufacturer and model for the target-tree build
1090 t_cpu="arm"
1091 t_manufacturer="ipod"
1092 t_model="4g"
1095 25|ipodmini)
1096 target_id=18
1097 archos="ipodmini"
1098 target="-DIPOD_MINI"
1099 memory=32 # always
1100 arm7tdmicc
1101 tool="$rootdir/tools/scramble -add=mini"
1102 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1103 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1104 output="rockbox.ipod"
1105 appextra="recorder:gui"
1106 archosrom=""
1107 flash=""
1108 plugins="yes"
1109 swcodec="yes"
1110 bootoutput="bootloader-$archos.ipod"
1111 # toolset is the tools within the tools directory that we build for
1112 # this particular target.
1113 toolset=$ipodbitmaptools
1114 # architecture, manufacturer and model for the target-tree build
1115 t_cpu="arm"
1116 t_manufacturer="ipod"
1117 t_model="mini"
1120 26|ipodmini2g)
1121 target_id=21
1122 archos="ipodmini2g"
1123 target="-DIPOD_MINI2G"
1124 memory=32 # always
1125 arm7tdmicc
1126 tool="$rootdir/tools/scramble -add=mn2g"
1127 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1128 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1129 output="rockbox.ipod"
1130 appextra="recorder:gui"
1131 archosrom=""
1132 flash=""
1133 plugins="yes"
1134 swcodec="yes"
1135 bootoutput="bootloader-$archos.ipod"
1136 # toolset is the tools within the tools directory that we build for
1137 # this particular target.
1138 toolset=$ipodbitmaptools
1139 # architecture, manufacturer and model for the target-tree build
1140 t_cpu="arm"
1141 t_manufacturer="ipod"
1142 t_model="mini2g"
1145 27|ipod1g2g)
1146 target_id=29
1147 archos="ipod1g2g"
1148 target="-DIPOD_1G2G"
1149 memory=32 # always
1150 arm7tdmicc
1151 tool="$rootdir/tools/scramble -add=1g2g"
1152 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1153 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1154 output="rockbox.ipod"
1155 appextra="recorder:gui"
1156 archosrom=""
1157 flash=""
1158 plugins="yes"
1159 swcodec="yes"
1160 bootoutput="bootloader-$archos.ipod"
1161 # toolset is the tools within the tools directory that we build for
1162 # this particular target.
1163 toolset=$ipodbitmaptools
1164 # architecture, manufacturer and model for the target-tree build
1165 t_cpu="arm"
1166 t_manufacturer="ipod"
1167 t_model="1g2g"
1170 30|x5)
1171 target_id=12
1172 archos="x5"
1173 target="-DIAUDIO_X5"
1174 memory=16 # always
1175 coldfirecc
1176 tool="$rootdir/tools/scramble -add=iax5"
1177 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1178 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1179 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
1180 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 7"
1181 output="rockbox.iaudio"
1182 appextra="recorder:gui"
1183 archosrom=""
1184 flash=""
1185 plugins="yes"
1186 swcodec="yes"
1187 # toolset is the tools within the tools directory that we build for
1188 # this particular target.
1189 toolset="$iaudiobitmaptools"
1190 # architecture, manufacturer and model for the target-tree build
1191 t_cpu="coldfire"
1192 t_manufacturer="iaudio"
1193 t_model="x5"
1196 31|m5)
1197 target_id=28
1198 archos="m5"
1199 target="-DIAUDIO_M5"
1200 memory=16 # always
1201 coldfirecc
1202 tool="$rootdir/tools/scramble -add=iam5"
1203 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1204 bmp2rb_native="$rootdir/tools/bmp2rb -f 2"
1205 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
1206 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 7"
1207 output="rockbox.iaudio"
1208 appextra="recorder:gui"
1209 archosrom=""
1210 flash=""
1211 plugins="yes"
1212 swcodec="yes"
1213 # toolset is the tools within the tools directory that we build for
1214 # this particular target.
1215 toolset="$iaudiobitmaptools"
1216 # architecture, manufacturer and model for the target-tree build
1217 t_cpu="coldfire"
1218 t_manufacturer="iaudio"
1219 t_model="m5"
1222 40|gigabeatf)
1223 target_id=20
1224 archos="gigabeatf"
1225 target="-DGIGABEAT_F"
1226 memory=32 # always
1227 arm9tdmicc
1228 tool="$rootdir/tools/scramble -add=giga"
1229 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1230 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1231 output="rockbox.gigabeat"
1232 appextra="recorder:gui"
1233 archosrom=""
1234 flash=""
1235 plugins="yes"
1236 swcodec="yes"
1237 toolset=$gigabeatbitmaptools
1238 boottool="$rootdir/tools/scramble -gigabeat"
1239 bootoutput="FWIMG01.DAT"
1240 # architecture, manufacturer and model for the target-tree build
1241 t_cpu="arm"
1242 t_manufacturer="s3c2440"
1243 t_model="gigabeat-fx"
1246 50|e200)
1247 target_id=23
1248 archos="e200"
1249 target="-DSANSA_E200"
1250 memory=32 # supposedly
1251 arm7tdmicc
1252 tool="$rootdir/tools/scramble -mi4v3 -model=e200 -type=RBOS"
1253 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1254 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1255 output="rockbox.mi4"
1256 appextra="recorder:gui"
1257 archosrom=""
1258 flash=""
1259 plugins="yes"
1260 swcodec="yes"
1261 boottool="$rootdir/tools/scramble -mi4v3 -model=e200 -type=RBBL"
1262 bootoutput="PP5022.mi4"
1263 # toolset is the tools within the tools directory that we build for
1264 # this particular target.
1265 toolset="$genericbitmaptools scramble"
1266 # architecture, manufacturer and model for the target-tree build
1267 t_cpu="arm"
1268 t_manufacturer="sandisk"
1269 t_model="sansa-e200"
1272 51|e200r)
1273 # the e200R model is pretty much identical to the e200, it only has a
1274 # different option to the scramble tool when building a bootloader and
1275 # makes the bootloader output file name in all lower case.
1276 target_id=27
1277 archos="e200r"
1278 target="-DSANSA_E200"
1279 memory=32 # supposedly
1280 arm7tdmicc
1281 tool="$rootdir/tools/scramble -mi4v3 -model=e20r -type=RBOS"
1282 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1283 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1284 output="rockbox.mi4"
1285 appextra="recorder:gui"
1286 archosrom=""
1287 flash=""
1288 plugins="yes"
1289 swcodec="yes"
1290 boottool="$rootdir/tools/scramble -mi4r -model=e20r -type=RBBL"
1291 bootoutput="pp5022.mi4"
1292 # toolset is the tools within the tools directory that we build for
1293 # this particular target.
1294 toolset="$genericbitmaptools scramble"
1295 # architecture, manufacturer and model for the target-tree build
1296 t_cpu="arm"
1297 t_manufacturer="sandisk"
1298 t_model="sansa-e200"
1301 60|tpj1022)
1302 target_id=25
1303 archos="tpj1022"
1304 target="-DELIO_TPJ1022"
1305 memory=32 # always
1306 arm7tdmicc
1307 tool="$rootdir/tools/scramble -add tpj2"
1308 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1309 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
1310 output="rockbox.elio"
1311 appextra="recorder:gui"
1312 archosrom=""
1313 flash=""
1314 plugins="yes"
1315 swcodec="yes"
1316 boottool="$rootdir/tools/scramble -mi4v2"
1317 bootoutput="pp5020.mi4"
1318 # toolset is the tools within the tools directory that we build for
1319 # this particular target.
1320 toolset="$genericbitmaptools scramble"
1321 # architecture, manufacturer and model for the target-tree build
1322 t_cpu="arm"
1323 t_manufacturer="tatung"
1324 t_model="tpj1022"
1328 echo "Please select a supported target platform!"
1329 exit
1332 esac
1334 echo "Platform set to $archos"
1337 #remove start
1338 ############################################################################
1339 # Amount of memory, for those that can differ. They have $memory unset at
1340 # this point.
1343 if [ -z "$memory" ]; then
1345 case $target_id in
1347 echo "Enter size of your RAM (in MB): (Defaults to 32)"
1348 size=`input`;
1349 case $size in
1350 60|64)
1351 memory="64"
1354 memory="32"
1356 esac
1360 echo "Enter size of your RAM (in MB): (defaults to 2)"
1361 size=`input`;
1362 case $size in
1364 memory="8"
1367 memory="2"
1369 esac
1371 esac
1373 echo "Memory size selected: $memory MB"
1375 #remove end
1377 ##################################################################
1378 # Figure out build "type"
1381 # the ifp7x0 is the only platform that supports building a gdb stub like
1382 # this
1383 case $archos in
1384 ifp7xx)
1385 gdbstub="(G)DB stub, "
1389 esac
1391 echo ""
1392 echo "Build (N)ormal, (A)dvanced, (S)imulator, (B)ootloader, $gdbstub(M)anual (N)"
1394 option=`input`;
1396 case $option in
1397 [Bb])
1398 if test $t_manufacturer = "archos"; then
1399 # Archos SH-based players do this somewhat differently for
1400 # some reason
1401 appsdir='\$(ROOTDIR)/flash/bootbox'
1402 apps="bootbox"
1403 else
1404 appsdir='\$(ROOTDIR)/bootloader'
1405 apps="bootloader"
1406 flash=""
1407 if test -n "$boottool"; then
1408 tool="$boottool"
1410 if test -n "$bootoutput"; then
1411 output=$bootoutput
1414 extradefines="-DBOOTLOADER -ffunction-sections -fdata-sections"
1415 bootloader="1"
1416 echo "Bootloader build selected"
1418 [Ss])
1419 debug="-DDEBUG"
1420 simulator="yes"
1421 extradefines="-DSIMULATOR"
1422 echo "Simulator build selected"
1424 [Aa])
1425 echo "Advanced build selected"
1426 whichadvanced
1428 [Gg])
1429 extradefines="-DSTUB" # for target makefile symbol EXTRA_DEFINES
1430 appsdir='\$(ROOTDIR)/gdb'
1431 apps="stub"
1432 case $archos in
1433 ifp7xx)
1434 output="stub.wma"
1438 esac
1439 echo "GDB stub build selected"
1441 [Mm])
1442 appsdir='\$(ROOTDIR)/manual'
1443 firmdir='\$(ROOTDIR)/manual/platform' # No Makefile here. Effectively ignores target
1444 toolsdir=$firmdir;
1445 toolset='';
1446 apps="manual"
1447 echo "Manual build selected"
1450 debug=""
1451 echo "Normal build selected"
1454 esac
1455 # to be able running "make manual" from non-manual configuration
1456 case $archos in
1457 fmrecorder)
1458 manualdev="recorderv2fm"
1460 recorderv2)
1461 manualdev="recorderv2fm"
1463 h1??)
1464 manualdev="h1xx"
1466 ipodmini2g)
1467 manualdev="ipodmini"
1470 manualdev=$archos
1472 esac
1474 if [ -z "$debug" ]; then
1475 GCCOPTS="$GCCOPTS $GCCOPTIMIZE"
1478 echo "Using source code root directory: $rootdir"
1480 # this was once possible to change at build-time, but no more:
1481 language="english"
1483 uname=`uname`
1485 if [ "yes" = "$simulator" ]; then
1486 # setup compiler and things for simulator
1487 simcc
1489 if [ -d "archos" ]; then
1490 echo "sub directory archos already present"
1491 else
1492 mkdir archos
1493 echo "created an archos subdirectory for simulating the hard disk"
1497 # Now, figure out version number of the (gcc) compiler we are about to use
1498 gccver=`$CC -dumpversion`;
1500 if [ -z "$gccver" ]; then
1501 echo "WARNING: The compiler you must use ($CC) is not in your path!"
1502 echo "WARNING: this may cause your build to fail since we cannot do the"
1503 echo "WARNING: checks we want now."
1504 else
1506 # gccver should now be "3.3.5", "3.4.3", "2.95.3-6" and similar, but don't
1507 # DEPEND on it
1509 num1=`echo $gccver | cut -d . -f1`
1510 num2=`echo $gccver | cut -d . -f2`
1511 gccnum=`(expr $num1 "*" 100 + $num2) 2>/dev/null`
1513 # This makes:
1514 # 3.3.X => 303
1515 # 3.4.X => 304
1516 # 2.95.3 => 295
1518 echo "Using $CC $gccver ($gccnum)"
1520 if test "$gccnum" -ge "400"; then
1521 # gcc 4.0 is just *so* much pickier on arguments that differ in signedness
1522 # so we ignore that warnings for now
1523 # -Wno-pointer-sign
1524 GCCOPTS="$GCCOPTS -Wno-pointer-sign"
1527 if test "$gccnum" -ge "401"; then
1528 # this is a lame hack to avoid "warning: dereferencing type-punned pointer
1529 # will break strict-aliasing rules"
1531 GCCOPTS="$GCCOPTS -fno-strict-aliasing"
1536 # check the compiler for SH platforms
1537 if test "$CC" = "sh-elf-gcc"; then
1538 if test "$gccnum" -lt "400"; then
1539 echo "WARNING: Consider upgrading your compiler to the 4.0.X series!"
1540 echo "WARNING: http://www.rockbox.org/twiki/bin/view/Main/CrossCompiler"
1541 else
1542 # figure out patch status
1543 gccpatch=`$CC --version`;
1545 if { echo $gccpatch | grep "rockbox" >/dev/null 2>&1; } then
1546 echo "gcc $gccver is rockbox patched"
1547 # then convert -O to -Os to get smaller binaries!
1548 GCCOPTS=`echo $GCCOPTS | sed 's/ -O / -Os /'`
1549 else
1550 echo "WARNING: You use an unpatched gcc compiler: $gccver"
1551 echo "WARNING: http://www.rockbox.org/twiki/bin/view/Main/CrossCompiler"
1556 if test "$CC" = "m68k-elf-gcc"; then
1557 # convert -O to -Os to get smaller binaries!
1558 GCCOPTS=`echo $GCCOPTS | sed 's/ -O / -Os /'`
1561 if test "$1" = "--ccache"; then
1562 echo "Enable ccache for building"
1563 ccache="ccache"
1564 else
1565 if test "$1" != "--no-ccache"; then
1566 ccache=`findtool ccache`
1567 if test -n "$ccache"; then
1568 echo "Found and uses ccache ($ccache)"
1573 if test -n "$ccache"; then
1574 CC="$ccache $CC"
1577 if test "X$endian" = "Xbig"; then
1578 defendian="ROCKBOX_BIG_ENDIAN"
1579 else
1580 defendian="ROCKBOX_LITTLE_ENDIAN"
1583 sed > autoconf.h \
1584 -e "s,@ENDIAN@,${defendian},g" \
1585 -e "s,^#undef ROCKBOX_HAS_LOGF,$use_logf,g" \
1586 -e "s,@config_rtc@,$config_rtc,g" \
1587 -e "s,@have_rtc_alarm@,$have_rtc_alarm,g" \
1588 <<EOF
1589 /* This header was made by configure */
1590 #ifndef __BUILD_AUTOCONF_H
1591 #define __BUILD_AUTOCONF_H
1593 /* Define endianess for the target or simulator platform */
1594 #define @ENDIAN@ 1
1596 /* Define this if you build rockbox to support the logf logging and display */
1597 #undef ROCKBOX_HAS_LOGF
1599 /* optional defines for RTC mod for h1x0 */
1600 @config_rtc@
1601 @have_rtc_alarm@
1603 #endif /* __BUILD_AUTOCONF_H */
1606 if test -n "$t_cpu"; then
1607 TARGET_INC="-I\$(FIRMDIR)/target/$t_cpu/$t_manufacturer/$t_model"
1608 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/$t_cpu/$t_manufacturer"
1609 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/$t_cpu"
1610 GCCOPTS="$GCCOPTS"
1613 if test "$simulator" = "yes"; then
1614 # add simul make stuff on the #SIMUL# line
1615 simmagic1="s,@SIMUL1@,\$(SILENT)\$(MAKE) -C \$(SIMDIR) OBJDIR=\$(BUILDDIR)/sim,"
1616 simmagic2="s,@SIMUL2@,\$(SILENT)\$(MAKE) -C \$(ROOTDIR)/uisimulator/common OBJDIR=\$(BUILDDIR)/comsim,"
1617 else
1618 # delete the lines that match
1619 simmagic1='/@SIMUL1@/D'
1620 simmagic2='/@SIMUL2@/D'
1623 sed > Makefile \
1624 -e "s,@ROOTDIR@,${rootdir},g" \
1625 -e "s,@DEBUG@,${debug},g" \
1626 -e "s,@MEMORY@,${memory},g" \
1627 -e "s,@TARGET_ID@,${target_id},g" \
1628 -e "s,@TARGET@,${target},g" \
1629 -e "s,@CPU@,${t_cpu},g" \
1630 -e "s,@MANUFACTURER@,${t_manufacturer},g" \
1631 -e "s,@ARCHOS@,${archos},g" \
1632 -e "s,@LANGUAGE@,${language},g" \
1633 -e "s:@VOICELANGUAGE@:${voicelanguage}:g" \
1634 -e "s,@PWD@,${pwd},g" \
1635 -e "s,@CC@,${CC},g" \
1636 -e "s,@LD@,${LD},g" \
1637 -e "s,@AR@,${AR},g" \
1638 -e "s,@AS@,${AS},g" \
1639 -e "s,@OC@,${OC},g" \
1640 -e "s,@WINDRES@,${WINDRES},g" \
1641 -e "s,@DLLTOOL@,${DLLTOOL},g" \
1642 -e "s,@DLLWRAP@,${DLLWRAP},g" \
1643 -e "s,@RANLIB@,${RANLIB},g" \
1644 -e "s,@TOOL@,${tool},g" \
1645 -e "s,@BMP2RB_NATIVE@,${bmp2rb_native},g" \
1646 -e "s,@BMP2RB_MONO@,${bmp2rb_mono},g" \
1647 -e "s,@BMP2RB_REMOTENATIVE@,${bmp2rb_remotenative},g" \
1648 -e "s,@BMP2RB_REMOTEMONO@,${bmp2rb_remotemono},g" \
1649 -e "s,@OUTPUT@,${output},g" \
1650 -e "s,@APPEXTRA@,${appextra},g" \
1651 -e "s,@ARCHOSROM@,${archosrom},g" \
1652 -e "s,@FLASHFILE@,${flash},g" \
1653 -e "s,@PLUGINS@,${plugins},g" \
1654 -e "s,@CODECS@,${swcodec},g" \
1655 -e "s,@PROFILE_OPTS@,${PROFILE_OPTS},g" \
1656 -e "s,@SHARED_FLAG@,${SHARED_FLAG},g" \
1657 -e "s,@GCCOPTS@,${GCCOPTS},g" \
1658 -e "s,@TARGET_INC@,${TARGET_INC},g" \
1659 -e "s!@LDOPTS@!${LDOPTS}!g" \
1660 -e "s,@LOADADDRESS@,${loadaddress},g" \
1661 -e "s,@EXTRADEF@,${extradefines},g" \
1662 -e "s,@APPSDIR@,${appsdir},g" \
1663 -e "s,@FIRMDIR@,${firmdir},g" \
1664 -e "s,@TOOLSDIR@,${toolsdir},g" \
1665 -e "s,@APPS@,${apps},g" \
1666 -e "s,@SIMVER@,${simver},g" \
1667 -e "s,@GCCVER@,${gccver},g" \
1668 -e "s,@GCCNUM@,${gccnum},g" \
1669 -e "s,@UNAME@,${uname},g" \
1670 -e "s,@ENDIAN@,${defendian},g" \
1671 -e "s,@TOOLSET@,${toolset},g" \
1672 -e "${simmagic1}" \
1673 -e "${simmagic2}" \
1674 -e "s,@MANUALDEV@,${manualdev},g" \
1675 -e "s,@ENCODER@,${ENCODER},g" \
1676 -e "s,@ENC_OPTS@,${ENC_OPTS},g" \
1677 -e "s,@TTS_ENGINE@,${TTS_ENGINE},g" \
1678 -e "s,@TTS_OPTS@,${TTS_OPTS},g" \
1679 <<EOF
1680 ## Automaticly generated. http://www.rockbox.org/
1682 ifndef V
1683 SILENT=@
1684 else
1685 VERBOSEOPT=-v
1686 endif
1688 # old 'make' versions don't have the built-in 'info' function
1689 info=old\$(shell echo >&2 "Consider upgrading to GNU make 3.81+ for optimum build performance.")
1690 ifeq (\$(call info),old)
1691 export info=echo "\$\$(1)";
1692 endif
1694 export ROOTDIR=@ROOTDIR@
1695 export FIRMDIR=@FIRMDIR@
1696 export APPSDIR=@APPSDIR@
1697 export TOOLSDIR=@TOOLSDIR@
1698 export DOCSDIR=\$(ROOTDIR)/docs
1699 export MANUALDIR=\${ROOTDIR}/manual
1700 export DEBUG=@DEBUG@
1701 export ARCHOS=@ARCHOS@
1702 export ARCHOSROM=@ARCHOSROM@
1703 export FLASHFILE=@FLASHFILE@
1704 export TARGET_ID=@TARGET_ID@
1705 export TARGET=@TARGET@
1706 export CPU=@CPU@
1707 export MANUFACTURER=@MANUFACTURER@
1708 export OBJDIR=@PWD@
1709 export BUILDDIR=@PWD@
1710 export LANGUAGE=@LANGUAGE@
1711 export VOICELANGUAGE=@VOICELANGUAGE@
1712 export MEMORYSIZE=@MEMORY@
1713 export VERSION=\$(shell \$(ROOTDIR)/tools/svnversion.sh \$(ROOTDIR))
1714 export BUILDDATE=\$(shell date -u +'-DYEAR=%Y -DMONTH=%m -DDAY=%d')
1715 export MKFIRMWARE=@TOOL@
1716 export BMP2RB_MONO=@BMP2RB_MONO@
1717 export BMP2RB_NATIVE=@BMP2RB_NATIVE@
1718 export BMP2RB_REMOTEMONO=@BMP2RB_REMOTEMONO@
1719 export BMP2RB_REMOTENATIVE=@BMP2RB_REMOTENATIVE@
1720 export BINARY=@OUTPUT@
1721 export APPEXTRA=@APPEXTRA@
1722 export ENABLEDPLUGINS=@PLUGINS@
1723 export SOFTWARECODECS=@CODECS@
1724 export EXTRA_DEFINES=@EXTRADEF@
1725 export HOSTCC=gcc
1726 export CC=@CC@
1727 export LD=@LD@
1728 export AR=@AR@
1729 export AS=@AS@
1730 export OC=@OC@
1731 export WINDRES=@WINDRES@
1732 export DLLTOOL=@DLLTOOL@
1733 export DLLWRAP=@DLLWRAP@
1734 export RANLIB=@RANLIB@
1735 export PROFILE_OPTS=@PROFILE_OPTS@
1736 export SIMVER=@SIMVER@
1737 export SIMDIR=\$(ROOTDIR)/uisimulator/sdl
1738 export GCCOPTS=@GCCOPTS@
1739 export TARGET_INC=@TARGET_INC@
1740 export LOADADDRESS=@LOADADDRESS@
1741 export SHARED_FLAG=@SHARED_FLAG@
1742 export LDOPTS=@LDOPTS@
1743 export GCCVER=@GCCVER@
1744 export GCCNUM=@GCCNUM@
1745 export UNAME=@UNAME@
1746 export MANUALDEV=@MANUALDEV@
1747 export TTS_OPTS=@TTS_OPTS@
1748 export TTS_ENGINE=@TTS_ENGINE@
1749 export ENC_OPTS=@ENC_OPTS@
1750 export ENCODER=@ENCODER@
1752 # Do not print "Entering directory ..."
1753 MAKEFLAGS += --no-print-directory
1755 .PHONY: all clean tags zip tools manual bin build info
1757 all: info
1759 info: build
1760 \$(SILENT)\$(TOOLSDIR)/mkinfo.pl \$(BUILDDIR)/rockbox-info.txt
1762 build: tools
1763 @SIMUL1@
1764 @SIMUL2@
1765 \$(SILENT)\$(MAKE) -C \$(FIRMDIR) OBJDIR=\$(BUILDDIR)/firmware
1766 \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@
1768 bin: tools
1769 @SIMUL1@
1770 @SIMUL2@
1771 \$(SILENT)\$(MAKE) -C \$(FIRMDIR) OBJDIR=\$(BUILDDIR)/firmware
1772 \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@ \$(BUILDDIR)/\$(BINARY)
1774 rocks: tools
1775 \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@ rocks
1777 veryclean: clean toolsclean
1779 toolsclean:
1780 \$(SILENT)\$(MAKE) -C \$(TOOLSDIR) clean
1782 clean:
1783 \$(SILENT)echo Cleaning build directory
1784 \$(SILENT)rm -rf rockbox.zip TAGS @APPS@ firmware comsim sim lang.[ch]\
1785 manual *.pdf *.a credits.raw @OUTPUT@ bitmaps pluginbitmaps \
1786 @ARCHOSROM@ @FLASHFILE@ UI256.bmp rockbox-full.zip \
1787 html txt rockbox-manual*.zip sysfont.h rockbox-info.txt \
1788 voicefontids *.wav *.mp3 *.voice
1790 tools:
1791 \$(SILENT)\$(MAKE) -C \$(TOOLSDIR) CC=\$(HOSTCC) @TOOLSET@
1793 tags:
1794 \$(SILENT)rm -f TAGS
1795 \$(SILENT)\$(MAKE) -C \$(FIRMDIR) tags
1796 \$(SILENT)\$(MAKE) -C \$(APPSDIR) tags
1797 \$(SILENT)\$(MAKE) -C \$(APPSDIR)/plugins tags
1798 \$(SILENT)\$(MAKE) -C \$(APPSDIR)/plugins/lib tags
1800 fontzip:
1801 \$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -r "\$(ROOTDIR)" -f 1 -o rockbox-fonts.zip \$(TARGET) \$(BINARY)
1803 zip:
1804 \$(SILENT)for f in \`cat \$(BUILDDIR)/@APPS@/features\`; do feat="\$\$feat:\$\$f" ; done ; \\
1805 \$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\$\$feat\" -i \"\$(TARGET_ID)\" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
1807 mapzip:
1808 \$(SILENT)find . -name "*.map" | xargs zip rockbox-maps.zip
1810 fullzip:
1811 \$(SILENT)for f in \`cat \$(BUILDDIR)/@APPS@/features\`; do feat="\$\$feat:\$\$f" ; done; \\
1812 \$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\$\$feat\" -i \"\$(TARGET_ID)\" -r "\$(ROOTDIR)" -f 2 -o rockbox-full.zip \$(TARGET) \$(BINARY)
1814 7zip:
1815 \$(SILENT)for f in \`cat \$(BUILDDIR)/@APPS@/features\`; do feat="\$\$feat:\$\$f" ; done; \\
1816 \$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\$\$feat\" -i \"\$(TARGET_ID)\" -o "rockbox.7z" -z "7za a" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
1818 tar:
1819 \$(SILENT)rm -f rockbox.tar
1820 \$(SILENT)for f in \`cat \$(BUILDDIR)/@APPS@/features\`; do feat="\$\$feat:\$\$f" ; done; \\
1821 \$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\$\$feat\" -i \"\$(TARGET_ID)\" -o "rockbox.tar" -z "tar --no-recursion -uf" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
1823 bzip2: tar
1824 \$(SILENT)bzip2 -f9 rockbox.tar
1826 gzip: tar
1827 \$(SILENT)gzip -f9 rockbox.tar
1829 manual: manual-pdf
1830 manual-pdf:
1831 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-pdf
1832 manual-html:
1833 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-html
1834 manual-zhtml: manual-zip
1835 manual-txt:
1836 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-txt
1837 manual-ztxt:
1838 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-txt-zip
1839 manual-zip:
1840 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-zip
1842 features:
1843 \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@ features
1845 help:
1846 @echo "A few helpful make targets"
1847 @echo ""
1848 @echo "all - builds a full Rockbox (default), including tools"
1849 @echo "bin - builds only the Rockbox.<target name> file"
1850 @echo "clean - cleans a build directory (not tools)"
1851 @echo "veryclean - cleans the build and tools directories"
1852 @echo "manual - builds a manual"
1853 @echo "manual-html - HTML manual"
1854 @echo "manual-zip - HTML manual (zipped)"
1855 @echo "manual-txt - txt manual"
1856 @echo "fullzip - creates a rockbox.zip of your build with fonts"
1857 @echo "zip - creates a rockbox.zip of your build (no fonts)"
1858 @echo "gzip - creates a rockbox.tar.gz of your build (no fonts)"
1859 @echo "bzip2 - creates a rockbox.tar.bz2 of your build (no fonts)"
1860 @echo "7zip - creates a rockbox.7z of your build (no fonts)"
1861 @echo "fontzip - creates rockbox-fonts.zip"
1862 @echo "mapzip - creates rockbox-maps.zip with all .map files"
1863 @echo "tools - builds the tools only"
1864 @echo "install - installs your build (for simulator builds only)"
1868 if [ "yes" = "$simulator" ]; then
1870 cat >> Makefile <<EOF
1872 install:
1873 @echo "installing a full setup in your archos dir"
1874 @(\$(MAKE) fullzip && cd archos && unzip -oq ../rockbox-full.zip)
1879 if [ "yes" = "$voice" ]; then
1881 cat >> Makefile <<EOF
1883 voice: tools features
1884 \$(SILENT)for f in \`cat \$(BUILDDIR)/${apps}/features\`; do feat="\$\$feat:\$\$f" ; done ; \\
1885 for lang in \`echo \$(VOICELANGUAGE) |sed "s/,/ /g"\`; do \$(TOOLSDIR)/voice.pl -V -l=\$\$lang -t=\$(ARCHOS)\$\$feat -i=\$(TARGET_ID) -e=\$(ENCODER) -E="\$(ENC_OPTS)" -s=\$(TTS_ENGINE) -S="\$(TTS_OPTS)"; done \\
1890 echo "Created Makefile"