summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2005-02-18 13:47:17 +0000
committerDaniel Stenberg <daniel@haxx.se>2005-02-18 13:47:17 +0000
commitcdde25b597eb4047e9db27bb8bbcf938e4a43cfe (patch)
treed25f47817cc8515228c8ea0eb33ab71bfc2159d4 /tools
parentf436476f9f0eeae4640197866ea5b5fa068df7e9 (diff)
downloadrockbox-cdde25b597eb4047e9db27bb8bbcf938e4a43cfe.tar.gz
rockbox-cdde25b597eb4047e9db27bb8bbcf938e4a43cfe.zip
Unified build system to use SOURCES for sim builds too, a single Makefile-look
made by configure and various related adjustments. This has not yet been tested on cygwin. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6001 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools')
-rwxr-xr-xtools/buildzip.pl6
-rwxr-xr-xtools/configure235
2 files changed, 145 insertions, 96 deletions
diff --git a/tools/buildzip.pl b/tools/buildzip.pl
index 2179298b8d..b44ed91e8e 100755
--- a/tools/buildzip.pl
+++ b/tools/buildzip.pl
@@ -166,10 +166,10 @@ sub runone {
166 166
167my $target = $ARGV[0]; 167my $target = $ARGV[0];
168 168
169my $exe = ""; 169my $exe = $ARGV[1];
170 170
171if($target !~ /sim/i) { 171if(!$exe) {
172 # not a simulator 172 # not specified, guess!
173 if($target =~ /(recorder|ondio)/i) { 173 if($target =~ /(recorder|ondio)/i) {
174 $exe = "ajbrec.ajz"; 174 $exe = "ajbrec.ajz";
175 } 175 }
diff --git a/tools/configure b/tools/configure
index ac007716bd..364a3d707e 100755
--- a/tools/configure
+++ b/tools/configure
@@ -19,32 +19,83 @@ input() {
19 echo $response 19 echo $response
20} 20}
21 21
22prefixtools () {
23 prefix="$1"
24 CC=${prefix}gcc
25 WINDRES=${prefix}windres
26 DLLTOOL=${prefix}dlltool
27 DLLWRAP=${prefix}dllwrap
28 RANLIB=${prefix}ranlib
29 LD=${prefix}ld
30 AR=${prefix}ar
31 AS=${prefix}as
32 OC=${prefix}objcopy
33}
34
35crosswincc () {
36 # naive approach to selecting a mingw cross-compiler on linux/*nix
37 echo "Enabling win32 crosscompiling"
38
39 prefixtools i386-mingw32msvc-
40
41 LDOPTS="-lgdi32 -luser32 -mwindows"
42 # add cross-compiler option(s)
43 GCCOPTS="$GCCOPTS -mno-cygwin"
44}
45
46simcc () {
47
48 # default tool setup for native building
49 prefixtools ""
50
51 GCCOPTS='-W -Wall -g -fno-builtin -I$(ROOTDIR)/uisimulator/common -I$(ROOTDIR)/uisimulator/$(SIMVER)'
52
53 output="rockboxui" # use this as default output binary name
54
55 case $uname in
56 CYGWIN*)
57 echo "Cygwin host detected"
58 LDOPTS='-L/usr/X11R6/lib -lSM -lICE -lXt -lX11 -lXmu -lSM -lICE -lX11 -lpthread'
59 output="rockboxui.exe" # use this as output binary name
60 ;;
61
62 Linux)
63 echo "Linux host detected"
64 LDOPTS='-L/usr/X11R6/lib -lX11 -lm -lXt -lXmu -lnsl -ldl -lpthread'
65 if [ "$simver" = "win32" ]; then
66 crosswincc # setup cross-compiler
67 fi
68 ;;
69
70 FreeBSD)
71 echo "FreeBSD host detected"
72 LDOPTS='-L/usr/X11R6/lib -lX11 -lm -lXt -lXmu -dl -lpthread'
73 if [ "$simver" = "win32" ]; then
74 crosswincc # setup cross-compiler
75 fi
76 ;;
77
78 *)
79 echo "Unsupported system: $uname, fix configure and retry"
80 exit
81 ;;
82 esac
83}
84
22shcc () { 85shcc () {
23 CC=sh-elf-gcc 86 prefixtools sh-elf-
24 LD=sh-elf-ld
25 AR=sh-elf-ar
26 AS=sh-elf-as
27 OC=sh-elf-objcopy
28 GCCOPTS="$CCOPTS -m1" 87 GCCOPTS="$CCOPTS -m1"
29 GCCOPTIMIZE="-fomit-frame-pointer -fschedule-insns" 88 GCCOPTIMIZE="-fomit-frame-pointer -fschedule-insns"
30} 89}
31 90
32calmrisccc () { 91calmrisccc () {
33 CC=calmrisc16-unknown-elf-gcc 92 prefixtools calmrisc16-unknown-elf-
34 LD=calmrisc16-unknown-elf-ld
35 AR=calmrisc16-unknown-elf-ar
36 AS=calmrisc16-unknown-elf-as
37 OC=calmrisc16-unknown-elf-objcopy
38 GCCOPTS="-Wl\,--no-check-sections $CCOPTS" 93 GCCOPTS="-Wl\,--no-check-sections $CCOPTS"
39 GCCOPTIMIZE="-fomit-frame-pointer" 94 GCCOPTIMIZE="-fomit-frame-pointer"
40} 95}
41 96
42coldfirecc () { 97coldfirecc () {
43 CC=m68k-elf-gcc 98 prefixtools m68k-elf-
44 LD=m68k-elf-ld
45 AR=m68k-elf-ar
46 AS=m68k-elf-as
47 OC=m68k-elf-objcopy
48 GCCOPTS="$CCOPTS -g -m5200 -Wa\,-m5249 -malign-int -mstrict-align" 99 GCCOPTS="$CCOPTS -g -m5200 -Wa\,-m5249 -malign-int -mstrict-align"
49 GCCOPTIMIZE="-fomit-frame-pointer" 100 GCCOPTIMIZE="-fomit-frame-pointer"
50} 101}
@@ -86,6 +137,13 @@ if [ -z "$simver" ]; then
86 case $option in 137 case $option in
87 [Ww]) 138 [Ww])
88 simver="win32" 139 simver="win32"
140
141 WINDRES=windres
142 DLLTOOL=dlltool
143 DLLWRAP=dllwrap
144
145 # make sure the code knows this is for win32
146 extradefines="$extradefines -DWIN32"
89 ;; 147 ;;
90 *) 148 *)
91 simver="x11" 149 simver="x11"
@@ -95,77 +153,6 @@ if [ -z "$simver" ]; then
95fi 153fi
96} 154}
97 155
98
99simul () {
100
101sed > Makefile \
102 -e "s,@ROOTDIR@,${rootdir},g" \
103 -e "s,@ARCHOS@,${archos},g" \
104 -e "s,@DEBUG@,${debug},g" \
105 -e "s,@KEYPAD@,${keypad},g" \
106 -e "s,@PWD@,${pwd},g" \
107 -e "s,@LANGUAGE@,${language},g" \
108 -e "s,@TARGET@,${target},g" \
109 -e "s,@PLUGINS@,${plugins},g" \
110 -e "s,@CODECS@,${codecs},g" \
111 -e "s,@SIMVER@,${simver},g" \
112 -e "s,@MEMORY@,${memory},g" \
113<<EOF
114## Automaticly generated. http://rockbox.haxx.se
115
116export ARCHOS=@ARCHOS@
117export ROOTDIR=@ROOTDIR@
118export FIRMDIR=\$(ROOTDIR)/firmware
119export APPSDIR=\$(ROOTDIR)/apps
120export TOOLSDIR=\$(ROOTDIR)/tools
121export DOCSDIR=\$(ROOTDIR)/docs
122export APPSDIR=@ROOTDIR@/apps
123export SIMDIR=\$(ROOTDIR)/uisimulator/@SIMVER@
124export DEBUG=@DEBUG@
125export KEYPAD=@KEYPAD@
126export OBJDIR=@PWD@
127export SIMVER=@SIMVER@
128export TARGET=@TARGET@
129export LANGUAGE=@LANGUAGE@
130export VERSION=\$(shell date +%y%m%d-%H%M)
131export ENABLEDPLUGINS=@PLUGINS@
132export SOFTWARECODECS=@CODECS@
133export MEMORYSIZE=@MEMORY@
134
135.PHONY:
136
137all: sim
138
139sim:
140 \$(MAKE) -C \$(SIMDIR)
141
142clean:
143 \$(MAKE) -C \$(SIMDIR) clean
144 rm -rf rockbox.zip
145
146tags:
147 @rm -f TAGS
148 make -C \$(SIMDIR) tags
149
150zip:
151 \$(TOOLSDIR)/buildzip.pl -r "\$(ROOTDIR)" sim\$(TARGET)
152
153install:
154 @echo "installing a full setup in your archos dir"
155 @(make zip && cd archos && unzip -oq ../rockbox.zip)
156EOF
157
158 echo "Created Makefile"
159
160 if [ -d "archos" ]; then
161 echo "sub directory archos already present"
162 else
163 mkdir archos
164 echo "created an archos subdirectory for simulating the hard disk"
165 fi
166
167}
168
169picklang() { 156picklang() {
170 # figure out which languages that are around 157 # figure out which languages that are around
171 for file in $rootdir/apps/lang/*.lang; do 158 for file in $rootdir/apps/lang/*.lang; do
@@ -238,7 +225,7 @@ if [ "$target" = "update" ]; then
238else 225else
239 226
240echo "This script will setup your Rockbox build environment." 227echo "This script will setup your Rockbox build environment."
241echo "Further docs here: http://rockbox.haxx.se/docs/" 228echo "Further docs here: http://www.rockbox.org/"
242echo "" 229echo ""
243 230
244fi 231fi
@@ -471,6 +458,7 @@ if [ -z "$debug" ]; then
471 [Ss]) 458 [Ss])
472 debug="1" 459 debug="1"
473 simulator="yes" 460 simulator="yes"
461 extradefines="-DSIMULATOR"
474 echo "Simulator build selected" 462 echo "Simulator build selected"
475 whichsim 463 whichsim
476 ;; 464 ;;
@@ -504,10 +492,43 @@ if [ -z "$language" ]; then
504 echo "Language set to $language" 492 echo "Language set to $language"
505fi 493fi
506 494
495uname=`uname`
496
507if [ "yes" = "$simulator" ]; then 497if [ "yes" = "$simulator" ]; then
508 # we have already dealt with the simulator Makefile separately 498 # setup compiler and things for simulator
509 simul 499 simcc
510 exit 500
501 if [ -d "archos" ]; then
502 echo "sub directory archos already present"
503 else
504 mkdir archos
505 echo "created an archos subdirectory for simulating the hard disk"
506 fi
507fi
508
509# Now, figure out version number of the (gcc) compiler we are about to use
510gccver=`$CC -dumpversion`;
511
512if [ -z "$gccver" ]; then
513 echo "WARNING: The compiler you must use ($CC) is not in your path!"
514 echo "WARNING: this may cause your build to fail since we cannot do the"
515 echo "WARNING: checks we want now."
516else
517
518 # gccver should now be "3.3.5", "3.4.3", "2.95.3-6" and similar, but don't
519 # DEPEND on it
520
521 num1=`echo $gccver | cut -d . -f1`
522 num2=`echo $gccver | cut -d . -f2`
523 gccnum=`(expr $num1 "*" 100 + $num2) 2>/dev/null`
524
525 # This makes:
526 # 3.3.X => 303
527 # 3.4.X => 304
528 # 2.95.3 => 295
529
530 echo "Using $CC $gccver ($gccnum)"
531
511fi 532fi
512 533
513sed > Makefile \ 534sed > Makefile \
@@ -523,6 +544,10 @@ sed > Makefile \
523 -e "s,@AR@,${AR},g" \ 544 -e "s,@AR@,${AR},g" \
524 -e "s,@AS@,${AS},g" \ 545 -e "s,@AS@,${AS},g" \
525 -e "s,@OC@,${OC},g" \ 546 -e "s,@OC@,${OC},g" \
547 -e "s,@WINDRES@,${WINDRES},g" \
548 -e "s,@DLLTOOL@,${DLLTOOL},g" \
549 -e "s,@DLLWRAP@,${DLLWRAP},g" \
550 -e "s,@RANLIB@,${RANLIB},g" \
526 -e "s,@TOOL@,${tool},g" \ 551 -e "s,@TOOL@,${tool},g" \
527 -e "s,@OUTPUT@,${output},g" \ 552 -e "s,@OUTPUT@,${output},g" \
528 -e "s,@APPEXTRA@,${appextra},g" \ 553 -e "s,@APPEXTRA@,${appextra},g" \
@@ -531,11 +556,15 @@ sed > Makefile \
531 -e "s,@PLUGINS@,${plugins},g" \ 556 -e "s,@PLUGINS@,${plugins},g" \
532 -e "s,@CODECS@,${codecs},g" \ 557 -e "s,@CODECS@,${codecs},g" \
533 -e "s,@GCCOPTS@,${GCCOPTS},g" \ 558 -e "s,@GCCOPTS@,${GCCOPTS},g" \
559 -e "s,@LDOPTS@,${LDOPTS},g" \
534 -e "s,@LOADADDRESS@,${loadaddress},g" \ 560 -e "s,@LOADADDRESS@,${loadaddress},g" \
535 -e "s,@EXTRADEF@,${extradefines},g" \ 561 -e "s,@EXTRADEF@,${extradefines},g" \
536 -e "s,@APPSDIR@,${appsdir},g" \ 562 -e "s,@APPSDIR@,${appsdir},g" \
563 -e "s,@SIMVER@,${simver},g" \
564 -e "s,@GCCVER@,${gccver},g" \
565 -e "s,@GCCNUM@,${gccnum},g" \
537<<EOF 566<<EOF
538## Automaticly generated. http://rockbox.haxx.se 567## Automaticly generated. http://www.rockbox.org/
539 568
540export ROOTDIR=@ROOTDIR@ 569export ROOTDIR=@ROOTDIR@
541export FIRMDIR=\$(ROOTDIR)/firmware 570export FIRMDIR=\$(ROOTDIR)/firmware
@@ -562,8 +591,17 @@ export LD=@LD@
562export AR=@AR@ 591export AR=@AR@
563export AS=@AS@ 592export AS=@AS@
564export OC=@OC@ 593export OC=@OC@
594export WINDRES=@WINDRES@
595export DLLTOOL=@DLLTOOL@
596export DLLWRAP=@DLLWRAP@
597export RANLIB=@RANLIB@
565export GCCOPTS=@GCCOPTS@ 598export GCCOPTS=@GCCOPTS@
566export LOADADDRESS=@LOADADDRESS@ 599export LOADADDRESS=@LOADADDRESS@
600export SIMVER=@SIMVER@
601export SIMDIR=\$(ROOTDIR)/uisimulator/\$(SIMVER)
602export LDOPTS=@LDOPTS@
603export GCCVER=@GCCVER@
604export GCCNUM=@GCCNUM@
567 605
568.PHONY: all clean tags zip 606.PHONY: all clean tags zip
569 607
@@ -583,8 +621,19 @@ tags:
583 \$(MAKE) -C \$(APPSDIR)/plugins tags 621 \$(MAKE) -C \$(APPSDIR)/plugins tags
584 \$(MAKE) -C \$(APPSDIR)/plugins/lib tags 622 \$(MAKE) -C \$(APPSDIR)/plugins/lib tags
585 623
586zip: 624zip: all
587 \$(TOOLSDIR)/buildzip.pl -r "\$(ROOTDIR)" \$(TARGET) 625 \$(TOOLSDIR)/buildzip.pl -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
626EOF
627
628if [ "yes" = "$simulator" ]; then
629
630 cat >> Makefile <<EOF
631
632install:
633 @echo "installing a full setup in your archos dir"
634 @(make zip && cd archos && unzip -oq ../rockbox.zip)
588EOF 635EOF
589 636
637fi
638
590echo "Created Makefile" 639echo "Created Makefile"