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