don't try to find the given file in the browser dialog if it doesn't exist.
[Rockbox.git] / tools / configure
blobb2d2be25089d6d5e7392f1a3d96a79af12e7517a
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 voiceconfig
288 toolset="${toolset} voicefont wavtrim"
290 if [ "yes" = "$use_debug" ]; then
291 debug="-DDEBUG"
292 GCCOPTS="$GCCOPTS -g -DDEBUG"
294 if [ "yes" = "$logf" ]; then
295 use_logf="#define ROCKBOX_HAS_LOGF 1"
297 if [ "yes" = "$simulator" ]; then
298 debug="-DDEBUG"
299 extradefines="$extradefines -DSIMULATOR"
301 if [ "yes" = "$profile" ]; then
302 extradefines="$extradefines -DRB_PROFILE"
303 PROFILE_OPTS="-finstrument-functions"
307 voiceconfig () {
308 echo "Building voice for $archos"
309 echo ""
311 if [ `which flite` ]; then
312 FLITE="F(l)ite "
313 FLITE_OPTS="FLITE_OPTS=\"\""
314 DEFAULT_TTS="flite"
315 DEFAULT_TTS_OPTS=$FLITE_OPTS
316 DEFAULT_NOISEFLOOR="500"
317 DEFAULT_CHOICE="L"
319 if [ `which espeak` ]; then
320 ESPEAK="(e)Speak "
321 ESPEAK_OPTS="ESPEAK_OPTS=\"\""
322 DEFAULT_TTS="espeak"
323 DEFAULT_TTS_OPTS=$ESPEAK_OPTS
324 DEFAULT_NOISEFLOOR="500"
325 DEFAULT_CHOICE="e"
327 if [ `which festival` ]; then
328 FESTIVAL="(F)estival "
329 FESTIVAL_OPTS="FLITE_OPTS=\"\""
330 DEFAULT_TTS="festival"
331 DEFAULT_TTS_OPTS=$FESTIVAL_OPTS
332 DEFAULT_NOISEFLOOR="500"
333 DEFAULT_CHOICE="F"
336 if [ "$FESTIVAL" = "$FLITE" ] && [ "$FLITE" = "$ESPEAK" ]; then
337 echo "You need Festival, eSpeak or Flite in your path to build voice files"
338 exit
341 echo "TTS engine to use: ${FLITE}${FESTIVAL}${ESPEAK}(${DEFAULT_CHOICE})?"
342 option=`input`
343 case "$option" in
344 [Ll])
345 TTS_ENGINE="flite"
346 NOISEFLOOR="500" # TODO: check this value
347 TTS_OPTS=$FLITE_OPTS
349 [Ee])
350 TTS_ENGINE="espeak"
351 NOISEFLOOR="500"
352 TTS_OPTS=$ESPEAK_OPTS
354 [Ff])
355 TTS_ENGINE="festival"
356 NOISEFLOOR="500"
357 TTS_OPTS=$FESTIVAL_OPTS
360 TTS_ENGINE=$DEFAULT_TTS
361 TTS_OPTS=$DEFAULT_TTS_OPTS
362 NOISEFLOOR=$DEFAULT_NOISEFLOOR
363 esac
364 echo "Using $TTS_ENGINE for TTS"
366 echo ""
368 if [ `which oggenc` ]; then
369 OGGENC="(O)ggenc "
370 DEFAULT_ENC="oggenc"
371 VORBIS_OPTS="VORBIS_OPTS=\"-q0 --downmix\""
372 DEFAULT_ENC_OPTS=$VORBIS_OPTS
373 DEFAULT_CHOICE="O"
375 if [ `which speexenc` ]; then
376 SPEEXENC="(S)peexenc "
377 DEFAULT_ENC="speexenc"
378 SPEEX_OPTS="" # TODO: find appropriate options for speex
379 DEFAULT_ENC_OPTS=$SPEEX_OPTS
380 DEFAULT_CHOICE="S"
382 if [ `which lame` ]; then
383 LAME="(L)ame "
384 DEFAULT_ENC="lame"
385 LAME_OPTS="LAME_OPTS=\"--resample 12 -t -m m -h -V 9 -S\""
386 DEFAULT_ENC_OPTS=$LAME_OPTS
387 DEFAULT_CHOICE="L"
390 if [ "$LAME" = "" ]; then
391 echo "You need to have Lame installed to build voice files"
394 # echo "Encoder to use: ${LAME}${OGGENC}${SPEEXENC}(${DEFAULT_CHOICE})?"
395 # echo ""
396 # echo "Note: Use Lame - the other options won't work"
397 # option=`input`
398 # case "$option" in
399 # [Oo])
400 # ENCODER="oggenc"
401 # ENC_OPTS=$VORBIS_OPTS
402 # ;;
403 # [Ss])
404 # ENCODER="speexenc"
405 # ENC_OPTS=$SPEEX_OPTS
406 # ;;
407 # [Ll])
408 ENCODER="lame"
409 ENC_OPTS=$LAME_OPTS
410 # ;;
411 # *)
412 # ENCODER=$DEFAULT_ENC
413 # ENC_OPTS=$DEFAULT_ENC_OPTS
414 # esac
415 echo "Using $ENCODER for encoding voice clips"
417 cat > voicesettings.sh <<EOF
418 TTS_ENGINE="${TTS_ENGINE}"
419 ENCODER="${ENCODER}"
420 TEMPDIR="${pwd}"
421 NOISEFLOOR="${NOISEFLOOR}"
422 ${TTS_OPTS}
423 ${ENC_OPTS}
427 picklang() {
428 # figure out which languages that are around
429 for file in $rootdir/apps/lang/*.lang; do
430 clean=`echo $file | sed -e 's:.*/::g' | cut "-d." -f1`
431 langs="$langs $clean"
432 done
434 num=1
435 for one in $langs; do
436 echo "$num. $one"
437 num=`expr $num + 1`
438 done
440 read pick
441 return $pick;
444 whichlang() {
445 num=1
446 for one in $langs; do
447 if [ "$num" = "$pick" ]; then
448 echo $one
449 return
451 num=`expr $num + 1`
452 done
455 opt=$1
457 if test "$opt" = "--help"; then
458 echo "Rockbox configure script."
459 echo "Invoke this in a directory to generate a Makefile to build Rockbox"
460 echo "Do *NOT* run this within the tools directory!"
461 echo ""
462 echo "Usage: configure [--ccache][--no-ccache]"
463 exit
466 if test -r "configure"; then
467 # this is a check for a configure script in the current directory, it there
468 # is one, try to figure out if it is this one!
470 if { grep "^# Jukebox" configure >/dev/null 2>&1 ; } then
471 echo "WEEEEEEEEP. Don't run this configure script within the tools directory."
472 echo "It will only cause you pain and grief. Instead do this:"
473 echo ""
474 echo " cd .."
475 echo " mkdir build-dir"
476 echo " cd build-dir"
477 echo " ../tools/configure"
478 echo ""
479 echo "Much happiness will arise from this. Enjoy"
480 exit
484 # get our current directory
485 pwd=`pwd`;
487 if { echo $pwd | grep " "; } then
488 echo "You're running this script in a path that contains space. The build"
489 echo "system is unfortunately not clever enough to deal with this. Please"
490 echo "run the script from a different path, rename the path or fix the build"
491 echo "system!"
492 exit
495 if [ -z "$rootdir" ]; then
496 ##################################################################
497 # Figure out where the source code root is!
499 rootdir=`dirname $0`/../
501 #####################################################################
502 # Convert the possibly relative directory name to an absolute version
504 now=`pwd`
505 cd $rootdir
506 rootdir=`pwd`
508 # cd back to the build dir
509 cd $now
512 apps="apps"
513 appsdir='\$(ROOTDIR)/apps'
514 firmdir='\$(ROOTDIR)/firmware'
515 toolsdir='\$(ROOTDIR)/tools'
518 ##################################################################
519 # Figure out target platform
522 echo "Enter target platform:"
523 cat <<EOF
524 ==Archos== ==iriver== ==Apple iPod==
525 0) Player/Studio 10) H120/H140 20) Color/Photo
526 1) Recorder 11) H320/H340 21) Nano
527 2) FM Recorder 12) iHP-100/110/115 22) Video
528 3) Recorder v2 13) iFP-790 23) 3G
529 4) Ondio SP 14) H10 20Gb 24) 4G Grayscale
530 5) Ondio FM 15) H10 5/6Gb 25) Mini 1G
531 6) AV300 26) Mini 2G
532 27) 1G, 2G
534 ==iAudio== ==Toshiba== ==SanDisk==
535 30) X5/X5V/X5L 40) Gigabeat F 50) Sansa e200
536 31) M5/M5L 51) Sansa e200R
538 ==Tatung==
539 60) Elio TPJ-1022
542 buildfor=`input`;
544 # Set of tools built for all target platforms:
545 toolset="rdf2binary convbdf codepages"
547 # Toolsets for some target families:
548 archosbitmaptools="$toolset scramble descramble sh2d uclpack bmp2rb"
549 iriverbitmaptools="$toolset scramble descramble mkboot bmp2rb"
550 iaudiobitmaptools="$toolset scramble descramble mkboot bmp2rb"
551 ipodbitmaptools="$toolset scramble ipod_fw bmp2rb codepages"
552 gigabeatbitmaptools="$toolset scramble descramble bmp2rb"
553 # generic is used by IFP, H10, Sansa-e200
554 genericbitmaptools="$toolset bmp2rb"
557 # ---- For each target ----
559 # *Variables*
560 # target_id: a unique number identifying this target, DOES NOT necessarily
561 # have to be the menu number. Just use the currently highest
562 # number+1 when you add a new target.
563 # archos: short model name used all over to identify this target
564 # memory: number of megabytes of RAM this target has. If the amount can
565 # be selected by the size prompt, let memory be unset here
566 # target: -Ddefine passed to the build commands to make the correct
567 # config-*.h file get included etc
568 # tool: the tool that takes a plain binary and converts that into a
569 # working "firmware" file for your target
570 # output: the final output file name
571 # boottool: the tool that takes a plain binary and generates a bootloader
572 # file for your target (or blank to use $tool)
573 # bootoutput:the final output file name for the bootloader (or blank to use
574 # $output)
575 # appextra: passed to the APPEXTRA variable in the Makefiles.
576 # TODO: add proper explanation
577 # archosrom: used only for Archos targets that build a special flashable .ucl
578 # image. Set to blank for other builds.
579 # flash: the same as archosrom. These two should be merged
580 # plugins: set to 'yes' to build the plugins. Early development builds can
581 # set this to no in the early stages to have an easier life for a
582 # while
583 # swcodec: set 'yes' on swcodec targets
584 # toolset: lists what particular tools in the tools/ directory that this
585 # target needs to have built prior to building Rockbox
587 # *Functions*
588 # *cc: sets up gcc and compiler options for your target builds. Note
589 # that if you select a simulator build, the compiler selection is
590 # overridden later in the script.
592 case $buildfor in
594 0|player)
595 target_id=1
596 archos="player"
597 target="-DARCHOS_PLAYER"
598 shcc
599 tool="$rootdir/tools/scramble"
600 output="archos.mod"
601 appextra="player:gui"
602 archosrom="$pwd/rombox.ucl"
603 flash="$pwd/rockbox.ucl"
604 plugins="yes"
605 swcodec=""
607 # toolset is the tools within the tools directory that we build for
608 # this particular target.
609 toolset="$toolset scramble descramble sh2d player_unifont uclpack"
611 # Note: the convbdf is present in the toolset just because: 1) the
612 # firmware/Makefile assumes it is present always, and 2) we will need it when we
613 # build the player simulator
615 t_cpu="sh"
616 t_manufacturer="archos"
617 t_model="player"
620 1|recorder)
621 target_id=2
622 archos="recorder"
623 target="-DARCHOS_RECORDER"
624 shcc
625 tool="$rootdir/tools/scramble"
626 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
627 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
628 output="ajbrec.ajz"
629 appextra="recorder:gui"
630 archosrom="" #"$pwd/rombox.ucl"
631 flash="$pwd/rockbox.ucl"
632 plugins="yes"
633 swcodec=""
634 # toolset is the tools within the tools directory that we build for
635 # this particular target.
636 toolset=$archosbitmaptools
637 t_cpu="sh"
638 t_manufacturer="archos"
639 t_model="recorder"
642 2|fmrecorder)
643 target_id=3
644 archos="fmrecorder"
645 target="-DARCHOS_FMRECORDER"
646 shcc
647 tool="$rootdir/tools/scramble -fm"
648 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
649 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
650 output="ajbrec.ajz"
651 appextra="recorder:gui"
652 archosrom="" #"$pwd/rombox.ucl"
653 flash="$pwd/rockbox.ucl"
654 plugins="yes"
655 swcodec=""
656 # toolset is the tools within the tools directory that we build for
657 # this particular target.
658 toolset=$archosbitmaptools
659 t_cpu="sh"
660 t_manufacturer="archos"
661 t_model="fm_v2"
664 3|recorderv2)
665 target_id=4
666 archos="recorderv2"
667 target="-DARCHOS_RECORDERV2"
668 shcc
669 tool="$rootdir/tools/scramble -v2"
670 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
671 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
672 output="ajbrec.ajz"
673 appextra="recorder:gui"
674 archosrom="" #"$pwd/rombox.ucl"
675 flash="$pwd/rockbox.ucl"
676 plugins="yes"
677 swcodec=""
678 # toolset is the tools within the tools directory that we build for
679 # this particular target.
680 toolset=$archosbitmaptools
681 t_cpu="sh"
682 t_manufacturer="archos"
683 t_model="fm_v2"
686 4|ondiosp)
687 target_id=7
688 archos="ondiosp"
689 target="-DARCHOS_ONDIOSP"
690 shcc
691 tool="$rootdir/tools/scramble -osp"
692 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
693 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
694 output="ajbrec.ajz"
695 appextra="recorder:gui"
696 archosrom="$pwd/rombox.ucl"
697 flash="$pwd/rockbox.ucl"
698 plugins="yes"
699 swcodec=""
700 # toolset is the tools within the tools directory that we build for
701 # this particular target.
702 toolset=$archosbitmaptools
703 t_cpu="sh"
704 t_manufacturer="archos"
705 t_model="ondio"
708 5|ondiofm)
709 target_id=8
710 archos="ondiofm"
711 target="-DARCHOS_ONDIOFM"
712 shcc
713 tool="$rootdir/tools/scramble -ofm"
714 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
715 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
716 output="ajbrec.ajz"
717 appextra="recorder:gui"
718 archosrom="" #"$pwd/rombox.ucl"
719 flash="$pwd/rockbox.ucl"
720 plugins="yes"
721 swcodec=""
722 toolset=$archosbitmaptools
723 t_cpu="sh"
724 t_manufacturer="archos"
725 t_model="ondio"
728 6|av300)
729 target_id=26
730 archos="av300"
731 target="-DARCHOS_AV300"
732 memory=16 # always
733 arm7tdmicc
734 tool="$rootdir/tools/scramble -mm=C"
735 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
736 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
737 output="cjbm.ajz"
738 appextra="recorder:gui"
739 archosrom=""
740 flash=""
741 plugins="yes"
742 swcodec=""
743 # toolset is the tools within the tools directory that we build for
744 # this particular target.
745 toolset="$toolset scramble descramble bmp2rb codepages"
746 # architecture, manufacturer and model for the target-tree build
747 t_cpu="arm"
748 t_manufacturer="archos"
749 t_model="av300"
752 10|h120)
753 target_id=9
754 archos="h120"
755 target="-DIRIVER_H120"
756 memory=32 # always
757 coldfirecc
758 tool="$rootdir/tools/scramble -add=h120"
759 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
760 bmp2rb_native="$rootdir/tools/bmp2rb -f 2"
761 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
762 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
763 output="rockbox.iriver"
764 appextra="recorder:gui"
765 archosrom=""
766 flash="$pwd/rombox.iriver"
767 plugins="yes"
768 swcodec="yes"
769 # toolset is the tools within the tools directory that we build for
770 # this particular target.
771 toolset=$iriverbitmaptools
772 t_cpu="coldfire"
773 t_manufacturer="iriver"
774 t_model="h100"
777 11|h300)
778 target_id=10
779 archos="h300"
780 target="-DIRIVER_H300"
781 memory=32 # always
782 coldfirecc
783 tool="$rootdir/tools/scramble -add=h300"
784 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
785 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
786 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
787 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
788 output="rockbox.iriver"
789 appextra="recorder:gui"
790 archosrom=""
791 flash=""
792 plugins="yes"
793 swcodec="yes"
794 # toolset is the tools within the tools directory that we build for
795 # this particular target.
796 toolset=$iriverbitmaptools
797 t_cpu="coldfire"
798 t_manufacturer="iriver"
799 t_model="h300"
802 12|h100)
803 target_id=11
804 archos="h100"
805 target="-DIRIVER_H100"
806 memory=16 # always
807 coldfirecc
808 tool="$rootdir/tools/scramble -add=h100"
809 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
810 bmp2rb_native="$rootdir/tools/bmp2rb -f 2"
811 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
812 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
813 output="rockbox.iriver"
814 appextra="recorder:gui"
815 archosrom=""
816 flash=""
817 plugins="yes"
818 swcodec="yes"
819 # toolset is the tools within the tools directory that we build for
820 # this particular target.
821 toolset=$iriverbitmaptools
822 t_cpu="coldfire"
823 t_manufacturer="iriver"
824 t_model="h100"
827 13|ifp7xx)
828 target_id=19
829 archos="ifp7xx"
830 target="-DIRIVER_IFP7XX"
831 memory=1
832 arm7tdmicc short
833 tool="cp"
834 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
835 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
836 output="rockbox.wma"
837 appextra="recorder:gui"
838 archosrom=""
839 flash=""
840 plugins="yes"
841 swcodec="yes"
842 # toolset is the tools within the tools directory that we build for
843 # this particular target.
844 toolset=$genericbitmaptools
845 t_cpu="arm"
846 t_manufacturer="pnx0101"
847 t_model="iriver-ifp7xx"
850 14|h10)
851 target_id=22
852 archos="h10"
853 target="-DIRIVER_H10"
854 memory=32 # always
855 arm7tdmicc
856 tool="$rootdir/tools/scramble -mi4v3 -model=h10 -type=RBOS"
857 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
858 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
859 output="rockbox.mi4"
860 appextra="recorder:gui"
861 archosrom=""
862 flash=""
863 plugins="yes"
864 swcodec="yes"
865 boottool="$rootdir/tools/scramble -mi4v3 -model=h10 -type=RBBL"
866 bootoutput="H10_20GC.mi4"
867 # toolset is the tools within the tools directory that we build for
868 # this particular target.
869 toolset="$genericbitmaptools scramble"
870 # architecture, manufacturer and model for the target-tree build
871 t_cpu="arm"
872 t_manufacturer="iriver"
873 t_model="h10"
876 15|h10_5gb)
877 target_id=24
878 archos="h10_5gb"
879 target="-DIRIVER_H10_5GB"
880 memory=32 # always
881 arm7tdmicc
882 tool="$rootdir/tools/scramble -mi4v2 -model=h105 -type=RBOS"
883 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
884 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
885 output="rockbox.mi4"
886 appextra="recorder:gui"
887 archosrom=""
888 flash=""
889 plugins="yes"
890 swcodec="yes"
891 boottool="$rootdir/tools/scramble -mi4v2 -model=h105 -type=RBBL"
892 bootoutput="H10.mi4"
893 # toolset is the tools within the tools directory that we build for
894 # this particular target.
895 toolset="$genericbitmaptools scramble"
896 # architecture, manufacturer and model for the target-tree build
897 t_cpu="arm"
898 t_manufacturer="iriver"
899 t_model="h10"
902 20|ipodcolor)
903 target_id=13
904 archos="ipodcolor"
905 target="-DIPOD_COLOR"
906 memory=32 # always
907 arm7tdmicc
908 tool="$rootdir/tools/scramble -add=ipco"
909 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
910 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
911 output="rockbox.ipod"
912 appextra="recorder:gui"
913 archosrom=""
914 flash=""
915 plugins="yes"
916 swcodec="yes"
917 bootoutput="bootloader-$archos.ipod"
918 # toolset is the tools within the tools directory that we build for
919 # this particular target.
920 toolset=$ipodbitmaptools
921 # architecture, manufacturer and model for the target-tree build
922 t_cpu="arm"
923 t_manufacturer="ipod"
924 t_model="color"
927 21|ipodnano)
928 target_id=14
929 archos="ipodnano"
930 target="-DIPOD_NANO"
931 memory=32 # always
932 arm7tdmicc
933 tool="$rootdir/tools/scramble -add=nano"
934 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
935 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
936 output="rockbox.ipod"
937 appextra="recorder:gui"
938 archosrom=""
939 flash=""
940 plugins="yes"
941 swcodec="yes"
942 bootoutput="bootloader-$archos.ipod"
943 # toolset is the tools within the tools directory that we build for
944 # this particular target.
945 toolset=$ipodbitmaptools
946 # architecture, manufacturer and model for the target-tree build
947 t_cpu="arm"
948 t_manufacturer="ipod"
949 t_model="nano"
952 22|ipodvideo)
953 target_id=15
954 archos="ipodvideo"
955 target="-DIPOD_VIDEO"
956 arm7tdmicc
957 tool="$rootdir/tools/scramble -add=ipvd"
958 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
959 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
960 output="rockbox.ipod"
961 appextra="recorder:gui"
962 archosrom=""
963 flash=""
964 plugins="yes"
965 swcodec="yes"
966 bootoutput="bootloader-$archos.ipod"
967 # toolset is the tools within the tools directory that we build for
968 # this particular target.
969 toolset=$ipodbitmaptools
970 # architecture, manufacturer and model for the target-tree build
971 t_cpu="arm"
972 t_manufacturer="ipod"
973 t_model="video"
976 23|ipod3g)
977 target_id=16
978 archos="ipod3g"
979 target="-DIPOD_3G"
980 memory=32 # always
981 arm7tdmicc
982 tool="$rootdir/tools/scramble -add=ip3g"
983 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
984 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
985 output="rockbox.ipod"
986 appextra="recorder:gui"
987 archosrom=""
988 flash=""
989 plugins="yes"
990 swcodec="yes"
991 bootoutput="bootloader-$archos.ipod"
992 # toolset is the tools within the tools directory that we build for
993 # this particular target.
994 toolset=$ipodbitmaptools
995 # architecture, manufacturer and model for the target-tree build
996 t_cpu="arm"
997 t_manufacturer="ipod"
998 t_model="3g"
1001 24|ipod4g)
1002 target_id=17
1003 archos="ipod4g"
1004 target="-DIPOD_4G"
1005 memory=32 # always
1006 arm7tdmicc
1007 tool="$rootdir/tools/scramble -add=ip4g"
1008 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1009 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1010 output="rockbox.ipod"
1011 appextra="recorder:gui"
1012 archosrom=""
1013 flash=""
1014 plugins="yes"
1015 swcodec="yes"
1016 bootoutput="bootloader-$archos.ipod"
1017 # toolset is the tools within the tools directory that we build for
1018 # this particular target.
1019 toolset=$ipodbitmaptools
1020 # architecture, manufacturer and model for the target-tree build
1021 t_cpu="arm"
1022 t_manufacturer="ipod"
1023 t_model="4g"
1026 25|ipodmini)
1027 target_id=18
1028 archos="ipodmini"
1029 target="-DIPOD_MINI"
1030 memory=32 # always
1031 arm7tdmicc
1032 tool="$rootdir/tools/scramble -add=mini"
1033 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1034 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1035 output="rockbox.ipod"
1036 appextra="recorder:gui"
1037 archosrom=""
1038 flash=""
1039 plugins="yes"
1040 swcodec="yes"
1041 bootoutput="bootloader-$archos.ipod"
1042 # toolset is the tools within the tools directory that we build for
1043 # this particular target.
1044 toolset=$ipodbitmaptools
1045 # architecture, manufacturer and model for the target-tree build
1046 t_cpu="arm"
1047 t_manufacturer="ipod"
1048 t_model="mini"
1051 26|ipodmini2g)
1052 target_id=21
1053 archos="ipodmini2g"
1054 target="-DIPOD_MINI2G"
1055 memory=32 # always
1056 arm7tdmicc
1057 tool="$rootdir/tools/scramble -add=mn2g"
1058 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1059 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1060 output="rockbox.ipod"
1061 appextra="recorder:gui"
1062 archosrom=""
1063 flash=""
1064 plugins="yes"
1065 swcodec="yes"
1066 bootoutput="bootloader-$archos.ipod"
1067 # toolset is the tools within the tools directory that we build for
1068 # this particular target.
1069 toolset=$ipodbitmaptools
1070 # architecture, manufacturer and model for the target-tree build
1071 t_cpu="arm"
1072 t_manufacturer="ipod"
1073 t_model="mini2g"
1076 27|ipod1g2g)
1077 target_id=29
1078 archos="ipod1g2g"
1079 target="-DIPOD_1G2G"
1080 memory=32 # always
1081 arm7tdmicc
1082 tool="$rootdir/tools/scramble -add=1g2g"
1083 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1084 bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1085 output="rockbox.ipod"
1086 appextra="recorder:gui"
1087 archosrom=""
1088 flash=""
1089 plugins="yes"
1090 swcodec="yes"
1091 bootoutput="bootloader-$archos.ipod"
1092 # toolset is the tools within the tools directory that we build for
1093 # this particular target.
1094 toolset=$ipodbitmaptools
1095 # architecture, manufacturer and model for the target-tree build
1096 t_cpu="arm"
1097 t_manufacturer="ipod"
1098 t_model="1g2g"
1101 30|x5)
1102 target_id=12
1103 archos="x5"
1104 target="-DIAUDIO_X5"
1105 memory=16 # always
1106 coldfirecc
1107 tool="$rootdir/tools/scramble -add=iax5"
1108 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1109 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1110 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
1111 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 7"
1112 output="rockbox.iaudio"
1113 appextra="recorder:gui"
1114 archosrom=""
1115 flash=""
1116 plugins="yes"
1117 swcodec="yes"
1118 # toolset is the tools within the tools directory that we build for
1119 # this particular target.
1120 toolset="$iaudiobitmaptools"
1121 # architecture, manufacturer and model for the target-tree build
1122 t_cpu="coldfire"
1123 t_manufacturer="iaudio"
1124 t_model="x5"
1127 31|m5)
1128 target_id=28
1129 archos="m5"
1130 target="-DIAUDIO_M5"
1131 memory=16 # always
1132 coldfirecc
1133 tool="$rootdir/tools/scramble -add=iam5"
1134 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1135 bmp2rb_native="$rootdir/tools/bmp2rb -f 2"
1136 bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
1137 bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 7"
1138 output="rockbox.iaudio"
1139 appextra="recorder:gui"
1140 archosrom=""
1141 flash=""
1142 plugins="yes"
1143 swcodec="yes"
1144 # toolset is the tools within the tools directory that we build for
1145 # this particular target.
1146 toolset="$iaudiobitmaptools"
1147 # architecture, manufacturer and model for the target-tree build
1148 t_cpu="coldfire"
1149 t_manufacturer="iaudio"
1150 t_model="m5"
1153 40|gigabeatf)
1154 target_id=20
1155 archos="gigabeatf"
1156 target="-DGIGABEAT_F"
1157 memory=32 # always
1158 arm9tdmicc
1159 tool="$rootdir/tools/scramble -add=giga"
1160 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1161 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1162 output="rockbox.gigabeat"
1163 appextra="recorder:gui"
1164 archosrom=""
1165 flash=""
1166 plugins="yes"
1167 swcodec="yes"
1168 toolset=$gigabeatbitmaptools
1169 boottool="$rootdir/tools/scramble -gigabeat"
1170 bootoutput="FWIMG01.DAT"
1171 # architecture, manufacturer and model for the target-tree build
1172 t_cpu="arm"
1173 t_manufacturer="s3c2440"
1174 t_model="gigabeat-fx"
1177 50|e200)
1178 target_id=23
1179 archos="e200"
1180 target="-DSANSA_E200"
1181 memory=32 # supposedly
1182 arm7tdmicc
1183 tool="$rootdir/tools/scramble -mi4v3 -model=e200 -type=RBOS"
1184 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1185 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1186 output="rockbox.mi4"
1187 appextra="recorder:gui"
1188 archosrom=""
1189 flash=""
1190 plugins="yes"
1191 swcodec="yes"
1192 boottool="$rootdir/tools/scramble -mi4v3 -model=e200 -type=RBBL"
1193 bootoutput="PP5022.mi4"
1194 # toolset is the tools within the tools directory that we build for
1195 # this particular target.
1196 toolset="$genericbitmaptools scramble"
1197 # architecture, manufacturer and model for the target-tree build
1198 t_cpu="arm"
1199 t_manufacturer="sandisk"
1200 t_model="sansa-e200"
1203 51|e200r)
1204 # the e200R model is pretty much identical to the e200, it only has a
1205 # different option to the scramble tool when building a bootloader and
1206 # makes the bootloader output file name in all lower case.
1207 target_id=27
1208 archos="e200r"
1209 target="-DSANSA_E200"
1210 memory=32 # supposedly
1211 arm7tdmicc
1212 tool="$rootdir/tools/scramble -mi4v3 -model=e20r -type=RBOS"
1213 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1214 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1215 output="rockbox.mi4"
1216 appextra="recorder:gui"
1217 archosrom=""
1218 flash=""
1219 plugins="yes"
1220 swcodec="yes"
1221 boottool="$rootdir/tools/scramble -mi4r -model=e20r -type=RBBL"
1222 bootoutput="pp5022.mi4"
1223 # toolset is the tools within the tools directory that we build for
1224 # this particular target.
1225 toolset="$genericbitmaptools scramble"
1226 # architecture, manufacturer and model for the target-tree build
1227 t_cpu="arm"
1228 t_manufacturer="sandisk"
1229 t_model="sansa-e200"
1232 60|tpj1022)
1233 target_id=25
1234 archos="tpj1022"
1235 target="-DELIO_TPJ1022"
1236 memory=32 # always
1237 arm7tdmicc
1238 tool="$rootdir/tools/scramble -add tpj2"
1239 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1240 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
1241 output="rockbox.elio"
1242 appextra="recorder:gui"
1243 archosrom=""
1244 flash=""
1245 plugins="yes"
1246 swcodec="yes"
1247 boottool="$rootdir/tools/scramble -mi4v2"
1248 bootoutput="pp5020.mi4"
1249 # toolset is the tools within the tools directory that we build for
1250 # this particular target.
1251 toolset="$genericbitmaptools scramble"
1252 # architecture, manufacturer and model for the target-tree build
1253 t_cpu="arm"
1254 t_manufacturer="tatung"
1255 t_model="tpj1022"
1259 echo "Please select a supported target platform!"
1260 exit
1263 esac
1265 echo "Platform set to $archos"
1268 #remove start
1269 ############################################################################
1270 # Amount of memory, for those that can differ. They have $memory unset at
1271 # this point.
1274 if [ -z "$memory" ]; then
1276 case $target_id in
1278 echo "Enter size of your RAM (in MB): (Defaults to 32)"
1279 size=`input`;
1280 case $size in
1281 60|64)
1282 memory="64"
1285 memory="32"
1287 esac
1291 echo "Enter size of your RAM (in MB): (defaults to 2)"
1292 size=`input`;
1293 case $size in
1295 memory="8"
1298 memory="2"
1300 esac
1302 esac
1304 echo "Memory size selected: $memory MB"
1306 #remove end
1308 ##################################################################
1309 # Figure out build "type"
1312 # the ifp7x0 is the only platform that supports building a gdb stub like
1313 # this
1314 case $archos in
1315 ifp7xx)
1316 gdbstub="(G)DB stub, "
1320 esac
1322 echo ""
1323 echo "Build (N)ormal, (A)dvanced, (S)imulator, (B)ootloader, $gdbstub(M)anual (N)"
1325 option=`input`;
1327 case $option in
1328 [Bb])
1329 if test $t_manufacturer = "archos"; then
1330 # Archos SH-based players do this somewhat differently for
1331 # some reason
1332 appsdir='\$(ROOTDIR)/flash/bootbox'
1333 apps="bootbox"
1334 else
1335 appsdir='\$(ROOTDIR)/bootloader'
1336 apps="bootloader"
1337 flash=""
1338 if test -n "$boottool"; then
1339 tool="$boottool"
1341 if test -n "$bootoutput"; then
1342 output=$bootoutput
1345 extradefines="-DBOOTLOADER -ffunction-sections -fdata-sections"
1346 bootloader="1"
1347 echo "Bootloader build selected"
1349 [Ss])
1350 debug="-DDEBUG"
1351 simulator="yes"
1352 extradefines="-DSIMULATOR"
1353 echo "Simulator build selected"
1355 [Aa])
1356 echo "Advanced build selected"
1357 whichadvanced
1359 [Gg])
1360 extradefines="-DSTUB" # for target makefile symbol EXTRA_DEFINES
1361 appsdir='\$(ROOTDIR)/gdb'
1362 apps="stub"
1363 case $archos in
1364 ifp7xx)
1365 output="stub.wma"
1369 esac
1370 echo "GDB stub build selected"
1372 [Mm])
1373 appsdir='\$(ROOTDIR)/manual'
1374 firmdir='\$(ROOTDIR)/manual/platform' # No Makefile here. Effectively ignores target
1375 toolsdir=$firmdir;
1376 toolset='';
1377 apps="manual"
1378 echo "Manual build selected"
1381 debug=""
1382 echo "Normal build selected"
1385 esac
1386 # to be able running "make manual" from non-manual configuration
1387 case $archos in
1388 fmrecorder)
1389 manualdev="recorderv2fm"
1391 recorderv2)
1392 manualdev="recorderv2fm"
1394 h1??)
1395 manualdev="h1xx"
1397 ipodmini2g)
1398 manualdev="ipodmini"
1401 manualdev=$archos
1403 esac
1405 if [ -z "$debug" ]; then
1406 GCCOPTS="$GCCOPTS $GCCOPTIMIZE"
1409 echo "Using source code root directory: $rootdir"
1411 # this was once possible to change at build-time, but no more:
1412 language="english"
1414 # Ask about language if building voice
1415 if [ "yes" = "$voice" ]; then
1416 echo "Select a number for the language to use (default is english)"
1418 picklang
1419 voicelanguage=`whichlang`
1421 if [ -z "$voicelanguage" ]; then
1422 # pick a default
1423 voicelanguage="english"
1425 echo "Voice language set to $voicelanguage"
1428 uname=`uname`
1430 if [ "yes" = "$simulator" ]; then
1431 # setup compiler and things for simulator
1432 simcc
1434 if [ -d "archos" ]; then
1435 echo "sub directory archos already present"
1436 else
1437 mkdir archos
1438 echo "created an archos subdirectory for simulating the hard disk"
1442 # Now, figure out version number of the (gcc) compiler we are about to use
1443 gccver=`$CC -dumpversion`;
1445 if [ -z "$gccver" ]; then
1446 echo "WARNING: The compiler you must use ($CC) is not in your path!"
1447 echo "WARNING: this may cause your build to fail since we cannot do the"
1448 echo "WARNING: checks we want now."
1449 else
1451 # gccver should now be "3.3.5", "3.4.3", "2.95.3-6" and similar, but don't
1452 # DEPEND on it
1454 num1=`echo $gccver | cut -d . -f1`
1455 num2=`echo $gccver | cut -d . -f2`
1456 gccnum=`(expr $num1 "*" 100 + $num2) 2>/dev/null`
1458 # This makes:
1459 # 3.3.X => 303
1460 # 3.4.X => 304
1461 # 2.95.3 => 295
1463 echo "Using $CC $gccver ($gccnum)"
1465 if test "$gccnum" -ge "400"; then
1466 # gcc 4.0 is just *so* much pickier on arguments that differ in signedness
1467 # so we ignore that warnings for now
1468 # -Wno-pointer-sign
1469 GCCOPTS="$GCCOPTS -Wno-pointer-sign"
1472 if test "$gccnum" -ge "401"; then
1473 # this is a lame hack to avoid "warning: dereferencing type-punned pointer
1474 # will break strict-aliasing rules"
1476 GCCOPTS="$GCCOPTS -fno-strict-aliasing"
1481 # check the compiler for SH platforms
1482 if test "$CC" = "sh-elf-gcc"; then
1483 if test "$gccnum" -lt "400"; then
1484 echo "WARNING: Consider upgrading your compiler to the 4.0.X series!"
1485 echo "WARNING: http://www.rockbox.org/twiki/bin/view/Main/CrossCompiler"
1486 else
1487 # figure out patch status
1488 gccpatch=`$CC --version`;
1490 if { echo $gccpatch | grep "rockbox" >/dev/null 2>&1; } then
1491 echo "gcc $gccver is rockbox patched"
1492 # then convert -O to -Os to get smaller binaries!
1493 GCCOPTS=`echo $GCCOPTS | sed 's/ -O / -Os /'`
1494 else
1495 echo "WARNING: You use an unpatched gcc compiler: $gccver"
1496 echo "WARNING: http://www.rockbox.org/twiki/bin/view/Main/CrossCompiler"
1501 if test "$CC" = "m68k-elf-gcc"; then
1502 # convert -O to -Os to get smaller binaries!
1503 GCCOPTS=`echo $GCCOPTS | sed 's/ -O / -Os /'`
1506 if test "$1" = "--ccache"; then
1507 echo "Enable ccache for building"
1508 ccache="ccache"
1509 else
1510 if test "$1" != "--no-ccache"; then
1511 ccache=`findtool ccache`
1512 if test -n "$ccache"; then
1513 echo "Found and uses ccache ($ccache)"
1518 if test -n "$ccache"; then
1519 CC="$ccache $CC"
1522 if test "X$endian" = "Xbig"; then
1523 defendian="ROCKBOX_BIG_ENDIAN"
1524 else
1525 defendian="ROCKBOX_LITTLE_ENDIAN"
1528 sed > autoconf.h \
1529 -e "s,@ENDIAN@,${defendian},g" \
1530 -e "s,^#undef ROCKBOX_HAS_LOGF,$use_logf,g" \
1531 -e "s,@config_rtc@,$config_rtc,g" \
1532 -e "s,@have_rtc_alarm@,$have_rtc_alarm,g" \
1533 <<EOF
1534 /* This header was made by configure */
1535 #ifndef __BUILD_AUTOCONF_H
1536 #define __BUILD_AUTOCONF_H
1538 /* Define endianess for the target or simulator platform */
1539 #define @ENDIAN@ 1
1541 /* Define this if you build rockbox to support the logf logging and display */
1542 #undef ROCKBOX_HAS_LOGF
1544 /* optional defines for RTC mod for h1x0 */
1545 @config_rtc@
1546 @have_rtc_alarm@
1548 #endif /* __BUILD_AUTOCONF_H */
1551 if test -n "$t_cpu"; then
1552 TARGET_INC="-I\$(FIRMDIR)/target/$t_cpu/$t_manufacturer/$t_model"
1553 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/$t_cpu/$t_manufacturer"
1554 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/$t_cpu"
1555 GCCOPTS="$GCCOPTS"
1558 if test "$simulator" = "yes"; then
1559 # add simul make stuff on the #SIMUL# line
1560 simmagic1="s,@SIMUL1@,\$(SILENT)\$(MAKE) -C \$(SIMDIR) OBJDIR=\$(BUILDDIR)/sim,"
1561 simmagic2="s,@SIMUL2@,\$(SILENT)\$(MAKE) -C \$(ROOTDIR)/uisimulator/common OBJDIR=\$(BUILDDIR)/comsim,"
1562 else
1563 # delete the lines that match
1564 simmagic1='/@SIMUL1@/D'
1565 simmagic2='/@SIMUL2@/D'
1568 sed > Makefile \
1569 -e "s,@ROOTDIR@,${rootdir},g" \
1570 -e "s,@DEBUG@,${debug},g" \
1571 -e "s,@MEMORY@,${memory},g" \
1572 -e "s,@TARGET_ID@,${target_id},g" \
1573 -e "s,@TARGET@,${target},g" \
1574 -e "s,@CPU@,${t_cpu},g" \
1575 -e "s,@MANUFACTURER@,${t_manufacturer},g" \
1576 -e "s,@ARCHOS@,${archos},g" \
1577 -e "s,@LANGUAGE@,${language},g" \
1578 -e "s,@VOICELANGUAGE@,${voicelanguage},g" \
1579 -e "s,@PWD@,${pwd},g" \
1580 -e "s,@CC@,${CC},g" \
1581 -e "s,@LD@,${LD},g" \
1582 -e "s,@AR@,${AR},g" \
1583 -e "s,@AS@,${AS},g" \
1584 -e "s,@OC@,${OC},g" \
1585 -e "s,@WINDRES@,${WINDRES},g" \
1586 -e "s,@DLLTOOL@,${DLLTOOL},g" \
1587 -e "s,@DLLWRAP@,${DLLWRAP},g" \
1588 -e "s,@RANLIB@,${RANLIB},g" \
1589 -e "s,@TOOL@,${tool},g" \
1590 -e "s,@BMP2RB_NATIVE@,${bmp2rb_native},g" \
1591 -e "s,@BMP2RB_MONO@,${bmp2rb_mono},g" \
1592 -e "s,@BMP2RB_REMOTENATIVE@,${bmp2rb_remotenative},g" \
1593 -e "s,@BMP2RB_REMOTEMONO@,${bmp2rb_remotemono},g" \
1594 -e "s,@OUTPUT@,${output},g" \
1595 -e "s,@APPEXTRA@,${appextra},g" \
1596 -e "s,@ARCHOSROM@,${archosrom},g" \
1597 -e "s,@FLASHFILE@,${flash},g" \
1598 -e "s,@PLUGINS@,${plugins},g" \
1599 -e "s,@CODECS@,${swcodec},g" \
1600 -e "s,@PROFILE_OPTS@,${PROFILE_OPTS},g" \
1601 -e "s,@SHARED_FLAG@,${SHARED_FLAG},g" \
1602 -e "s,@GCCOPTS@,${GCCOPTS},g" \
1603 -e "s,@TARGET_INC@,${TARGET_INC},g" \
1604 -e "s!@LDOPTS@!${LDOPTS}!g" \
1605 -e "s,@LOADADDRESS@,${loadaddress},g" \
1606 -e "s,@EXTRADEF@,${extradefines},g" \
1607 -e "s,@APPSDIR@,${appsdir},g" \
1608 -e "s,@FIRMDIR@,${firmdir},g" \
1609 -e "s,@TOOLSDIR@,${toolsdir},g" \
1610 -e "s,@APPS@,${apps},g" \
1611 -e "s,@SIMVER@,${simver},g" \
1612 -e "s,@GCCVER@,${gccver},g" \
1613 -e "s,@GCCNUM@,${gccnum},g" \
1614 -e "s,@UNAME@,${uname},g" \
1615 -e "s,@ENDIAN@,${defendian},g" \
1616 -e "s,@TOOLSET@,${toolset},g" \
1617 -e "${simmagic1}" \
1618 -e "${simmagic2}" \
1619 -e "s,@MANUALDEV@,${manualdev},g" \
1620 <<EOF
1621 ## Automaticly generated. http://www.rockbox.org/
1623 ifndef V
1624 SILENT=@
1625 else
1626 VERBOSEOPT=-v
1627 endif
1629 # old 'make' versions don't have the built-in 'info' function
1630 info=old\$(shell echo >&2 "Consider upgrading to GNU make 3.81+ for optimum build performance.")
1631 ifeq (\$(call info),old)
1632 export info=echo "\$\$(1)";
1633 endif
1635 export ROOTDIR=@ROOTDIR@
1636 export FIRMDIR=@FIRMDIR@
1637 export APPSDIR=@APPSDIR@
1638 export TOOLSDIR=@TOOLSDIR@
1639 export DOCSDIR=\$(ROOTDIR)/docs
1640 export MANUALDIR=\${ROOTDIR}/manual
1641 export DEBUG=@DEBUG@
1642 export ARCHOS=@ARCHOS@
1643 export ARCHOSROM=@ARCHOSROM@
1644 export FLASHFILE=@FLASHFILE@
1645 export TARGET_ID=@TARGET_ID@
1646 export TARGET=@TARGET@
1647 export CPU=@CPU@
1648 export MANUFACTURER=@MANUFACTURER@
1649 export OBJDIR=@PWD@
1650 export BUILDDIR=@PWD@
1651 export LANGUAGE=@LANGUAGE@
1652 export VOICELANGUAGE=@VOICELANGUAGE@
1653 export MEMORYSIZE=@MEMORY@
1654 export VERSION=\$(shell \$(ROOTDIR)/tools/svnversion.sh \$(ROOTDIR))
1655 export BUILDDATE=\$(shell date -u +'-DYEAR=%Y -DMONTH=%m -DDAY=%d')
1656 export MKFIRMWARE=@TOOL@
1657 export BMP2RB_MONO=@BMP2RB_MONO@
1658 export BMP2RB_NATIVE=@BMP2RB_NATIVE@
1659 export BMP2RB_REMOTEMONO=@BMP2RB_REMOTEMONO@
1660 export BMP2RB_REMOTENATIVE=@BMP2RB_REMOTENATIVE@
1661 export BINARY=@OUTPUT@
1662 export APPEXTRA=@APPEXTRA@
1663 export ENABLEDPLUGINS=@PLUGINS@
1664 export SOFTWARECODECS=@CODECS@
1665 export EXTRA_DEFINES=@EXTRADEF@
1666 export HOSTCC=gcc
1667 export CC=@CC@
1668 export LD=@LD@
1669 export AR=@AR@
1670 export AS=@AS@
1671 export OC=@OC@
1672 export WINDRES=@WINDRES@
1673 export DLLTOOL=@DLLTOOL@
1674 export DLLWRAP=@DLLWRAP@
1675 export RANLIB=@RANLIB@
1676 export PROFILE_OPTS=@PROFILE_OPTS@
1677 export SIMVER=@SIMVER@
1678 export SIMDIR=\$(ROOTDIR)/uisimulator/sdl
1679 export GCCOPTS=@GCCOPTS@
1680 export TARGET_INC=@TARGET_INC@
1681 export LOADADDRESS=@LOADADDRESS@
1682 export SHARED_FLAG=@SHARED_FLAG@
1683 export LDOPTS=@LDOPTS@
1684 export GCCVER=@GCCVER@
1685 export GCCNUM=@GCCNUM@
1686 export UNAME=@UNAME@
1687 export MANUALDEV=@MANUALDEV@
1689 # Do not print "Entering directory ..."
1690 MAKEFLAGS += --no-print-directory
1692 .PHONY: all clean tags zip tools manual bin build info
1694 all: info
1696 info: build
1697 \$(SILENT)\$(TOOLSDIR)/mkinfo.pl \$(BUILDDIR)/rockbox-info.txt
1699 build: tools
1700 @SIMUL1@
1701 @SIMUL2@
1702 \$(SILENT)\$(MAKE) -C \$(FIRMDIR) OBJDIR=\$(BUILDDIR)/firmware
1703 \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@
1705 bin: tools
1706 @SIMUL1@
1707 @SIMUL2@
1708 \$(SILENT)\$(MAKE) -C \$(FIRMDIR) OBJDIR=\$(BUILDDIR)/firmware
1709 \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@ \$(BUILDDIR)/\$(BINARY)
1711 rocks: tools
1712 \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@ rocks
1714 veryclean: clean toolsclean
1716 toolsclean:
1717 \$(SILENT)\$(MAKE) -C \$(TOOLSDIR) clean
1719 clean:
1720 \$(SILENT)echo Cleaning build directory
1721 \$(SILENT)rm -rf rockbox.zip TAGS @APPS@ firmware comsim sim lang.[ch]\
1722 manual *.pdf *.a credits.raw @OUTPUT@ bitmaps pluginbitmaps \
1723 @ARCHOSROM@ @FLASHFILE@ UI256.bmp rockbox-full.zip \
1724 html txt rockbox-manual*.zip sysfont.h rockbox-info.txt \
1725 voicefontids *.wav *.mp3 *.voice
1727 voice: tools
1728 \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@ features
1729 \$(SILENT)for f in \`cat \$(BUILDDIR)/@APPS@/features\`; do feat="\$\$feat:\$\$f" ; done ; \\
1730 \$(TOOLSDIR)/genvoice.sh \$(ROOTDIR) \$(VOICELANGUAGE) \$(ARCHOS)\$\$feat \$(TARGET_ID) voicesettings.sh
1732 tools:
1733 \$(SILENT)\$(MAKE) -C \$(TOOLSDIR) CC=\$(HOSTCC) @TOOLSET@
1735 tags:
1736 \$(SILENT)rm -f TAGS
1737 \$(SILENT)\$(MAKE) -C \$(FIRMDIR) tags
1738 \$(SILENT)\$(MAKE) -C \$(APPSDIR) tags
1739 \$(SILENT)\$(MAKE) -C \$(APPSDIR)/plugins tags
1740 \$(SILENT)\$(MAKE) -C \$(APPSDIR)/plugins/lib tags
1742 fontzip:
1743 \$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -r "\$(ROOTDIR)" -f 1 -o rockbox-fonts.zip \$(TARGET) \$(BINARY)
1745 zip:
1746 \$(SILENT)for f in \`cat \$(BUILDDIR)/@APPS@/features\`; do feat="\$\$feat:\$\$f" ; done ; \\
1747 \$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\$\$feat\" -i \"\$(TARGET_ID)\" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
1749 mapzip:
1750 \$(SILENT)find . -name "*.map" | xargs zip rockbox-maps.zip
1752 fullzip:
1753 \$(SILENT)for f in \`cat \$(BUILDDIR)/@APPS@/features\`; do feat="\$\$feat:\$\$f" ; done; \\
1754 \$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\$\$feat\" -i \"\$(TARGET_ID)\" -r "\$(ROOTDIR)" -f 2 -o rockbox-full.zip \$(TARGET) \$(BINARY)
1756 7zip:
1757 \$(SILENT)for f in \`cat \$(BUILDDIR)/@APPS@/features\`; do feat="\$\$feat:\$\$f" ; done; \\
1758 \$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\$\$feat\" -i \"\$(TARGET_ID)\" -o "rockbox.7z" -z "7za a" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
1760 tar:
1761 \$(SILENT)rm -f rockbox.tar
1762 \$(SILENT)for f in \`cat \$(BUILDDIR)/@APPS@/features\`; do feat="\$\$feat:\$\$f" ; done; \\
1763 \$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\$\$feat\" -i \"\$(TARGET_ID)\" -o "rockbox.tar" -z "tar --no-recursion -uf" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
1765 bzip2: tar
1766 \$(SILENT)bzip2 -f9 rockbox.tar
1768 gzip: tar
1769 \$(SILENT)gzip -f9 rockbox.tar
1771 manual: manual-pdf
1772 manual-pdf:
1773 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-pdf
1774 manual-html:
1775 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-html
1776 manual-zhtml: manual-zip
1777 manual-txt:
1778 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-txt
1779 manual-ztxt:
1780 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-txt-zip
1781 manual-zip:
1782 \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-zip
1784 help:
1785 @echo "A few helpful make targets"
1786 @echo ""
1787 @echo "all - builds a full Rockbox (default), including tools"
1788 @echo "bin - builds only the Rockbox.<target name> file"
1789 @echo "clean - cleans a build directory (not tools)"
1790 @echo "veryclean - cleans the build and tools directories"
1791 @echo "manual - builds a manual"
1792 @echo "manual-html - HTML manual"
1793 @echo "manual-zip - HTML manual (zipped)"
1794 @echo "manual-txt - txt manual"
1795 @echo "fullzip - creates a rockbox.zip of your build with fonts"
1796 @echo "zip - creates a rockbox.zip of your build (no fonts)"
1797 @echo "gzip - creates a rockbox.tar.gz of your build (no fonts)"
1798 @echo "bzip2 - creates a rockbox.tar.bz2 of your build (no fonts)"
1799 @echo "7zip - creates a rockbox.7z of your build (no fonts)"
1800 @echo "fontzip - creates rockbox-fonts.zip"
1801 @echo "mapzip - creates rockbox-maps.zip with all .map files"
1802 @echo "tools - builds the tools only"
1803 @echo "install - installs your build (for simulator builds only)"
1807 if [ "yes" = "$simulator" ]; then
1809 cat >> Makefile <<EOF
1811 install:
1812 @echo "installing a full setup in your archos dir"
1813 @(\$(MAKE) fullzip && cd archos && unzip -oq ../rockbox-full.zip)
1818 echo "Created Makefile"