Daniel Stenberg | 3aacd2e | 2002-05-23 09:11:35 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # __________ __ ___. |
| 3 | # Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | # \/ \/ \/ \/ \/ |
| 8 | # $Id$ |
| 9 | # |
| 10 | |
Daniel Stenberg | 3aacd2e | 2002-05-23 09:11:35 +0000 | [diff] [blame] | 11 | |
Robert Hak | c3320ae | 2002-10-17 09:08:05 +0000 | [diff] [blame] | 12 | # |
| 13 | # Begin Function Definitions |
| 14 | # |
Daniel Stenberg | 3aacd2e | 2002-05-23 09:11:35 +0000 | [diff] [blame] | 15 | input() { |
| 16 | read response |
| 17 | echo $response |
| 18 | } |
| 19 | |
Robert Hak | 672b0e2 | 2002-10-17 09:19:34 +0000 | [diff] [blame] | 20 | whichsim () { |
Daniel Stenberg | 60fe9df | 2002-08-02 12:06:07 +0000 | [diff] [blame] | 21 | |
| 22 | if [ -z "$simver" ]; then |
| 23 | |
| 24 | ################################################################## |
| 25 | # Figure out win32/x11 GUI |
| 26 | # |
| 27 | echo "" |
| 28 | echo "Build (W)in32 or (X)11 GUI version? (X)" |
| 29 | |
| 30 | option=`input`; |
| 31 | |
| 32 | case $option in |
| 33 | [Ww]) |
| 34 | simver="win32" |
| 35 | ;; |
| 36 | *) |
| 37 | simver="x11" |
| 38 | ;; |
| 39 | esac |
Daniel Stenberg | ea9c5bb | 2003-02-26 09:13:47 +0000 | [diff] [blame] | 40 | echo "Selected $simver simulator" |
Daniel Stenberg | 60fe9df | 2002-08-02 12:06:07 +0000 | [diff] [blame] | 41 | fi |
Robert Hak | 672b0e2 | 2002-10-17 09:19:34 +0000 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | |
| 45 | simul () { |
Daniel Stenberg | 60fe9df | 2002-08-02 12:06:07 +0000 | [diff] [blame] | 46 | |
Daniel Stenberg | 58f4d0d | 2002-05-31 07:22:38 +0000 | [diff] [blame] | 47 | sed > Makefile \ |
Daniel Stenberg | 5c9c16f | 2004-05-26 11:07:16 +0000 | [diff] [blame] | 48 | -e "s,@ROOTDIR@,${rootdir},g" \ |
Daniel Stenberg | f092920 | 2003-01-16 14:37:30 +0000 | [diff] [blame] | 49 | -e "s,@ARCHOS@,${archos},g" \ |
Daniel Stenberg | 58f4d0d | 2002-05-31 07:22:38 +0000 | [diff] [blame] | 50 | -e "s,@DEBUG@,${debug},g" \ |
| 51 | -e "s,@DISPLAY@,${display},g" \ |
| 52 | -e "s,@KEYPAD@,${keypad},g" \ |
| 53 | -e "s,@PWD@,${pwd},g" \ |
Daniel Stenberg | ebe963d | 2002-09-20 06:38:38 +0000 | [diff] [blame] | 54 | -e "s,@LANGUAGE@,${language},g" \ |
Daniel Stenberg | f69c703 | 2004-06-14 15:05:58 +0000 | [diff] [blame] | 55 | -e "s,@TARGET@,${target},g" \ |
Daniel Stenberg | 60fe9df | 2002-08-02 12:06:07 +0000 | [diff] [blame] | 56 | -e "s,@SIMVER@,${simver},g" \ |
Daniel Stenberg | 58f4d0d | 2002-05-31 07:22:38 +0000 | [diff] [blame] | 57 | <<EOF |
Björn Stenberg | cd22573 | 2002-08-11 09:17:47 +0000 | [diff] [blame] | 58 | ## Automaticly generated. http://rockbox.haxx.se |
Daniel Stenberg | 58f4d0d | 2002-05-31 07:22:38 +0000 | [diff] [blame] | 59 | |
Daniel Stenberg | f092920 | 2003-01-16 14:37:30 +0000 | [diff] [blame] | 60 | ARCHOS=@ARCHOS@ |
Daniel Stenberg | 5c9c16f | 2004-05-26 11:07:16 +0000 | [diff] [blame] | 61 | ROOTDIR=@ROOTDIR@ |
| 62 | SIMDIR=\$(ROOTDIR)/uisimulator/@SIMVER@ |
Daniel Stenberg | f69c703 | 2004-06-14 15:05:58 +0000 | [diff] [blame] | 63 | TOOLSDIR=\$(ROOTDIR)/tools |
Daniel Stenberg | 58f4d0d | 2002-05-31 07:22:38 +0000 | [diff] [blame] | 64 | DEBUG=@DEBUG@ |
Daniel Stenberg | 58f4d0d | 2002-05-31 07:22:38 +0000 | [diff] [blame] | 65 | DISPLAY=@DISPLAY@ |
| 66 | KEYPAD=@KEYPAD@ |
| 67 | THISDIR="@PWD@" |
Daniel Stenberg | 60fe9df | 2002-08-02 12:06:07 +0000 | [diff] [blame] | 68 | SIMVER=@SIMVER@ |
Daniel Stenberg | f69c703 | 2004-06-14 15:05:58 +0000 | [diff] [blame] | 69 | TARGET=@TARGET@ |
Daniel Stenberg | ebe963d | 2002-09-20 06:38:38 +0000 | [diff] [blame] | 70 | LANGUAGE=@LANGUAGE@ |
Björn Stenberg | 6d55a71 | 2002-07-15 13:19:00 +0000 | [diff] [blame] | 71 | VERSION=\$(shell date +%y%m%d-%H%M) |
Daniel Stenberg | 58f4d0d | 2002-05-31 07:22:38 +0000 | [diff] [blame] | 72 | |
Linus Nielsen Feltzing | e53bdf0 | 2002-07-26 14:13:03 +0000 | [diff] [blame] | 73 | .PHONY: |
Daniel Stenberg | 58f4d0d | 2002-05-31 07:22:38 +0000 | [diff] [blame] | 74 | |
| 75 | all: sim |
| 76 | |
| 77 | sim: |
Daniel Stenberg | 7eda324 | 2003-11-26 14:10:21 +0000 | [diff] [blame] | 78 | \$(MAKE) -C \$(SIMDIR) DISPLAY=\$(DISPLAY) KEYPAD=\$(KEYPAD) OBJDIR=\$(THISDIR) VERSION=\$(VERSION) LANGUAGE=\$(LANGUAGE) |
Daniel Stenberg | 58f4d0d | 2002-05-31 07:22:38 +0000 | [diff] [blame] | 79 | |
Daniel Stenberg | 6246ce5 | 2002-08-15 10:07:27 +0000 | [diff] [blame] | 80 | clean: |
Daniel Stenberg | 23d0b5d | 2002-08-07 14:37:53 +0000 | [diff] [blame] | 81 | \$(MAKE) -C \$(SIMDIR) DISPLAY=\$(DISPLAY) KEYPAD=\$(KEYPAD) OBJDIR=\$(THISDIR) clean |
Daniel Stenberg | 58f4d0d | 2002-05-31 07:22:38 +0000 | [diff] [blame] | 82 | |
Daniel Stenberg | 6246ce5 | 2002-08-15 10:07:27 +0000 | [diff] [blame] | 83 | tags: |
| 84 | @rm -f TAGS |
| 85 | make -C \$(SIMDIR) DISPLAY=\$(DISPLAY) KEYPAD=\$(KEYPAD) OBJDIR=\$(THISDIR) tags |
Daniel Stenberg | 58f4d0d | 2002-05-31 07:22:38 +0000 | [diff] [blame] | 86 | |
Daniel Stenberg | f69c703 | 2004-06-14 15:05:58 +0000 | [diff] [blame] | 87 | zip: |
| 88 | \$(TOOLSDIR)/buildzip.pl sim\$(TARGET) |
| 89 | |
| 90 | install: |
| 91 | @echo "installing a full setup in your archos dir" |
| 92 | @(make zip && cd archos && unzip -oq ../rockbox.zip) |
Daniel Stenberg | 58f4d0d | 2002-05-31 07:22:38 +0000 | [diff] [blame] | 93 | EOF |
| 94 | |
Daniel Stenberg | e45a8f5 | 2002-06-06 13:33:38 +0000 | [diff] [blame] | 95 | echo "Created Makefile" |
Daniel Stenberg | 45abe61 | 2002-05-31 08:38:35 +0000 | [diff] [blame] | 96 | |
Daniel Stenberg | e45a8f5 | 2002-06-06 13:33:38 +0000 | [diff] [blame] | 97 | if [ -d "archos" ]; then |
| 98 | echo "sub directory archos already present" |
| 99 | else |
| 100 | mkdir archos |
| 101 | echo "created an archos subdirectory for simulating the hard disk" |
| 102 | fi |
Daniel Stenberg | 45abe61 | 2002-05-31 08:38:35 +0000 | [diff] [blame] | 103 | |
Daniel Stenberg | 58f4d0d | 2002-05-31 07:22:38 +0000 | [diff] [blame] | 104 | } |
| 105 | |
Robert Hak | c3320ae | 2002-10-17 09:08:05 +0000 | [diff] [blame] | 106 | picklang() { |
| 107 | # figure out which languages that are around |
Daniel Stenberg | 5c9c16f | 2004-05-26 11:07:16 +0000 | [diff] [blame] | 108 | for file in $rootdir/apps/lang/*.lang; do |
Robert Hak | c3320ae | 2002-10-17 09:08:05 +0000 | [diff] [blame] | 109 | clean=`echo $file | sed -e 's:.*/::g' | cut "-d." -f1` |
| 110 | langs="$langs $clean" |
| 111 | done |
| 112 | |
| 113 | num=1 |
| 114 | for one in $langs; do |
| 115 | echo "$num. $one" |
| 116 | num=`expr $num + 1` |
| 117 | done |
| 118 | |
| 119 | read pick |
| 120 | return $pick; |
| 121 | } |
| 122 | |
| 123 | whichlang() { |
| 124 | num=1 |
| 125 | for one in $langs; do |
| 126 | if [ "$num" = "$pick" ]; then |
| 127 | echo $one |
| 128 | return |
| 129 | fi |
| 130 | num=`expr $num + 1` |
| 131 | done |
| 132 | } |
| 133 | |
Robert Hak | c3320ae | 2002-10-17 09:08:05 +0000 | [diff] [blame] | 134 | target=$1 |
| 135 | debug=$2 |
| 136 | |
| 137 | if test "$1" = "--help"; then |
| 138 | echo "Rockbox configure script." |
| 139 | echo "Invoke this in a directory to generate a Makefile to build Rockbox" |
| 140 | echo "Do *NOT* run this within the tools directory!" |
| 141 | exit |
| 142 | fi |
| 143 | |
| 144 | if test -r "configure"; then |
| 145 | # this is a check for a configure script in the current directory, it there |
| 146 | # is one, try to figure out if it is this one! |
| 147 | |
| 148 | if { grep "^# Jukebox" configure >/dev/null 2>&1 ; } then |
| 149 | echo "WEEEEEEEEP. Don't run this configure script within the tools directory." |
| 150 | echo "It will only cause you pain and grief. Instead do this:" |
| 151 | echo "" |
| 152 | echo " cd .." |
| 153 | echo " mkdir build-dir" |
| 154 | echo " cd build-dir" |
| 155 | echo " ../tools/configure" |
| 156 | echo "" |
| 157 | echo "Much happiness will arise from this. Enjoy" |
| 158 | exit |
| 159 | fi |
| 160 | fi |
| 161 | |
Daniel Stenberg | c38ccba | 2002-05-31 08:21:20 +0000 | [diff] [blame] | 162 | if [ "$target" = "--help" -o \ |
| 163 | "$target" = "-h" ]; then |
| 164 | echo "Just invoke the script and answer the questions." |
| 165 | echo "This script will write a Makefile for you" |
| 166 | exit |
| 167 | fi |
| 168 | |
Daniel Stenberg | 58f4d0d | 2002-05-31 07:22:38 +0000 | [diff] [blame] | 169 | # get our current directory |
| 170 | pwd=`pwd`; |
Daniel Stenberg | 3aacd2e | 2002-05-23 09:11:35 +0000 | [diff] [blame] | 171 | |
Daniel Stenberg | 6709658 | 2002-05-23 10:10:44 +0000 | [diff] [blame] | 172 | if [ "$target" = "update" ]; then |
Daniel Stenberg | ea9c5bb | 2003-02-26 09:13:47 +0000 | [diff] [blame] | 173 | update="1" |
Daniel Stenberg | 6709658 | 2002-05-23 10:10:44 +0000 | [diff] [blame] | 174 | target="" |
| 175 | if [ -f Makefile ]; then |
| 176 | if { grep "^## Auto" Makefile >/dev/null 2>&1 ; } then |
| 177 | echo "Existing generated Makefile found. Getting defaults from it." |
Daniel Stenberg | f092920 | 2003-01-16 14:37:30 +0000 | [diff] [blame] | 178 | archos=`grep "^ARCHOS=" Makefile | cut -d= -f2-` |
Daniel Stenberg | 6709658 | 2002-05-23 10:10:44 +0000 | [diff] [blame] | 179 | debug=`grep "^DEBUG=" Makefile | cut -d= -f2-` |
Daniel Stenberg | ebe963d | 2002-09-20 06:38:38 +0000 | [diff] [blame] | 180 | language=`grep "^LANGUAGE=" Makefile | cut -d= -f2-` |
Daniel Stenberg | ea9c5bb | 2003-02-26 09:13:47 +0000 | [diff] [blame] | 181 | memory=`grep "^MEMORYSIZE=" Makefile | cut -d= -f2-` |
Daniel Stenberg | 5c9c16f | 2004-05-26 11:07:16 +0000 | [diff] [blame] | 182 | rootdir=`grep "^ROOTDIR=" Makefile | cut -d= -f2-` |
Daniel Stenberg | f69c703 | 2004-06-14 15:05:58 +0000 | [diff] [blame] | 183 | target=`grep "^TARGET=" Makefile | cut -d= -f2-` |
Daniel Stenberg | 63787df | 2002-06-03 21:56:48 +0000 | [diff] [blame] | 184 | |
| 185 | if [ "$debug" = "SIMULATOR=1" ]; then |
| 186 | simulator="yes" |
Daniel Stenberg | d86da20 | 2002-06-03 22:26:56 +0000 | [diff] [blame] | 187 | display=`grep "^DISPLAY=" Makefile | cut -d= -f2-` |
| 188 | keypad=`grep "^KEYPAD=" Makefile | cut -d= -f2-` |
Daniel Stenberg | 60fe9df | 2002-08-02 12:06:07 +0000 | [diff] [blame] | 189 | simver=`grep "^SIMVER=" Makefile | cut -d= -f2-` |
Daniel Stenberg | 63787df | 2002-06-03 21:56:48 +0000 | [diff] [blame] | 190 | fi |
Daniel Stenberg | 6709658 | 2002-05-23 10:10:44 +0000 | [diff] [blame] | 191 | fi |
| 192 | fi |
Daniel Stenberg | 58f4d0d | 2002-05-31 07:22:38 +0000 | [diff] [blame] | 193 | else |
| 194 | |
Daniel Stenberg | ea9c5bb | 2003-02-26 09:13:47 +0000 | [diff] [blame] | 195 | echo "This script will setup your Rockbox build environment." |
| 196 | echo "Further docs here: http://rockbox.haxx.se/docs/" |
Daniel Stenberg | 58f4d0d | 2002-05-31 07:22:38 +0000 | [diff] [blame] | 197 | echo "" |
| 198 | |
Daniel Stenberg | 6709658 | 2002-05-23 10:10:44 +0000 | [diff] [blame] | 199 | fi |
| 200 | |
Daniel Stenberg | f092920 | 2003-01-16 14:37:30 +0000 | [diff] [blame] | 201 | if [ -z "$archos" ]; then |
Daniel Stenberg | 3aacd2e | 2002-05-23 09:11:35 +0000 | [diff] [blame] | 202 | |
| 203 | ################################################################## |
| 204 | # Figure out target platform |
| 205 | # |
| 206 | |
Daniel Stenberg | 503ce1b | 2003-12-12 10:48:40 +0000 | [diff] [blame] | 207 | echo "Enter target platform: (default is Archos Recorder)" |
Daniel Stenberg | 3aacd2e | 2002-05-23 09:11:35 +0000 | [diff] [blame] | 208 | |
Linus Nielsen Feltzing | 0a4b247 | 2002-10-15 12:25:57 +0000 | [diff] [blame] | 209 | echo "1 - Archos Player/Studio" |
| 210 | echo "2 - Archos Recorder" |
Daniel Stenberg | f092920 | 2003-01-16 14:37:30 +0000 | [diff] [blame] | 211 | echo "3 - Archos FM Recorder" |
Daniel Stenberg | 86b146d | 2003-11-19 06:40:59 +0000 | [diff] [blame] | 212 | echo "4 - Archos Recorder v2" |
Daniel Stenberg | 503ce1b | 2003-12-12 10:48:40 +0000 | [diff] [blame] | 213 | echo "5 - Neo mStation" |
| 214 | echo "6 - Neo 35" |
Daniel Stenberg | 3aacd2e | 2002-05-23 09:11:35 +0000 | [diff] [blame] | 215 | |
| 216 | getit=`input`; |
| 217 | |
| 218 | case $getit in |
| 219 | |
| 220 | 1) |
Daniel Stenberg | f092920 | 2003-01-16 14:37:30 +0000 | [diff] [blame] | 221 | archos="player" |
Daniel Stenberg | 3aacd2e | 2002-05-23 09:11:35 +0000 | [diff] [blame] | 222 | target="-DARCHOS_PLAYER" |
Daniel Stenberg | 58f4d0d | 2002-05-31 07:22:38 +0000 | [diff] [blame] | 223 | display="-DHAVE_LCD_CHARCELLS" |
| 224 | keypad="-DHAVE_PLAYER_KEYPAD" |
Daniel Stenberg | 3aacd2e | 2002-05-23 09:11:35 +0000 | [diff] [blame] | 225 | ;; |
| 226 | |
Daniel Stenberg | f092920 | 2003-01-16 14:37:30 +0000 | [diff] [blame] | 227 | 3) |
| 228 | archos="fmrecorder" |
| 229 | target="-DARCHOS_FMRECORDER" |
| 230 | display="-DHAVE_LCD_BITMAP" |
| 231 | keypad="-DHAVE_RECORDER_KEYPAD" |
| 232 | ;; |
| 233 | |
Daniel Stenberg | 86b146d | 2003-11-19 06:40:59 +0000 | [diff] [blame] | 234 | 4) |
| 235 | archos="recorderv2" |
| 236 | target="-DARCHOS_RECORDERV2" |
| 237 | display="-DHAVE_LCD_BITMAP" |
| 238 | keypad="-DHAVE_RECORDER_KEYPAD" |
| 239 | ;; |
| 240 | |
Daniel Stenberg | 503ce1b | 2003-12-12 10:48:40 +0000 | [diff] [blame] | 241 | 5) |
| 242 | archos="neomstation" |
| 243 | target="-DNEO_MSTATION" |
| 244 | display="-DHAVE_NEOLCD_CHARCELLS" |
| 245 | keypad="-DHAVE_NEO_KEYPAD" |
| 246 | ;; |
| 247 | |
| 248 | 6) |
| 249 | archos="neo35" |
| 250 | target="-DNEO_35" |
| 251 | display="-DHAVE_NEOLCD_CHARCELLS" |
| 252 | keypad="-DHAVE_NEO_KEYPAD" |
| 253 | ;; |
| 254 | |
Daniel Stenberg | f092920 | 2003-01-16 14:37:30 +0000 | [diff] [blame] | 255 | *) |
| 256 | archos="recorder" |
Daniel Stenberg | 3aacd2e | 2002-05-23 09:11:35 +0000 | [diff] [blame] | 257 | target="-DARCHOS_RECORDER" |
Daniel Stenberg | 58f4d0d | 2002-05-31 07:22:38 +0000 | [diff] [blame] | 258 | display="-DHAVE_LCD_BITMAP" |
| 259 | keypad="-DHAVE_RECORDER_KEYPAD" |
Daniel Stenberg | 3aacd2e | 2002-05-23 09:11:35 +0000 | [diff] [blame] | 260 | ;; |
| 261 | |
Daniel Stenberg | 3aacd2e | 2002-05-23 09:11:35 +0000 | [diff] [blame] | 262 | esac |
Daniel Stenberg | ea9c5bb | 2003-02-26 09:13:47 +0000 | [diff] [blame] | 263 | |
| 264 | echo "Platform set to $archos" |
| 265 | |
| 266 | fi |
| 267 | |
| 268 | if [ -z "$memory" ]; then |
| 269 | size="2" |
| 270 | if [ -z "$update" ]; then |
| 271 | echo "Enter size of your RAM (in MB): (defaults to 2)" |
| 272 | size=`input`; |
| 273 | fi |
| 274 | |
| 275 | case $size in |
| 276 | 8) |
| 277 | memory="8" |
| 278 | ;; |
| 279 | *) |
| 280 | memory="2" |
| 281 | ;; |
| 282 | |
| 283 | esac |
| 284 | echo "Memory size selected: $memory MB" |
Daniel Stenberg | 3aacd2e | 2002-05-23 09:11:35 +0000 | [diff] [blame] | 285 | fi |
| 286 | |
Daniel Stenberg | 6709658 | 2002-05-23 10:10:44 +0000 | [diff] [blame] | 287 | if [ -z "$debug" ]; then |
| 288 | ################################################################## |
| 289 | # Figure out debug on/off |
| 290 | # |
Daniel Stenberg | 58f4d0d | 2002-05-31 07:22:38 +0000 | [diff] [blame] | 291 | echo "Build (N)ormal, (D)ebug or (S)imulated version? (N)" |
Daniel Stenberg | 3aacd2e | 2002-05-23 09:11:35 +0000 | [diff] [blame] | 292 | |
Daniel Stenberg | 6709658 | 2002-05-23 10:10:44 +0000 | [diff] [blame] | 293 | option=`input`; |
Daniel Stenberg | 3aacd2e | 2002-05-23 09:11:35 +0000 | [diff] [blame] | 294 | |
Daniel Stenberg | 6709658 | 2002-05-23 10:10:44 +0000 | [diff] [blame] | 295 | case $option in |
Daniel Stenberg | 58f4d0d | 2002-05-31 07:22:38 +0000 | [diff] [blame] | 296 | [Ss]) |
| 297 | debug="SIMULATOR=1" |
| 298 | simulator="yes" |
Daniel Stenberg | ea9c5bb | 2003-02-26 09:13:47 +0000 | [diff] [blame] | 299 | echo "Simulator build selected" |
Robert Hak | 672b0e2 | 2002-10-17 09:19:34 +0000 | [diff] [blame] | 300 | whichsim |
Daniel Stenberg | 58f4d0d | 2002-05-31 07:22:38 +0000 | [diff] [blame] | 301 | ;; |
| 302 | [Dd]) |
Daniel Stenberg | 6709658 | 2002-05-23 10:10:44 +0000 | [diff] [blame] | 303 | debug="DEBUG=1" |
Daniel Stenberg | ea9c5bb | 2003-02-26 09:13:47 +0000 | [diff] [blame] | 304 | echo "Debug build selected" |
Daniel Stenberg | 6709658 | 2002-05-23 10:10:44 +0000 | [diff] [blame] | 305 | ;; |
| 306 | *) |
Daniel Stenberg | 44d76bc | 2002-05-24 10:14:10 +0000 | [diff] [blame] | 307 | debug="NODEBUG=1" |
Daniel Stenberg | ea9c5bb | 2003-02-26 09:13:47 +0000 | [diff] [blame] | 308 | echo "Normal build selected" |
Daniel Stenberg | 6709658 | 2002-05-23 10:10:44 +0000 | [diff] [blame] | 309 | ;; |
Daniel Stenberg | 3aacd2e | 2002-05-23 09:11:35 +0000 | [diff] [blame] | 310 | |
Daniel Stenberg | 6709658 | 2002-05-23 10:10:44 +0000 | [diff] [blame] | 311 | esac |
| 312 | fi |
| 313 | |
Daniel Stenberg | 5c9c16f | 2004-05-26 11:07:16 +0000 | [diff] [blame] | 314 | if [ -z "$rootdir" ]; then |
| 315 | ################################################################## |
| 316 | # Figure out where the source code root is! |
| 317 | # |
Daniel Stenberg | 3aacd2e | 2002-05-23 09:11:35 +0000 | [diff] [blame] | 318 | |
Daniel Stenberg | 5c9c16f | 2004-05-26 11:07:16 +0000 | [diff] [blame] | 319 | firmfile="crt0.S" # a file to check for in the firmware root dir |
Daniel Stenberg | 3aacd2e | 2002-05-23 09:11:35 +0000 | [diff] [blame] | 320 | |
Daniel Stenberg | 052d21a | 2004-05-26 11:18:40 +0000 | [diff] [blame] | 321 | for dir in . .. ../.. ../rockbox*; do |
Daniel Stenberg | 5c9c16f | 2004-05-26 11:07:16 +0000 | [diff] [blame] | 322 | if [ -f $dir/firmware/$firmfile ]; then |
| 323 | rootdir=$dir |
| 324 | break |
Daniel Stenberg | 31e0cd6 | 2003-04-22 22:18:57 +0000 | [diff] [blame] | 325 | fi |
| 326 | done |
| 327 | |
Daniel Stenberg | 5c9c16f | 2004-05-26 11:07:16 +0000 | [diff] [blame] | 328 | if [ -z "$rootdir" ]; then |
| 329 | echo "This script couldn't find your source code root directory. Please enter the" |
| 330 | echo "full path to the source code directory here:" |
| 331 | |
| 332 | firmdir=`input` |
| 333 | fi |
| 334 | |
| 335 | ##################################################################### |
| 336 | # Convert the possibly relative directory name to an absolute version |
| 337 | # |
| 338 | now=`pwd` |
| 339 | cd $rootdir |
| 340 | rootdir=`pwd` |
| 341 | |
Daniel Stenberg | 052d21a | 2004-05-26 11:18:40 +0000 | [diff] [blame] | 342 | echo "Using this source code root directory:" |
| 343 | echo $rootdir |
| 344 | echo "" |
| 345 | |
Daniel Stenberg | 5c9c16f | 2004-05-26 11:07:16 +0000 | [diff] [blame] | 346 | # cd back to the build dir |
| 347 | cd $now |
Daniel Stenberg | 31e0cd6 | 2003-04-22 22:18:57 +0000 | [diff] [blame] | 348 | fi |
| 349 | |
Daniel Stenberg | 31e0cd6 | 2003-04-22 22:18:57 +0000 | [diff] [blame] | 350 | |
Daniel Stenberg | ebe963d | 2002-09-20 06:38:38 +0000 | [diff] [blame] | 351 | if [ -z "$language" ]; then |
| 352 | |
| 353 | echo "Select a number for the language to use (default is english)" |
| 354 | |
| 355 | picklang |
| 356 | language=`whichlang` |
| 357 | |
| 358 | if [ -z "$language" ]; then |
| 359 | # pick a default |
| 360 | language="english" |
| 361 | fi |
Daniel Stenberg | ea9c5bb | 2003-02-26 09:13:47 +0000 | [diff] [blame] | 362 | echo "Language set to $language" |
Daniel Stenberg | ebe963d | 2002-09-20 06:38:38 +0000 | [diff] [blame] | 363 | fi |
| 364 | |
Robert Hak | 9465d4e | 2002-10-17 09:14:57 +0000 | [diff] [blame] | 365 | if [ "yes" = "$simulator" ]; then |
| 366 | # we have already dealt with the simulator Makefile separately |
Robert Hak | 672b0e2 | 2002-10-17 09:19:34 +0000 | [diff] [blame] | 367 | simul |
Robert Hak | 9465d4e | 2002-10-17 09:14:57 +0000 | [diff] [blame] | 368 | exit |
| 369 | fi |
| 370 | |
Daniel Stenberg | e0c12af | 2002-05-23 09:39:31 +0000 | [diff] [blame] | 371 | sed > Makefile \ |
Daniel Stenberg | 5c9c16f | 2004-05-26 11:07:16 +0000 | [diff] [blame] | 372 | -e "s,@ROOTDIR@,${rootdir},g" \ |
Daniel Stenberg | e0c12af | 2002-05-23 09:39:31 +0000 | [diff] [blame] | 373 | -e "s,@DEBUG@,${debug},g" \ |
Daniel Stenberg | ea9c5bb | 2003-02-26 09:13:47 +0000 | [diff] [blame] | 374 | -e "s,@MEMORY@,${memory},g" \ |
Daniel Stenberg | e0c12af | 2002-05-23 09:39:31 +0000 | [diff] [blame] | 375 | -e "s,@TARGET@,${target},g" \ |
Daniel Stenberg | f092920 | 2003-01-16 14:37:30 +0000 | [diff] [blame] | 376 | -e "s,@ARCHOS@,${archos},g" \ |
Daniel Stenberg | ebe963d | 2002-09-20 06:38:38 +0000 | [diff] [blame] | 377 | -e "s,@LANGUAGE@,${language},g" \ |
Daniel Stenberg | e0c12af | 2002-05-23 09:39:31 +0000 | [diff] [blame] | 378 | -e "s,@PWD@,${pwd},g" \ |
| 379 | <<EOF |
Björn Stenberg | cd22573 | 2002-08-11 09:17:47 +0000 | [diff] [blame] | 380 | ## Automaticly generated. http://rockbox.haxx.se |
Daniel Stenberg | 6709658 | 2002-05-23 10:10:44 +0000 | [diff] [blame] | 381 | |
Daniel Stenberg | 5c9c16f | 2004-05-26 11:07:16 +0000 | [diff] [blame] | 382 | ROOTDIR=@ROOTDIR@ |
| 383 | FIRMDIR=\$(ROOTDIR)/firmware |
| 384 | APPSDIR=\$(ROOTDIR)/apps |
| 385 | TOOLSDIR=\$(ROOTDIR)/tools |
Daniel Stenberg | 3aacd2e | 2002-05-23 09:11:35 +0000 | [diff] [blame] | 386 | DEBUG=@DEBUG@ |
Daniel Stenberg | f092920 | 2003-01-16 14:37:30 +0000 | [diff] [blame] | 387 | ARCHOS=@ARCHOS@ |
Daniel Stenberg | 3aacd2e | 2002-05-23 09:11:35 +0000 | [diff] [blame] | 388 | TARGET=@TARGET@ |
Daniel Stenberg | e0c12af | 2002-05-23 09:39:31 +0000 | [diff] [blame] | 389 | THISDIR="@PWD@" |
Daniel Stenberg | ebe963d | 2002-09-20 06:38:38 +0000 | [diff] [blame] | 390 | LANGUAGE=@LANGUAGE@ |
Daniel Stenberg | ea9c5bb | 2003-02-26 09:13:47 +0000 | [diff] [blame] | 391 | MEMORYSIZE=@MEMORY@ |
Björn Stenberg | 6d55a71 | 2002-07-15 13:19:00 +0000 | [diff] [blame] | 392 | VERSION=\$(shell date +%y%m%d-%H%M) |
Daniel Stenberg | 3aacd2e | 2002-05-23 09:11:35 +0000 | [diff] [blame] | 393 | |
Linus Nielsen Feltzing | e53bdf0 | 2002-07-26 14:13:03 +0000 | [diff] [blame] | 394 | .PHONY: firmware apps |
Daniel Stenberg | 3c286ec | 2002-05-23 13:55:26 +0000 | [diff] [blame] | 395 | |
Daniel Stenberg | 45abe61 | 2002-05-31 08:38:35 +0000 | [diff] [blame] | 396 | all: firmware apps |
Daniel Stenberg | 3c286ec | 2002-05-23 13:55:26 +0000 | [diff] [blame] | 397 | |
| 398 | firmware: |
Daniel Stenberg | 7eda324 | 2003-11-26 14:10:21 +0000 | [diff] [blame] | 399 | \$(MAKE) -C \$(FIRMDIR) TARGET=\$(TARGET) \$(DEBUG) OBJDIR=\$(THISDIR) MEM=\$(MEMORYSIZE) TOOLSDIR=\$(TOOLSDIR) |
Daniel Stenberg | 3c286ec | 2002-05-23 13:55:26 +0000 | [diff] [blame] | 400 | |
| 401 | apps: |
Daniel Stenberg | 7eda324 | 2003-11-26 14:10:21 +0000 | [diff] [blame] | 402 | \$(MAKE) -C \$(APPSDIR) TARGET=\$(TARGET) \$(DEBUG) OBJDIR=\$(THISDIR) VERSION=\$(VERSION) LANGUAGE=\$(LANGUAGE) MEM=\$(MEMORYSIZE) TOOLSDIR=\$(TOOLSDIR) |
Daniel Stenberg | 3aacd2e | 2002-05-23 09:11:35 +0000 | [diff] [blame] | 403 | |
Daniel Stenberg | 40c6129 | 2002-05-24 09:33:37 +0000 | [diff] [blame] | 404 | clean-firmware: |
Daniel Stenberg | 23d0b5d | 2002-08-07 14:37:53 +0000 | [diff] [blame] | 405 | \$(MAKE) -C \$(FIRMDIR) TARGET=\$(TARGET) OBJDIR=\$(THISDIR) clean |
Daniel Stenberg | 40c6129 | 2002-05-24 09:33:37 +0000 | [diff] [blame] | 406 | |
| 407 | clean-apps: |
Daniel Stenberg | 23d0b5d | 2002-08-07 14:37:53 +0000 | [diff] [blame] | 408 | \$(MAKE) -C \$(APPSDIR) TARGET=\$(TARGET) OBJDIR=\$(THISDIR) clean |
Daniel Stenberg | 40c6129 | 2002-05-24 09:33:37 +0000 | [diff] [blame] | 409 | |
Daniel Stenberg | 3c286ec | 2002-05-23 13:55:26 +0000 | [diff] [blame] | 410 | clean: |
Daniel Stenberg | 23d0b5d | 2002-08-07 14:37:53 +0000 | [diff] [blame] | 411 | \$(MAKE) clean-firmware clean-apps |
Daniel Stenberg | 7cdab5c | 2004-05-21 19:40:20 +0000 | [diff] [blame] | 412 | rm -f rockbox.zip |
Daniel Stenberg | 3c286ec | 2002-05-23 13:55:26 +0000 | [diff] [blame] | 413 | |
Daniel Stenberg | bc35ae3 | 2002-08-15 09:32:59 +0000 | [diff] [blame] | 414 | tags-firmware: |
| 415 | \$(MAKE) -C \$(FIRMDIR) TARGET=\$(TARGET) OBJDIR=\$(THISDIR) tags |
| 416 | |
| 417 | tags-apps: |
| 418 | \$(MAKE) -C \$(APPSDIR) TARGET=\$(TARGET) OBJDIR=\$(THISDIR) tags |
| 419 | |
| 420 | tags: |
| 421 | @rm -f TAGS |
| 422 | \$(MAKE) tags-firmware tags-apps |
Daniel Stenberg | 3d9f774 | 2004-05-21 19:05:47 +0000 | [diff] [blame] | 423 | |
| 424 | zip: |
| 425 | \$(TOOLSDIR)/buildzip.pl \$(TARGET) |
Daniel Stenberg | 3aacd2e | 2002-05-23 09:11:35 +0000 | [diff] [blame] | 426 | EOF |
Daniel Stenberg | e0c12af | 2002-05-23 09:39:31 +0000 | [diff] [blame] | 427 | |
| 428 | echo "Created Makefile" |