diff options
author | Daniel Stenberg <daniel@haxx.se> | 2005-02-18 13:47:17 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2005-02-18 13:47:17 +0000 |
commit | cdde25b597eb4047e9db27bb8bbcf938e4a43cfe (patch) | |
tree | d25f47817cc8515228c8ea0eb33ab71bfc2159d4 /tools | |
parent | f436476f9f0eeae4640197866ea5b5fa068df7e9 (diff) | |
download | rockbox-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-x | tools/buildzip.pl | 6 | ||||
-rwxr-xr-x | tools/configure | 235 |
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 | ||
167 | my $target = $ARGV[0]; | 167 | my $target = $ARGV[0]; |
168 | 168 | ||
169 | my $exe = ""; | 169 | my $exe = $ARGV[1]; |
170 | 170 | ||
171 | if($target !~ /sim/i) { | 171 | if(!$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 | ||
22 | prefixtools () { | ||
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 | |||
35 | crosswincc () { | ||
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 | |||
46 | simcc () { | ||
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 | |||
22 | shcc () { | 85 | shcc () { |
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 | ||
32 | calmrisccc () { | 91 | calmrisccc () { |
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 | ||
42 | coldfirecc () { | 97 | coldfirecc () { |
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 | |||
95 | fi | 153 | fi |
96 | } | 154 | } |
97 | 155 | ||
98 | |||
99 | simul () { | ||
100 | |||
101 | sed > 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 | |||
116 | export ARCHOS=@ARCHOS@ | ||
117 | export ROOTDIR=@ROOTDIR@ | ||
118 | export FIRMDIR=\$(ROOTDIR)/firmware | ||
119 | export APPSDIR=\$(ROOTDIR)/apps | ||
120 | export TOOLSDIR=\$(ROOTDIR)/tools | ||
121 | export DOCSDIR=\$(ROOTDIR)/docs | ||
122 | export APPSDIR=@ROOTDIR@/apps | ||
123 | export SIMDIR=\$(ROOTDIR)/uisimulator/@SIMVER@ | ||
124 | export DEBUG=@DEBUG@ | ||
125 | export KEYPAD=@KEYPAD@ | ||
126 | export OBJDIR=@PWD@ | ||
127 | export SIMVER=@SIMVER@ | ||
128 | export TARGET=@TARGET@ | ||
129 | export LANGUAGE=@LANGUAGE@ | ||
130 | export VERSION=\$(shell date +%y%m%d-%H%M) | ||
131 | export ENABLEDPLUGINS=@PLUGINS@ | ||
132 | export SOFTWARECODECS=@CODECS@ | ||
133 | export MEMORYSIZE=@MEMORY@ | ||
134 | |||
135 | .PHONY: | ||
136 | |||
137 | all: sim | ||
138 | |||
139 | sim: | ||
140 | \$(MAKE) -C \$(SIMDIR) | ||
141 | |||
142 | clean: | ||
143 | \$(MAKE) -C \$(SIMDIR) clean | ||
144 | rm -rf rockbox.zip | ||
145 | |||
146 | tags: | ||
147 | @rm -f TAGS | ||
148 | make -C \$(SIMDIR) tags | ||
149 | |||
150 | zip: | ||
151 | \$(TOOLSDIR)/buildzip.pl -r "\$(ROOTDIR)" sim\$(TARGET) | ||
152 | |||
153 | install: | ||
154 | @echo "installing a full setup in your archos dir" | ||
155 | @(make zip && cd archos && unzip -oq ../rockbox.zip) | ||
156 | EOF | ||
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 | |||
169 | picklang() { | 156 | picklang() { |
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 | |||
238 | else | 225 | else |
239 | 226 | ||
240 | echo "This script will setup your Rockbox build environment." | 227 | echo "This script will setup your Rockbox build environment." |
241 | echo "Further docs here: http://rockbox.haxx.se/docs/" | 228 | echo "Further docs here: http://www.rockbox.org/" |
242 | echo "" | 229 | echo "" |
243 | 230 | ||
244 | fi | 231 | fi |
@@ -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" |
505 | fi | 493 | fi |
506 | 494 | ||
495 | uname=`uname` | ||
496 | |||
507 | if [ "yes" = "$simulator" ]; then | 497 | if [ "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 | ||
507 | fi | ||
508 | |||
509 | # Now, figure out version number of the (gcc) compiler we are about to use | ||
510 | gccver=`$CC -dumpversion`; | ||
511 | |||
512 | if [ -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." | ||
516 | else | ||
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 | |||
511 | fi | 532 | fi |
512 | 533 | ||
513 | sed > Makefile \ | 534 | sed > 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 | ||
540 | export ROOTDIR=@ROOTDIR@ | 569 | export ROOTDIR=@ROOTDIR@ |
541 | export FIRMDIR=\$(ROOTDIR)/firmware | 570 | export FIRMDIR=\$(ROOTDIR)/firmware |
@@ -562,8 +591,17 @@ export LD=@LD@ | |||
562 | export AR=@AR@ | 591 | export AR=@AR@ |
563 | export AS=@AS@ | 592 | export AS=@AS@ |
564 | export OC=@OC@ | 593 | export OC=@OC@ |
594 | export WINDRES=@WINDRES@ | ||
595 | export DLLTOOL=@DLLTOOL@ | ||
596 | export DLLWRAP=@DLLWRAP@ | ||
597 | export RANLIB=@RANLIB@ | ||
565 | export GCCOPTS=@GCCOPTS@ | 598 | export GCCOPTS=@GCCOPTS@ |
566 | export LOADADDRESS=@LOADADDRESS@ | 599 | export LOADADDRESS=@LOADADDRESS@ |
600 | export SIMVER=@SIMVER@ | ||
601 | export SIMDIR=\$(ROOTDIR)/uisimulator/\$(SIMVER) | ||
602 | export LDOPTS=@LDOPTS@ | ||
603 | export GCCVER=@GCCVER@ | ||
604 | export 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 | ||
586 | zip: | 624 | zip: all |
587 | \$(TOOLSDIR)/buildzip.pl -r "\$(ROOTDIR)" \$(TARGET) | 625 | \$(TOOLSDIR)/buildzip.pl -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY) |
626 | EOF | ||
627 | |||
628 | if [ "yes" = "$simulator" ]; then | ||
629 | |||
630 | cat >> Makefile <<EOF | ||
631 | |||
632 | install: | ||
633 | @echo "installing a full setup in your archos dir" | ||
634 | @(make zip && cd archos && unzip -oq ../rockbox.zip) | ||
588 | EOF | 635 | EOF |
589 | 636 | ||
637 | fi | ||
638 | |||
590 | echo "Created Makefile" | 639 | echo "Created Makefile" |