302 is also a valid redirect. Also keep the original query when redirecting.
[Rockbox.git] / tools / configure
blob03182cfde4a30e22460d64fa3f0a42752c50ade0
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 echo "You may enter a comma-separated list of languages to build"
293 picklang
294 voicelanguage=`whichlang`
296 if [ -z "$voicelanguage" ]; then
297 # pick a default
298 voicelanguage="english"
300 echo "Voice language set to $voicelanguage"
302 # Configure encoder and TTS engine for each language
303 for thislang in `echo $voicelanguage | sed 's/,/ /g'`; do
304 voiceconfig "$thislang"
305 done
307 if [ "yes" = "$use_debug" ]; then
308 debug="-DDEBUG"
309 GCCOPTS="$GCCOPTS -g -DDEBUG"
311 if [ "yes" = "$logf" ]; then
312 use_logf="#define ROCKBOX_HAS_LOGF 1"
314 if [ "yes" = "$simulator" ]; then
315 debug="-DDEBUG"
316 extradefines="$extradefines -DSIMULATOR"
318 if [ "yes" = "$profile" ]; then
319 extradefines="$extradefines -DRB_PROFILE"
320 PROFILE_OPTS="-finstrument-functions"
324 # Configure voice settings
325 voiceconfig () {
326 thislang=$1
327 echo "Building $thislang voice for $archos. Select options"
328 echo ""
330 if [ -f "`which flite`" ]; then
331 FLITE="F(l)ite "
332 FLITE_OPTS="FLITE_OPTS=\"\""
333 DEFAULT_TTS="flite"
334 DEFAULT_TTS_OPTS=$FLITE_OPTS
335 DEFAULT_NOISEFLOOR="500"
336 DEFAULT_CHOICE="L"
338 if [ -f "`which espeak`" ]; then
339 ESPEAK="(e)Speak "
340 ESPEAK_OPTS="ESPEAK_OPTS=\"\""
341 DEFAULT_TTS="espeak"
342 DEFAULT_TTS_OPTS=$ESPEAK_OPTS
343 DEFAULT_NOISEFLOOR="500"
344 DEFAULT_CHOICE="e"
346 if [ -f "`which festival`" ]; then
347 FESTIVAL="(F)estival "
348 FESTIVAL_OPTS="FESTIVAL_OPTS=\"\""
349 DEFAULT_TTS="festival"
350 DEFAULT_TTS_OPTS=$FESTIVAL_OPTS
351 DEFAULT_NOISEFLOOR="500"
352 DEFAULT_CHOICE="F"
354 # Allow SAPI if Windows is in use
355 if [ -f "`which winver`" ]; then
356 SAPI5="(S)API5 "
357 SAPI5_OPTS="SAPI5_OPTS=\"\""
358 DEFAULT_TTS="sapi5"
359 DEFAULT_TTS_OPTS=$SAPI5_OPTS
360 DEFAULT_NOISEFLOOR="500"
361 DEFAULT_CHOICE="S"
364 if [ "$FESTIVAL" = "$FLITE" ] && [ "$FLITE" = "$ESPEAK" ] && [ "$ESPEAK" = "$SAPI5" ]; then
365 echo "You need Festival, eSpeak or Flite in your path, or SAPI5 available to build voice files"
366 exit
369 echo "TTS engine to use: ${FLITE}${FESTIVAL}${ESPEAK}${SAPI5}(${DEFAULT_CHOICE})?"
370 option=`input`
371 case "$option" in
372 [Ll])
373 TTS_ENGINE="flite"
374 NOISEFLOOR="500" # TODO: check this value
375 TTS_OPTS=$FLITE_OPTS
377 [Ee])
378 TTS_ENGINE="espeak"
379 NOISEFLOOR="500"
380 TTS_OPTS=$ESPEAK_OPTS
382 [Ff])
383 TTS_ENGINE="festival"
384 NOISEFLOOR="500"
385 TTS_OPTS=$FESTIVAL_OPTS
387 [Ss])
388 TTS_ENGINE="sapi5"
389 NOISEFLOOR="500"
390 TTS_OPTS=$SAPI5_OPTS
393 TTS_ENGINE=$DEFAULT_TTS
394 TTS_OPTS=$DEFAULT_TTS_OPTS
395 NOISEFLOOR=$DEFAULT_NOISEFLOOR
396 esac
397 echo "Using $TTS_ENGINE for TTS"
399 # Allow the user to input manual commandline options
400 printf "Enter $TTS_ENGINE options (enter for defaults `echo $TTS_OPTS |sed 's/.*=//'`): "
401 USER_TTS_OPTS=`input`
402 if [ -n "$USER_TTS_OPTS" ]; then
403 TTS_OPTS="`echo $TTS_OPTS | sed 's/=.*//'`=\"$USER_TTS_OPTS\""
406 echo ""
408 if [ -f "`which oggenc`" ]; then
409 OGGENC="(O)ggenc "
410 DEFAULT_ENC="oggenc"
411 VORBIS_OPTS="VORBIS_OPTS=\"-q0 --downmix\""
412 DEFAULT_ENC_OPTS=$VORBIS_OPTS
413 DEFAULT_CHOICE="O"
415 if [ -f "`which speexenc`" ]; then
416 SPEEXENC="(S)peexenc "
417 DEFAULT_ENC="speexenc"
418 SPEEX_OPTS="" # TODO: find appropriate options for speex
419 DEFAULT_ENC_OPTS=$SPEEX_OPTS
420 DEFAULT_CHOICE="S"
422 if [ -f "`which lame`" ]; then
423 LAME="(L)ame "
424 DEFAULT_ENC="lame"
425 LAME_OPTS="LAME_OPTS=\"--resample 12 -t -m m -h -V 9 -S\""
426 DEFAULT_ENC_OPTS=$LAME_OPTS
427 DEFAULT_CHOICE="L"
430 if [ "$LAME" = "" ]; then
431 echo "You currently need to have Lame installed to build voice files"
434 # echo "Encoder to use: ${LAME}${OGGENC}${SPEEXENC}(${DEFAULT_CHOICE})?"
435 # echo ""
436 # echo "Note: Use Lame - the other options won't work"
437 # option=`input`
438 option="l"
439 case "$option" in
440 [Oo])
441 ENCODER="oggenc"
442 ENC_OPTS=$VORBIS_OPTS
444 [Ss])
445 ENCODER="speexenc"
446 ENC_OPTS=$SPEEX_OPTS
448 [Ll])
449 ENCODER="lame"
450 ENC_OPTS=$LAME_OPTS
453 ENCODER=$DEFAULT_ENC
454 ENC_OPTS=$DEFAULT_ENC_OPTS
455 esac
456 echo "Using $ENCODER for encoding voice clips"
458 # Allow the user to input manual commandline options
459 printf "Enter $ENCODER options (enter for defaults `echo $ENC_OPTS |sed 's/.*=//'`): "
460 USER_ENC_OPTS=`input`
461 if [ -n "$USER_ENC_OPTS" ]; then
462 ENC_OPTS="`echo $ENC_OPTS | sed 's/=.*//'`=\"$USER_ENC_OPTS\""
465 TEMPDIR="${pwd}"
466 if [ -f "`which cygpath`" ]; then
467 TEMPDIR=`cygpath . -a -w`
470 cat > voicesettings-$thislang.sh <<EOF
471 TTS_ENGINE="${TTS_ENGINE}"
472 ENCODER="${ENCODER}"
473 TEMPDIR="$TEMPDIR"
474 NOISEFLOOR="${NOISEFLOOR}"
475 ${TTS_OPTS}
476 ${ENC_OPTS}
480 picklang() {
481 # figure out which languages that are around
482 for file in $rootdir/apps/lang/*.lang; do
483 clean=`echo $file | sed -e 's:.*/::g' | cut "-d." -f1`
484 langs="$langs $clean"
485 done
487 num=1
488 for one in $langs; do
489 echo "$num. $one"
490 num=`expr $num + 1`
491 done
493 read pick
496 whichlang() {
497 output=""
498 # Allow the user to pass a comma-separated list of langauges
499 for thispick in `echo $pick | sed 's/,/ /g'`; do
500 num=1
501 for one in $langs; do
502 # Accept both the language number and name
503 if [ "$num" = "$thispick" ] || [ "$thispick" = "$one" ]; then
504 if [ "$output" = "" ]; then
505 output=$one
506 else
507 output=$output,$one
510 num=`expr $num + 1`
511 done
512 done
513 echo $output
516 opt=$1
518 if test "$opt" = "--help"; then
519 echo "Rockbox configure script."
520 echo "Invoke this in a directory to generate a Makefile to build Rockbox"
521 echo "Do *NOT* run this within the tools directory!"
522 echo ""
523 echo "Usage: configure [--ccache][--no-ccache]"
524 exit
527 if test -r "configure"; then
528 # this is a check for a configure script in the current directory, it there
529 # is one, try to figure out if it is this one!
531 if { grep "^# Jukebox" configure >/dev/null 2>&1 ; } then
532 echo "WEEEEEEEEP. Don't run this configure script within the tools directory."
533 echo "It will only cause you pain and grief. Instead do this:"
534 echo ""
535 echo " cd .."
536 echo " mkdir build-dir"
537 echo " cd build-dir"
538 echo " ../tools/configure"
539 echo ""
540 echo "Much happiness will arise from this. Enjoy"
541 exit
545 # get our current directory
546 pwd=`pwd`;
548 if { echo $pwd | grep " "; } then
549 echo "You're running this script in a path that contains space. The build"
550 echo "system is unfortunately not clever enough to deal with this. Please"
551 echo "run the script from a different path, rename the path or fix the build"
552 echo "system!"
553 exit
556 if [ -z "$rootdir" ]; then
557 ##################################################################
558 # Figure out where the source code root is!
560 rootdir=`dirname $0`/../
562 #####################################################################
563 # Convert the possibly relative directory name to an absolute version
565 now=`pwd`
566 cd $rootdir
567 rootdir=`pwd`
569 # cd back to the build dir
570 cd $now
573 apps="apps"
574 appsdir='\$(ROOTDIR)/apps'
575 firmdir='\$(ROOTDIR)/firmware'
576 toolsdir='\$(ROOTDIR)/tools'
579 ##################################################################
580 # Figure out target platform
583 echo "Enter target platform:"
584 cat <<EOF
585 ==Archos== ==iriver== ==Apple iPod==
586 0) Player/Studio 10) H120/H140 20) Color/Photo
587 1) Recorder 11) H320/H340 21) Nano
588 2) FM Recorder 12) iHP-100/110/115 22) Video
589 3) Recorder v2 13) iFP-790 23) 3G
590 4) Ondio SP 14) H10 20Gb 24) 4G Grayscale
591 5) Ondio FM 15) H10 5/6Gb 25) Mini 1G
592 6) AV300 26) Mini 2G
593 27) 1G, 2G
595 ==iAudio== ==Toshiba== ==SanDisk==
596 30) X5/X5V/X5L 40) Gigabeat F 50) Sansa e200
597 31) M5/M5L 51) Sansa e200R
599 ==Tatung==
600 60) Elio TPJ-1022
603 buildfor=`input`;
605 # Set of tools built for all target platforms:
606 toolset="rdf2binary convbdf codepages"
608 # Toolsets for some target families:
609 archosbitmaptools="$toolset scramble descramble sh2d uclpack bmp2rb"
610 iriverbitmaptools="$toolset scramble descramble mkboot bmp2rb"
611 iaudiobitmaptools="$toolset scramble descramble mkboot bmp2rb"
612 ipodbitmaptools="$toolset scramble ipod_fw bmp2rb codepages"
613 gigabeatbitmaptools="$toolset scramble descramble bmp2rb"
614 # generic is used by IFP, H10, Sansa-e200
615 genericbitmaptools="$toolset bmp2rb"
618 # ---- For each target ----
620 # *Variables*
621 # target_id: a unique number identifying this target, DOES NOT necessarily
622 # have to be the menu number. Just use the currently highest
623 # number+1 when you add a new target.
624 # archos: short model name used all over to identify this target
625 # memory: number of megabytes of RAM this target has. If the amount can
626 # be selected by the size prompt, let memory be unset here
627 # target: -Ddefine passed to the build commands to make the correct
628 # config-*.h file get included etc
629 # tool: the tool that takes a plain binary and converts that into a
630 # working "firmware" file for your target
631 # output: the final output file name
632 # boottool: the tool that takes a plain binary and generates a bootloader
633 # file for your target (or blank to use $tool)
634 # bootoutput:the final output file name for the bootloader (or blank to use
635 # $output)
636 # appextra: passed to the APPEXTRA variable in the Makefiles.
637 # TODO: add proper explanation
638 # archosrom: used only for Archos targets that build a special flashable .ucl
639 # image. Set to blank for other builds.
640 # flash: the same as archosrom. These two should be merged
641 # plugins: set to 'yes' to build the plugins. Early development builds can
642 # set this to no in the early stages to have an easier life for a
643 # while
644 # swcodec: set 'yes' on swcodec targets
645 # toolset: lists what particular tools in the tools/ directory that this
646 # target needs to have built prior to building Rockbox
648 # *Functions*
649 # *cc: sets up gcc and compiler options for your target builds. Note
650 # that if you select a simulator build, the compiler selection is
651 # overridden later in the script.
653 case $buildfor in
655 0|player)
656 target_id=1
657 archos="player"
658 target="-DARCHOS_PLAYER"
659 shcc
660 tool="$rootdir/tools/scramble"
661 output="archos.mod"
662 appextra="player:gui"
663 archosrom="$pwd/rombox.ucl"
664 flash="$pwd/rockbox.ucl"
665 plugins="yes"
666 swcodec=""
668 # toolset is the tools within the tools directory that we build for
669 # this particular target.
670 toolset="$toolset scramble descramble sh2d player_unifont uclpack"
672 # Note: the convbdf is present in the toolset just because: 1) the
673 # firmware/Makefile assumes it is present always, and 2) we will need it when we
674 # build the player simulator
676 t_cpu="sh"
677 t_manufacturer="archos"
678 t_model="player"
681 1|recorder)
682 target_id=2
683 archos="recorder"
684 target="-DARCHOS_RECORDER"
685 shcc
686 tool="$rootdir/tools/scramble"
687 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
688 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
689 output="ajbrec.ajz"
690 appextra="recorder:gui"
691 archosrom="" #"$pwd/rombox.ucl"
692 flash="$pwd/rockbox.ucl"
693 plugins="yes"
694 swcodec=""
695 # toolset is the tools within the tools directory that we build for
696 # this particular target.
697 toolset=$archosbitmaptools
698 t_cpu="sh"
699 t_manufacturer="archos"
700 t_model="recorder"
703 2|fmrecorder)
704 target_id=3
705 archos="fmrecorder"
706 target="-DARCHOS_FMRECORDER"
707 shcc
708 tool="$rootdir/tools/scramble -fm"
709 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
710 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
711 output="ajbrec.ajz"
712 appextra="recorder:gui"
713 archosrom="" #"$pwd/rombox.ucl"
714 flash="$pwd/rockbox.ucl"
715 plugins="yes"
716 swcodec=""
717 # toolset is the tools within the tools directory that we build for
718 # this particular target.
719 toolset=$archosbitmaptools
720 t_cpu="sh"
721 t_manufacturer="archos"
722 t_model="fm_v2"
725 3|recorderv2)
726 target_id=4
727 archos="recorderv2"
728 target="-DARCHOS_RECORDERV2"
729 shcc
730 tool="$rootdir/tools/scramble -v2"
731 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
732 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
733 output="ajbrec.ajz"
734 appextra="recorder:gui"
735 archosrom="" #"$pwd/rombox.ucl"
736 flash="$pwd/rockbox.ucl"
737 plugins="yes"
738 swcodec=""
739 # toolset is the tools within the tools directory that we build for
740 # this particular target.
741 toolset=$archosbitmaptools
742 t_cpu="sh"
743 t_manufacturer="archos"
744 t_model="fm_v2"
747 4|ondiosp)
748 target_id=7
749 archos="ondiosp"
750 target="-DARCHOS_ONDIOSP"
751 shcc
752 tool="$rootdir/tools/scramble -osp"
753 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
754 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
755 output="ajbrec.ajz"
756 appextra="recorder:gui"
757 archosrom="$pwd/rombox.ucl"
758 flash="$pwd/rockbox.ucl"
759 plugins="yes"
760 swcodec=""
761 # toolset is the tools within the tools directory that we build for
762 # this particular target.
763 toolset=$archosbitmaptools
764 t_cpu="sh"
765 t_manufacturer="archos"
766 t_model="ondio"
769 5|ondiofm)
770 target_id=8
771 archos="ondiofm"
772 target="-DARCHOS_ONDIOFM"
773 shcc
774 tool="$rootdir/tools/scramble -ofm"
775 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
776 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
777 output="ajbrec.ajz"
778 appextra="recorder:gui"
779 archosrom="" #"$pwd/rombox.ucl"
780 flash="$pwd/rockbox.ucl"
781 plugins="yes"
782 swcodec=""
783 toolset=$archosbitmaptools
784 t_cpu="sh"
785 t_manufacturer="archos"
786 t_model="ondio"
789 6|av300)
790 target_id=26
791 archos="av300"
792 target="-DARCHOS_AV300"
793 memory=16 # always
794 arm7tdmicc
795 tool="$rootdir/tools/scramble -mm=C"
796 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
797 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
798 output="cjbm.ajz"
799 appextra="recorder:gui"
800 archosrom=""
801 flash=""
802 plugins="yes"
803 swcodec=""
804 # toolset is the tools within the tools directory that we build for
805 # this particular target.
806 toolset="$toolset scramble descramble bmp2rb codepages"
807 # architecture, manufacturer and model for the target-tree build
808 t_cpu="arm"
809 t_manufacturer="archos"
810 t_model="av300"
813 10|h120)
814 target_id=9
815 archos="h120"
816 target="-DIRIVER_H120"
817 memory=32 # always
818 coldfirecc
819 tool="$rootdir/tools/scramble -add=h120"
820 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
821 bmp2rb_native="$rootdir/tools/bmp2rb -f 2"
822 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
823 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
824 output="rockbox.iriver"
825 appextra="recorder:gui"
826 archosrom=""
827 flash="$pwd/rombox.iriver"
828 plugins="yes"
829 swcodec="yes"
830 # toolset is the tools within the tools directory that we build for
831 # this particular target.
832 toolset=$iriverbitmaptools
833 t_cpu="coldfire"
834 t_manufacturer="iriver"
835 t_model="h100"
838 11|h300)
839 target_id=10
840 archos="h300"
841 target="-DIRIVER_H300"
842 memory=32 # always
843 coldfirecc
844 tool="$rootdir/tools/scramble -add=h300"
845 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
846 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
847 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
848 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
849 output="rockbox.iriver"
850 appextra="recorder:gui"
851 archosrom=""
852 flash=""
853 plugins="yes"
854 swcodec="yes"
855 # toolset is the tools within the tools directory that we build for
856 # this particular target.
857 toolset=$iriverbitmaptools
858 t_cpu="coldfire"
859 t_manufacturer="iriver"
860 t_model="h300"
863 12|h100)
864 target_id=11
865 archos="h100"
866 target="-DIRIVER_H100"
867 memory=16 # always
868 coldfirecc
869 tool="$rootdir/tools/scramble -add=h100"
870 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
871 bmp2rb_native="$rootdir/tools/bmp2rb -f 2"
872 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
873 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
874 output="rockbox.iriver"
875 appextra="recorder:gui"
876 archosrom=""
877 flash=""
878 plugins="yes"
879 swcodec="yes"
880 # toolset is the tools within the tools directory that we build for
881 # this particular target.
882 toolset=$iriverbitmaptools
883 t_cpu="coldfire"
884 t_manufacturer="iriver"
885 t_model="h100"
888 13|ifp7xx)
889 target_id=19
890 archos="ifp7xx"
891 target="-DIRIVER_IFP7XX"
892 memory=1
893 arm7tdmicc short
894 tool="cp"
895 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
896 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
897 output="rockbox.wma"
898 appextra="recorder:gui"
899 archosrom=""
900 flash=""
901 plugins="yes"
902 swcodec="yes"
903 # toolset is the tools within the tools directory that we build for
904 # this particular target.
905 toolset=$genericbitmaptools
906 t_cpu="arm"
907 t_manufacturer="pnx0101"
908 t_model="iriver-ifp7xx"
911 14|h10)
912 target_id=22
913 archos="h10"
914 target="-DIRIVER_H10"
915 memory=32 # always
916 arm7tdmicc
917 tool="$rootdir/tools/scramble -mi4v3 -model=h10 -type=RBOS"
918 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
919 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
920 output="rockbox.mi4"
921 appextra="recorder:gui"
922 archosrom=""
923 flash=""
924 plugins="yes"
925 swcodec="yes"
926 boottool="$rootdir/tools/scramble -mi4v3 -model=h10 -type=RBBL"
927 bootoutput="H10_20GC.mi4"
928 # toolset is the tools within the tools directory that we build for
929 # this particular target.
930 toolset="$genericbitmaptools scramble"
931 # architecture, manufacturer and model for the target-tree build
932 t_cpu="arm"
933 t_manufacturer="iriver"
934 t_model="h10"
937 15|h10_5gb)
938 target_id=24
939 archos="h10_5gb"
940 target="-DIRIVER_H10_5GB"
941 memory=32 # always
942 arm7tdmicc
943 tool="$rootdir/tools/scramble -mi4v2 -model=h105 -type=RBOS"
944 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
945 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
946 output="rockbox.mi4"
947 appextra="recorder:gui"
948 archosrom=""
949 flash=""
950 plugins="yes"
951 swcodec="yes"
952 boottool="$rootdir/tools/scramble -mi4v2 -model=h105 -type=RBBL"
953 bootoutput="H10.mi4"
954 # toolset is the tools within the tools directory that we build for
955 # this particular target.
956 toolset="$genericbitmaptools scramble"
957 # architecture, manufacturer and model for the target-tree build
958 t_cpu="arm"
959 t_manufacturer="iriver"
960 t_model="h10"
963 20|ipodcolor)
964 target_id=13
965 archos="ipodcolor"
966 target="-DIPOD_COLOR"
967 memory=32 # always
968 arm7tdmicc
969 tool="$rootdir/tools/scramble -add=ipco"
970 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
971 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
972 output="rockbox.ipod"
973 appextra="recorder:gui"
974 archosrom=""
975 flash=""
976 plugins="yes"
977 swcodec="yes"
978 bootoutput="bootloader-$archos.ipod"
979 # toolset is the tools within the tools directory that we build for
980 # this particular target.
981 toolset=$ipodbitmaptools
982 # architecture, manufacturer and model for the target-tree build
983 t_cpu="arm"
984 t_manufacturer="ipod"
985 t_model="color"
988 21|ipodnano)
989 target_id=14
990 archos="ipodnano"
991 target="-DIPOD_NANO"
992 memory=32 # always
993 arm7tdmicc
994 tool="$rootdir/tools/scramble -add=nano"
995 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
996 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
997 output="rockbox.ipod"
998 appextra="recorder:gui"
999 archosrom=""
1000 flash=""
1001 plugins="yes"
1002 swcodec="yes"
1003 bootoutput="bootloader-$archos.ipod"
1004 # toolset is the tools within the tools directory that we build for
1005 # this particular target.
1006 toolset=$ipodbitmaptools
1007 # architecture, manufacturer and model for the target-tree build
1008 t_cpu="arm"
1009 t_manufacturer="ipod"
1010 t_model="nano"
1013 22|ipodvideo)
1014 target_id=15
1015 archos="ipodvideo"
1016 target="-DIPOD_VIDEO"
1017 arm7tdmicc
1018 tool="$rootdir/tools/scramble -add=ipvd"
1019 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1020 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1021 output="rockbox.ipod"
1022 appextra="recorder:gui"
1023 archosrom=""
1024 flash=""
1025 plugins="yes"
1026 swcodec="yes"
1027 bootoutput="bootloader-$archos.ipod"
1028 # toolset is the tools within the tools directory that we build for
1029 # this particular target.
1030 toolset=$ipodbitmaptools
1031 # architecture, manufacturer and model for the target-tree build
1032 t_cpu="arm"
1033 t_manufacturer="ipod"
1034 t_model="video"
1037 23|ipod3g)
1038 target_id=16
1039 archos="ipod3g"
1040 target="-DIPOD_3G"
1041 memory=32 # always
1042 arm7tdmicc
1043 tool="$rootdir/tools/scramble -add=ip3g"
1044 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1045 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1046 output="rockbox.ipod"
1047 appextra="recorder:gui"
1048 archosrom=""
1049 flash=""
1050 plugins="yes"
1051 swcodec="yes"
1052 bootoutput="bootloader-$archos.ipod"
1053 # toolset is the tools within the tools directory that we build for
1054 # this particular target.
1055 toolset=$ipodbitmaptools
1056 # architecture, manufacturer and model for the target-tree build
1057 t_cpu="arm"
1058 t_manufacturer="ipod"
1059 t_model="3g"
1062 24|ipod4g)
1063 target_id=17
1064 archos="ipod4g"
1065 target="-DIPOD_4G"
1066 memory=32 # always
1067 arm7tdmicc
1068 tool="$rootdir/tools/scramble -add=ip4g"
1069 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1070 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1071 output="rockbox.ipod"
1072 appextra="recorder:gui"
1073 archosrom=""
1074 flash=""
1075 plugins="yes"
1076 swcodec="yes"
1077 bootoutput="bootloader-$archos.ipod"
1078 # toolset is the tools within the tools directory that we build for
1079 # this particular target.
1080 toolset=$ipodbitmaptools
1081 # architecture, manufacturer and model for the target-tree build
1082 t_cpu="arm"
1083 t_manufacturer="ipod"
1084 t_model="4g"
1087 25|ipodmini)
1088 target_id=18
1089 archos="ipodmini"
1090 target="-DIPOD_MINI"
1091 memory=32 # always
1092 arm7tdmicc
1093 tool="$rootdir/tools/scramble -add=mini"
1094 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1095 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1096 output="rockbox.ipod"
1097 appextra="recorder:gui"
1098 archosrom=""
1099 flash=""
1100 plugins="yes"
1101 swcodec="yes"
1102 bootoutput="bootloader-$archos.ipod"
1103 # toolset is the tools within the tools directory that we build for
1104 # this particular target.
1105 toolset=$ipodbitmaptools
1106 # architecture, manufacturer and model for the target-tree build
1107 t_cpu="arm"
1108 t_manufacturer="ipod"
1109 t_model="mini"
1112 26|ipodmini2g)
1113 target_id=21
1114 archos="ipodmini2g"
1115 target="-DIPOD_MINI2G"
1116 memory=32 # always
1117 arm7tdmicc
1118 tool="$rootdir/tools/scramble -add=mn2g"
1119 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1120 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1121 output="rockbox.ipod"
1122 appextra="recorder:gui"
1123 archosrom=""
1124 flash=""
1125 plugins="yes"
1126 swcodec="yes"
1127 bootoutput="bootloader-$archos.ipod"
1128 # toolset is the tools within the tools directory that we build for
1129 # this particular target.
1130 toolset=$ipodbitmaptools
1131 # architecture, manufacturer and model for the target-tree build
1132 t_cpu="arm"
1133 t_manufacturer="ipod"
1134 t_model="mini2g"
1137 27|ipod1g2g)
1138 target_id=29
1139 archos="ipod1g2g"
1140 target="-DIPOD_1G2G"
1141 memory=32 # always
1142 arm7tdmicc
1143 tool="$rootdir/tools/scramble -add=1g2g"
1144 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1145 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1146 output="rockbox.ipod"
1147 appextra="recorder:gui"
1148 archosrom=""
1149 flash=""
1150 plugins="yes"
1151 swcodec="yes"
1152 bootoutput="bootloader-$archos.ipod"
1153 # toolset is the tools within the tools directory that we build for
1154 # this particular target.
1155 toolset=$ipodbitmaptools
1156 # architecture, manufacturer and model for the target-tree build
1157 t_cpu="arm"
1158 t_manufacturer="ipod"
1159 t_model="1g2g"
1162 30|x5)
1163 target_id=12
1164 archos="x5"
1165 target="-DIAUDIO_X5"
1166 memory=16 # always
1167 coldfirecc
1168 tool="$rootdir/tools/scramble -add=iax5"
1169 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1170 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1171 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
1172 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 7"
1173 output="rockbox.iaudio"
1174 appextra="recorder:gui"
1175 archosrom=""
1176 flash=""
1177 plugins="yes"
1178 swcodec="yes"
1179 # toolset is the tools within the tools directory that we build for
1180 # this particular target.
1181 toolset="$iaudiobitmaptools"
1182 # architecture, manufacturer and model for the target-tree build
1183 t_cpu="coldfire"
1184 t_manufacturer="iaudio"
1185 t_model="x5"
1188 31|m5)
1189 target_id=28
1190 archos="m5"
1191 target="-DIAUDIO_M5"
1192 memory=16 # always
1193 coldfirecc
1194 tool="$rootdir/tools/scramble -add=iam5"
1195 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1196 bmp2rb_native="$rootdir/tools/bmp2rb -f 2"
1197 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
1198 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 7"
1199 output="rockbox.iaudio"
1200 appextra="recorder:gui"
1201 archosrom=""
1202 flash=""
1203 plugins="yes"
1204 swcodec="yes"
1205 # toolset is the tools within the tools directory that we build for
1206 # this particular target.
1207 toolset="$iaudiobitmaptools"
1208 # architecture, manufacturer and model for the target-tree build
1209 t_cpu="coldfire"
1210 t_manufacturer="iaudio"
1211 t_model="m5"
1214 40|gigabeatf)
1215 target_id=20
1216 archos="gigabeatf"
1217 target="-DGIGABEAT_F"
1218 memory=32 # always
1219 arm9tdmicc
1220 tool="$rootdir/tools/scramble -add=giga"
1221 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1222 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1223 output="rockbox.gigabeat"
1224 appextra="recorder:gui"
1225 archosrom=""
1226 flash=""
1227 plugins="yes"
1228 swcodec="yes"
1229 toolset=$gigabeatbitmaptools
1230 boottool="$rootdir/tools/scramble -gigabeat"
1231 bootoutput="FWIMG01.DAT"
1232 # architecture, manufacturer and model for the target-tree build
1233 t_cpu="arm"
1234 t_manufacturer="s3c2440"
1235 t_model="gigabeat-fx"
1238 50|e200)
1239 target_id=23
1240 archos="e200"
1241 target="-DSANSA_E200"
1242 memory=32 # supposedly
1243 arm7tdmicc
1244 tool="$rootdir/tools/scramble -mi4v3 -model=e200 -type=RBOS"
1245 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1246 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1247 output="rockbox.mi4"
1248 appextra="recorder:gui"
1249 archosrom=""
1250 flash=""
1251 plugins="yes"
1252 swcodec="yes"
1253 boottool="$rootdir/tools/scramble -mi4v3 -model=e200 -type=RBBL"
1254 bootoutput="PP5022.mi4"
1255 # toolset is the tools within the tools directory that we build for
1256 # this particular target.
1257 toolset="$genericbitmaptools scramble"
1258 # architecture, manufacturer and model for the target-tree build
1259 t_cpu="arm"
1260 t_manufacturer="sandisk"
1261 t_model="sansa-e200"
1264 51|e200r)
1265 # the e200R model is pretty much identical to the e200, it only has a
1266 # different option to the scramble tool when building a bootloader and
1267 # makes the bootloader output file name in all lower case.
1268 target_id=27
1269 archos="e200r"
1270 target="-DSANSA_E200"
1271 memory=32 # supposedly
1272 arm7tdmicc
1273 tool="$rootdir/tools/scramble -mi4v3 -model=e20r -type=RBOS"
1274 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1275 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1276 output="rockbox.mi4"
1277 appextra="recorder:gui"
1278 archosrom=""
1279 flash=""
1280 plugins="yes"
1281 swcodec="yes"
1282 boottool="$rootdir/tools/scramble -mi4r -model=e20r -type=RBBL"
1283 bootoutput="pp5022.mi4"
1284 # toolset is the tools within the tools directory that we build for
1285 # this particular target.
1286 toolset="$genericbitmaptools scramble"
1287 # architecture, manufacturer and model for the target-tree build
1288 t_cpu="arm"
1289 t_manufacturer="sandisk"
1290 t_model="sansa-e200"
1293 60|tpj1022)
1294 target_id=25
1295 archos="tpj1022"
1296 target="-DELIO_TPJ1022"
1297 memory=32 # always
1298 arm7tdmicc
1299 tool="$rootdir/tools/scramble -add tpj2"
1300 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1301 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
1302 output="rockbox.elio"
1303 appextra="recorder:gui"
1304 archosrom=""
1305 flash=""
1306 plugins="yes"
1307 swcodec="yes"
1308 boottool="$rootdir/tools/scramble -mi4v2"
1309 bootoutput="pp5020.mi4"
1310 # toolset is the tools within the tools directory that we build for
1311 # this particular target.
1312 toolset="$genericbitmaptools scramble"
1313 # architecture, manufacturer and model for the target-tree build
1314 t_cpu="arm"
1315 t_manufacturer="tatung"
1316 t_model="tpj1022"
1320 echo "Please select a supported target platform!"
1321 exit
1324 esac
1326 echo "Platform set to $archos"
1329 #remove start
1330 ############################################################################
1331 # Amount of memory, for those that can differ. They have $memory unset at
1332 # this point.
1335 if [ -z "$memory" ]; then
1337 case $target_id in
1339 echo "Enter size of your RAM (in MB): (Defaults to 32)"
1340 size=`input`;
1341 case $size in
1342 60|64)
1343 memory="64"
1346 memory="32"
1348 esac
1352 echo "Enter size of your RAM (in MB): (defaults to 2)"
1353 size=`input`;
1354 case $size in
1356 memory="8"
1359 memory="2"
1361 esac
1363 esac
1365 echo "Memory size selected: $memory MB"
1367 #remove end
1369 ##################################################################
1370 # Figure out build "type"
1373 # the ifp7x0 is the only platform that supports building a gdb stub like
1374 # this
1375 case $archos in
1376 ifp7xx)
1377 gdbstub="(G)DB stub, "
1381 esac
1383 echo ""
1384 echo "Build (N)ormal, (A)dvanced, (S)imulator, (B)ootloader, $gdbstub(M)anual (N)"
1386 option=`input`;
1388 case $option in
1389 [Bb])
1390 if test $t_manufacturer = "archos"; then
1391 # Archos SH-based players do this somewhat differently for
1392 # some reason
1393 appsdir='\$(ROOTDIR)/flash/bootbox'
1394 apps="bootbox"
1395 else
1396 appsdir='\$(ROOTDIR)/bootloader'
1397 apps="bootloader"
1398 flash=""
1399 if test -n "$boottool"; then
1400 tool="$boottool"
1402 if test -n "$bootoutput"; then
1403 output=$bootoutput
1406 extradefines="-DBOOTLOADER -ffunction-sections -fdata-sections"
1407 bootloader="1"
1408 echo "Bootloader build selected"
1410 [Ss])
1411 debug="-DDEBUG"
1412 simulator="yes"
1413 extradefines="-DSIMULATOR"
1414 echo "Simulator build selected"
1416 [Aa])
1417 echo "Advanced build selected"
1418 whichadvanced
1420 [Gg])
1421 extradefines="-DSTUB" # for target makefile symbol EXTRA_DEFINES
1422 appsdir='\$(ROOTDIR)/gdb'
1423 apps="stub"
1424 case $archos in
1425 ifp7xx)
1426 output="stub.wma"
1430 esac
1431 echo "GDB stub build selected"
1433 [Mm])
1434 appsdir='\$(ROOTDIR)/manual'
1435 firmdir='\$(ROOTDIR)/manual/platform' # No Makefile here. Effectively ignores target
1436 toolsdir=$firmdir;
1437 toolset='';
1438 apps="manual"
1439 echo "Manual build selected"
1442 debug=""
1443 echo "Normal build selected"
1446 esac
1447 # to be able running "make manual" from non-manual configuration
1448 case $archos in
1449 fmrecorder)
1450 manualdev="recorderv2fm"
1452 recorderv2)
1453 manualdev="recorderv2fm"
1455 h1??)
1456 manualdev="h1xx"
1458 ipodmini2g)
1459 manualdev="ipodmini"
1462 manualdev=$archos
1464 esac
1466 if [ -z "$debug" ]; then
1467 GCCOPTS="$GCCOPTS $GCCOPTIMIZE"
1470 echo "Using source code root directory: $rootdir"
1472 # this was once possible to change at build-time, but no more:
1473 language="english"
1475 uname=`uname`
1477 if [ "yes" = "$simulator" ]; then
1478 # setup compiler and things for simulator
1479 simcc
1481 if [ -d "archos" ]; then
1482 echo "sub directory archos already present"
1483 else
1484 mkdir archos
1485 echo "created an archos subdirectory for simulating the hard disk"
1489 # Now, figure out version number of the (gcc) compiler we are about to use
1490 gccver=`$CC -dumpversion`;
1492 if [ -z "$gccver" ]; then
1493 echo "WARNING: The compiler you must use ($CC) is not in your path!"
1494 echo "WARNING: this may cause your build to fail since we cannot do the"
1495 echo "WARNING: checks we want now."
1496 else
1498 # gccver should now be "3.3.5", "3.4.3", "2.95.3-6" and similar, but don't
1499 # DEPEND on it
1501 num1=`echo $gccver | cut -d . -f1`
1502 num2=`echo $gccver | cut -d . -f2`
1503 gccnum=`(expr $num1 "*" 100 + $num2) 2>/dev/null`
1505 # This makes:
1506 # 3.3.X => 303
1507 # 3.4.X => 304
1508 # 2.95.3 => 295
1510 echo "Using $CC $gccver ($gccnum)"
1512 if test "$gccnum" -ge "400"; then
1513 # gcc 4.0 is just *so* much pickier on arguments that differ in signedness
1514 # so we ignore that warnings for now
1515 # -Wno-pointer-sign
1516 GCCOPTS="$GCCOPTS -Wno-pointer-sign"
1519 if test "$gccnum" -ge "401"; then
1520 # this is a lame hack to avoid "warning: dereferencing type-punned pointer
1521 # will break strict-aliasing rules"
1523 GCCOPTS="$GCCOPTS -fno-strict-aliasing"
1528 # check the compiler for SH platforms
1529 if test "$CC" = "sh-elf-gcc"; then
1530 if test "$gccnum" -lt "400"; then
1531 echo "WARNING: Consider upgrading your compiler to the 4.0.X series!"
1532 echo "WARNING: http://www.rockbox.org/twiki/bin/view/Main/CrossCompiler"
1533 else
1534 # figure out patch status
1535 gccpatch=`$CC --version`;
1537 if { echo $gccpatch | grep "rockbox" >/dev/null 2>&1; } then
1538 echo "gcc $gccver is rockbox patched"
1539 # then convert -O to -Os to get smaller binaries!
1540 GCCOPTS=`echo $GCCOPTS | sed 's/ -O / -Os /'`
1541 else
1542 echo "WARNING: You use an unpatched gcc compiler: $gccver"
1543 echo "WARNING: http://www.rockbox.org/twiki/bin/view/Main/CrossCompiler"
1548 if test "$CC" = "m68k-elf-gcc"; then
1549 # convert -O to -Os to get smaller binaries!
1550 GCCOPTS=`echo $GCCOPTS | sed 's/ -O / -Os /'`
1553 if test "$1" = "--ccache"; then
1554 echo "Enable ccache for building"
1555 ccache="ccache"
1556 else
1557 if test "$1" != "--no-ccache"; then
1558 ccache=`findtool ccache`
1559 if test -n "$ccache"; then
1560 echo "Found and uses ccache ($ccache)"
1565 if test -n "$ccache"; then
1566 CC="$ccache $CC"
1569 if test "X$endian" = "Xbig"; then
1570 defendian="ROCKBOX_BIG_ENDIAN"
1571 else
1572 defendian="ROCKBOX_LITTLE_ENDIAN"
1575 sed > autoconf.h \
1576 -e "s,@ENDIAN@,${defendian},g" \
1577 -e "s,^#undef ROCKBOX_HAS_LOGF,$use_logf,g" \
1578 -e "s,@config_rtc@,$config_rtc,g" \
1579 -e "s,@have_rtc_alarm@,$have_rtc_alarm,g" \
1580 <<EOF
1581 /* This header was made by configure */
1582 #ifndef __BUILD_AUTOCONF_H
1583 #define __BUILD_AUTOCONF_H
1585 /* Define endianess for the target or simulator platform */
1586 #define @ENDIAN@ 1
1588 /* Define this if you build rockbox to support the logf logging and display */
1589 #undef ROCKBOX_HAS_LOGF
1591 /* optional defines for RTC mod for h1x0 */
1592 @config_rtc@
1593 @have_rtc_alarm@
1595 #endif /* __BUILD_AUTOCONF_H */
1598 if test -n "$t_cpu"; then
1599 TARGET_INC="-I\$(FIRMDIR)/target/$t_cpu/$t_manufacturer/$t_model"
1600 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/$t_cpu/$t_manufacturer"
1601 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/$t_cpu"
1602 GCCOPTS="$GCCOPTS"
1605 if test "$simulator" = "yes"; then
1606 # add simul make stuff on the #SIMUL# line
1607 simmagic1="s,@SIMUL1@,\$(SILENT)\$(MAKE) -C \$(SIMDIR) OBJDIR=\$(BUILDDIR)/sim,"
1608 simmagic2="s,@SIMUL2@,\$(SILENT)\$(MAKE) -C \$(ROOTDIR)/uisimulator/common OBJDIR=\$(BUILDDIR)/comsim,"
1609 else
1610 # delete the lines that match
1611 simmagic1='/@SIMUL1@/D'
1612 simmagic2='/@SIMUL2@/D'
1615 sed > Makefile \
1616 -e "s,@ROOTDIR@,${rootdir},g" \
1617 -e "s,@DEBUG@,${debug},g" \
1618 -e "s,@MEMORY@,${memory},g" \
1619 -e "s,@TARGET_ID@,${target_id},g" \
1620 -e "s,@TARGET@,${target},g" \
1621 -e "s,@CPU@,${t_cpu},g" \
1622 -e "s,@MANUFACTURER@,${t_manufacturer},g" \
1623 -e "s,@ARCHOS@,${archos},g" \
1624 -e "s,@LANGUAGE@,${language},g" \
1625 -e "s:@VOICELANGUAGE@:${voicelanguage}:g" \
1626 -e "s,@PWD@,${pwd},g" \
1627 -e "s,@CC@,${CC},g" \
1628 -e "s,@LD@,${LD},g" \
1629 -e "s,@AR@,${AR},g" \
1630 -e "s,@AS@,${AS},g" \
1631 -e "s,@OC@,${OC},g" \
1632 -e "s,@WINDRES@,${WINDRES},g" \
1633 -e "s,@DLLTOOL@,${DLLTOOL},g" \
1634 -e "s,@DLLWRAP@,${DLLWRAP},g" \
1635 -e "s,@RANLIB@,${RANLIB},g" \
1636 -e "s,@TOOL@,${tool},g" \
1637 -e "s,@BMP2RB_NATIVE@,${bmp2rb_native},g" \
1638 -e "s,@BMP2RB_MONO@,${bmp2rb_mono},g" \
1639 -e "s,@BMP2RB_REMOTENATIVE@,${bmp2rb_remotenative},g" \
1640 -e "s,@BMP2RB_REMOTEMONO@,${bmp2rb_remotemono},g" \
1641 -e "s,@OUTPUT@,${output},g" \
1642 -e "s,@APPEXTRA@,${appextra},g" \
1643 -e "s,@ARCHOSROM@,${archosrom},g" \
1644 -e "s,@FLASHFILE@,${flash},g" \
1645 -e "s,@PLUGINS@,${plugins},g" \
1646 -e "s,@CODECS@,${swcodec},g" \
1647 -e "s,@PROFILE_OPTS@,${PROFILE_OPTS},g" \
1648 -e "s,@SHARED_FLAG@,${SHARED_FLAG},g" \
1649 -e "s,@GCCOPTS@,${GCCOPTS},g" \
1650 -e "s,@TARGET_INC@,${TARGET_INC},g" \
1651 -e "s!@LDOPTS@!${LDOPTS}!g" \
1652 -e "s,@LOADADDRESS@,${loadaddress},g" \
1653 -e "s,@EXTRADEF@,${extradefines},g" \
1654 -e "s,@APPSDIR@,${appsdir},g" \
1655 -e "s,@FIRMDIR@,${firmdir},g" \
1656 -e "s,@TOOLSDIR@,${toolsdir},g" \
1657 -e "s,@APPS@,${apps},g" \
1658 -e "s,@SIMVER@,${simver},g" \
1659 -e "s,@GCCVER@,${gccver},g" \
1660 -e "s,@GCCNUM@,${gccnum},g" \
1661 -e "s,@UNAME@,${uname},g" \
1662 -e "s,@ENDIAN@,${defendian},g" \
1663 -e "s,@TOOLSET@,${toolset},g" \
1664 -e "${simmagic1}" \
1665 -e "${simmagic2}" \
1666 -e "s,@MANUALDEV@,${manualdev},g" \
1667 <<EOF
1668 ## Automaticly generated. http://www.rockbox.org/
1670 ifndef V
1671 SILENT=@
1672 else
1673 VERBOSEOPT=-v
1674 endif
1676 # old 'make' versions don't have the built-in 'info' function
1677 info=old\$(shell echo >&2 "Consider upgrading to GNU make 3.81+ for optimum build performance.")
1678 ifeq (\$(call info),old)
1679 export info=echo "\$\$(1)";
1680 endif
1682 export ROOTDIR=@ROOTDIR@
1683 export FIRMDIR=@FIRMDIR@
1684 export APPSDIR=@APPSDIR@
1685 export TOOLSDIR=@TOOLSDIR@
1686 export DOCSDIR=\$(ROOTDIR)/docs
1687 export MANUALDIR=\${ROOTDIR}/manual
1688 export DEBUG=@DEBUG@
1689 export ARCHOS=@ARCHOS@
1690 export ARCHOSROM=@ARCHOSROM@
1691 export FLASHFILE=@FLASHFILE@
1692 export TARGET_ID=@TARGET_ID@
1693 export TARGET=@TARGET@
1694 export CPU=@CPU@
1695 export MANUFACTURER=@MANUFACTURER@
1696 export OBJDIR=@PWD@
1697 export BUILDDIR=@PWD@
1698 export LANGUAGE=@LANGUAGE@
1699 export VOICELANGUAGE=@VOICELANGUAGE@
1700 export MEMORYSIZE=@MEMORY@
1701 export VERSION=\$(shell \$(ROOTDIR)/tools/svnversion.sh \$(ROOTDIR))
1702 export BUILDDATE=\$(shell date -u +'-DYEAR=%Y -DMONTH=%m -DDAY=%d')
1703 export MKFIRMWARE=@TOOL@
1704 export BMP2RB_MONO=@BMP2RB_MONO@
1705 export BMP2RB_NATIVE=@BMP2RB_NATIVE@
1706 export BMP2RB_REMOTEMONO=@BMP2RB_REMOTEMONO@
1707 export BMP2RB_REMOTENATIVE=@BMP2RB_REMOTENATIVE@
1708 export BINARY=@OUTPUT@
1709 export APPEXTRA=@APPEXTRA@
1710 export ENABLEDPLUGINS=@PLUGINS@
1711 export SOFTWARECODECS=@CODECS@
1712 export EXTRA_DEFINES=@EXTRADEF@
1713 export HOSTCC=gcc
1714 export CC=@CC@
1715 export LD=@LD@
1716 export AR=@AR@
1717 export AS=@AS@
1718 export OC=@OC@
1719 export WINDRES=@WINDRES@
1720 export DLLTOOL=@DLLTOOL@
1721 export DLLWRAP=@DLLWRAP@
1722 export RANLIB=@RANLIB@
1723 export PROFILE_OPTS=@PROFILE_OPTS@
1724 export SIMVER=@SIMVER@
1725 export SIMDIR=\$(ROOTDIR)/uisimulator/sdl
1726 export GCCOPTS=@GCCOPTS@
1727 export TARGET_INC=@TARGET_INC@
1728 export LOADADDRESS=@LOADADDRESS@
1729 export SHARED_FLAG=@SHARED_FLAG@
1730 export LDOPTS=@LDOPTS@
1731 export GCCVER=@GCCVER@
1732 export GCCNUM=@GCCNUM@
1733 export UNAME=@UNAME@
1734 export MANUALDEV=@MANUALDEV@
1736 # Do not print "Entering directory ..."
1737 MAKEFLAGS += --no-print-directory
1739 .PHONY: all clean tags zip tools manual bin build info
1741 all: info
1743 info: build
1744 \$(SILENT)\$(TOOLSDIR)/mkinfo.pl \$(BUILDDIR)/rockbox-info.txt
1746 build: tools
1747 @SIMUL1@
1748 @SIMUL2@
1749 \$(SILENT)\$(MAKE) -C \$(FIRMDIR) OBJDIR=\$(BUILDDIR)/firmware
1750 \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@
1752 bin: tools
1753 @SIMUL1@
1754 @SIMUL2@
1755 \$(SILENT)\$(MAKE) -C \$(FIRMDIR) OBJDIR=\$(BUILDDIR)/firmware
1756 \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@ \$(BUILDDIR)/\$(BINARY)
1758 rocks: tools
1759 \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@ rocks
1761 veryclean: clean toolsclean
1763 toolsclean:
1764 \$(SILENT)\$(MAKE) -C \$(TOOLSDIR) clean
1766 clean:
1767 \$(SILENT)echo Cleaning build directory
1768 \$(SILENT)rm -rf rockbox.zip TAGS @APPS@ firmware comsim sim lang.[ch]\
1769 manual *.pdf *.a credits.raw @OUTPUT@ bitmaps pluginbitmaps \
1770 @ARCHOSROM@ @FLASHFILE@ UI256.bmp rockbox-full.zip \
1771 html txt rockbox-manual*.zip sysfont.h rockbox-info.txt \
1772 voicefontids *.wav *.mp3 *.voice
1774 tools:
1775 \$(SILENT)\$(MAKE) -C \$(TOOLSDIR) CC=\$(HOSTCC) @TOOLSET@
1777 tags:
1778 \$(SILENT)rm -f TAGS
1779 \$(SILENT)\$(MAKE) -C \$(FIRMDIR) tags
1780 \$(SILENT)\$(MAKE) -C \$(APPSDIR) tags
1781 \$(SILENT)\$(MAKE) -C \$(APPSDIR)/plugins tags
1782 \$(SILENT)\$(MAKE) -C \$(APPSDIR)/plugins/lib tags
1784 fontzip:
1785 \$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -r "\$(ROOTDIR)" -f 1 -o rockbox-fonts.zip \$(TARGET) \$(BINARY)
1787 zip:
1788 \$(SILENT)for f in \`cat \$(BUILDDIR)/@APPS@/features\`; do feat="\$\$feat:\$\$f" ; done ; \\
1789 \$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\$\$feat\" -i \"\$(TARGET_ID)\" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
1791 mapzip:
1792 \$(SILENT)find . -name "*.map" | xargs zip rockbox-maps.zip
1794 fullzip:
1795 \$(SILENT)for f in \`cat \$(BUILDDIR)/@APPS@/features\`; do feat="\$\$feat:\$\$f" ; done; \\
1796 \$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\$\$feat\" -i \"\$(TARGET_ID)\" -r "\$(ROOTDIR)" -f 2 -o rockbox-full.zip \$(TARGET) \$(BINARY)
1798 7zip:
1799 \$(SILENT)for f in \`cat \$(BUILDDIR)/@APPS@/features\`; do feat="\$\$feat:\$\$f" ; done; \\
1800 \$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\$\$feat\" -i \"\$(TARGET_ID)\" -o "rockbox.7z" -z "7za a" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
1802 tar:
1803 \$(SILENT)rm -f rockbox.tar
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)\" -o "rockbox.tar" -z "tar --no-recursion -uf" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
1807 bzip2: tar
1808 \$(SILENT)bzip2 -f9 rockbox.tar
1810 gzip: tar
1811 \$(SILENT)gzip -f9 rockbox.tar
1813 manual: manual-pdf
1814 manual-pdf:
1815 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-pdf
1816 manual-html:
1817 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-html
1818 manual-zhtml: manual-zip
1819 manual-txt:
1820 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-txt
1821 manual-ztxt:
1822 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-txt-zip
1823 manual-zip:
1824 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-zip
1826 features:
1827 \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@ features
1829 help:
1830 @echo "A few helpful make targets"
1831 @echo ""
1832 @echo "all - builds a full Rockbox (default), including tools"
1833 @echo "bin - builds only the Rockbox.<target name> file"
1834 @echo "clean - cleans a build directory (not tools)"
1835 @echo "veryclean - cleans the build and tools directories"
1836 @echo "manual - builds a manual"
1837 @echo "manual-html - HTML manual"
1838 @echo "manual-zip - HTML manual (zipped)"
1839 @echo "manual-txt - txt manual"
1840 @echo "fullzip - creates a rockbox.zip of your build with fonts"
1841 @echo "zip - creates a rockbox.zip of your build (no fonts)"
1842 @echo "gzip - creates a rockbox.tar.gz of your build (no fonts)"
1843 @echo "bzip2 - creates a rockbox.tar.bz2 of your build (no fonts)"
1844 @echo "7zip - creates a rockbox.7z of your build (no fonts)"
1845 @echo "fontzip - creates rockbox-fonts.zip"
1846 @echo "mapzip - creates rockbox-maps.zip with all .map files"
1847 @echo "tools - builds the tools only"
1848 @echo "install - installs your build (for simulator builds only)"
1852 if [ "yes" = "$simulator" ]; then
1854 cat >> Makefile <<EOF
1856 install:
1857 @echo "installing a full setup in your archos dir"
1858 @(\$(MAKE) fullzip && cd archos && unzip -oq ../rockbox-full.zip)
1863 if [ "yes" = "$voice" ]; then
1865 cat >> Makefile <<EOF
1867 voice: tools features
1868 \$(SILENT)for f in \`cat \$(BUILDDIR)/${apps}/features\`; do feat="\$\$feat:\$\$f" ; done ; \\
1869 for lang in \`echo \$(VOICELANGUAGE) |sed "s/,/ /g"\`; do \$(TOOLSDIR)/genvoice.sh \$(ROOTDIR) \$\$lang \$(ARCHOS)\$\$feat \$(TARGET_ID) voicesettings-\$\$lang.sh ; done \\
1874 echo "Created Makefile"