| The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # this script is used to rebuild the Android emulator from sources |
| 4 | # in the current directory. It also contains logic to speed up the |
| 5 | # rebuild if it detects that you're using the Android build system |
| 6 | # |
| 7 | # in this case, it will use prebuilt binaries for the compiler, |
| 8 | # the audio library and the SDL library. You can disable this |
| 9 | # by using the --no-prebuilt-libs and --cc=<compiler> options |
| 10 | # |
| 11 | # |
| 12 | # here's the list of environment variables you can define before |
| 13 | # calling this script to control it (besides options): |
| 14 | # |
| 15 | # |
| 16 | |
| 17 | # first, let's see which system we're running this on |
| 18 | cd `dirname $0` |
| 19 | PROGNAME=`basename $0` |
| 20 | |
| 21 | # this function will be used to execute commands and eventually |
| 22 | # dump them if VERBOSE is 'yes' |
| 23 | VERBOSE=yes |
| 24 | VERBOSE2=no |
| 25 | |
| 26 | function log() |
| 27 | { |
| 28 | if [ "$VERBOSE" = "yes" ] ; then |
| 29 | echo "$1" |
| 30 | fi |
| 31 | } |
| 32 | |
| 33 | function log2() |
| 34 | { |
| 35 | if [ "$VERBOSE2" = "yes" ] ; then |
| 36 | echo "$1" |
| 37 | fi |
| 38 | } |
| 39 | |
| 40 | function execute() |
| 41 | { |
| 42 | log2 "Running: $*" |
| 43 | $* |
| 44 | } |
| 45 | |
| 46 | function compile() |
| 47 | { |
| 48 | log2 "Object : $CC -o $TMPO -c $CFLAGS $TMPC" |
| 49 | $CC -o $TMPO -c $CFLAGS $TMPC 2> $TMPL |
| 50 | } |
| 51 | |
| 52 | function link() |
| 53 | { |
| 54 | log2 "Link : $LD $LDFLAGS -o $TMPE $TMPO" |
| 55 | $LD $LDFLAGS -o $TMPE $TMPO 2> $TMPL |
| 56 | } |
| 57 | |
| 58 | function compile-exec-run() |
| 59 | { |
| 60 | log2 "RunExec : $CC -o $TMPE $CFLAGS $TMPC" |
| 61 | compile |
| 62 | if [ $? != 0 ] ; then |
| 63 | echo "Failure to compile test program" |
| 64 | cat $TMPL |
| 65 | exit 1 |
| 66 | fi |
| 67 | link |
| 68 | if [ $? != 0 ] ; then |
| 69 | echo "Failure to link test program" |
| 70 | cat $TMPL |
| 71 | exit 1 |
| 72 | fi |
| 73 | $TMPE |
| 74 | } |
| 75 | |
| 76 | OS=`uname -s` |
| 77 | CPU=`uname -m` |
| 78 | EXE="" |
| 79 | case "$CPU" in |
| 80 | i?86) CPU=x86 |
| 81 | ;; |
| 82 | esac |
| 83 | |
| 84 | case "$OS" in |
| 85 | Darwin) |
| 86 | OS=darwin-$CPU |
| 87 | ;; |
| 88 | Linux) |
| 89 | # note that building on x86_64 is handled later |
| 90 | OS=linux-$CPU |
| 91 | ;; |
| 92 | *_NT-*) |
| 93 | OS=windows |
| 94 | EXE=.exe |
| 95 | ;; |
| 96 | esac |
| 97 | |
| 98 | # Are we running in the Android build system ? |
| 99 | unset TOP |
| 100 | if [ -n "$ANDROID_PRODUCT_OUT" ] ; then |
| 101 | TOP=`cd $ANDROID_PRODUCT_OUT/../../../.. && pwd` |
| 102 | log "TOP found at $TOP" |
| 103 | # $TOP/config/envsetup.make is for the old tree layout |
| 104 | # $TOP/build/envsetup.sh is for the new one |
| 105 | ANDROID_CONFIG_MK=$TOP/config/envsetup.make |
| 106 | if [ ! -f $ANDROID_CONFIG_MK ] ; then |
| 107 | ANDROID_CONFIG_MK=$TOP/build/core/config.mk |
| 108 | fi |
| 109 | if [ ! -f $ANDROID_CONFIG_MK ] ; then |
| 110 | echo "Cannot find build system root (TOP)" |
| 111 | echo "defaulting to non-Android build" |
| 112 | unset TOP |
| 113 | fi |
| 114 | fi |
| 115 | |
| 116 | # normalize the TOP variable, we don't want any trailing / |
| 117 | IN_ANDROID_BUILD=no |
| 118 | if [ -n "$TOP" ] ; then |
| 119 | TOPDIR=`dirname $TOP` |
| 120 | if [ "$TOPDIR" != "." ] ; then |
| 121 | TOP=$TOPDIR/`basename $TOP` |
| 122 | fi |
| 123 | IN_ANDROID_BUILD=yes |
| 124 | log "In Android Build" |
| 125 | fi |
| 126 | |
| 127 | # Parse options |
| 128 | OPTION_TARGETS="" |
| 129 | OPTION_DEBUG=no |
| 130 | OPTION_IGNORE_AUDIO=no |
| 131 | OPTION_NO_PREBUILTS=no |
| 132 | OPTION_TRY_64=no |
| 133 | OPTION_HELP=no |
| 134 | |
| 135 | if [ -z "$CC" ] ; then |
| 136 | CC=gcc |
| 137 | fi |
| 138 | |
| 139 | for opt do |
| 140 | optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` |
| 141 | case "$opt" in |
| 142 | --help|-h|-\?) OPTION_HELP=yes |
| 143 | ;; |
| 144 | --verbose) |
| 145 | if [ "$VERBOSE" = "yes" ] ; then |
| 146 | VERBOSE2=yes |
| 147 | else |
| 148 | VERBOSE=yes |
| 149 | fi |
| 150 | ;; |
| 151 | --install=*) OPTION_TARGETS="$TARGETS $optarg"; |
| 152 | ;; |
| 153 | --sdl-config=*) SDL_CONFIG=$optarg |
| 154 | ;; |
| 155 | --cc=*) CC="$optarg" ; HOSTCC=$CC |
| 156 | ;; |
| 157 | --no-strip) OPTION_NO_STRIP=yes |
| 158 | ;; |
| 159 | --debug) OPTION_DEBUG=yes |
| 160 | ;; |
| 161 | --ignore-audio) OPTION_IGNORE_AUDIO=yes |
| 162 | ;; |
| 163 | --no-prebuilts) OPTION_NO_PREBUILTS=yes |
| 164 | ;; |
| 165 | --try-64) OPTION_TRY_64=yes |
| 166 | ;; |
| 167 | *) |
| 168 | echo "unknown option '$opt', use --help" |
| 169 | exit 1 |
| 170 | esac |
| 171 | done |
| 172 | |
| 173 | # Print the help message |
| 174 | # |
| 175 | if [ "$OPTION_HELP" = "yes" ] ; then |
| 176 | cat << EOF |
| 177 | |
| 178 | Usage: rebuild.sh [options] |
| 179 | Options: [defaults in brackets after descriptions] |
| 180 | EOF |
| 181 | echo "Standard options:" |
| 182 | echo " --help print this message" |
| 183 | echo " --install=FILEPATH copy emulator executable to FILEPATH [$TARGETS]" |
| 184 | echo " --cc=PATH specify C compiler [$CC]" |
| 185 | echo " --sdl-config=FILE use specific sdl-config script [$SDL_CONFIG]" |
| 186 | echo " --no-strip do not strip emulator executable" |
| 187 | echo " --debug enable debug (-O0 -g) build" |
| 188 | echo " --ignore-audio ignore audio messages (may build sound-less emulator)" |
| 189 | echo " --no-prebuilts do not use prebuilt libraries and compiler" |
| 190 | echo " --try-64 try to build a 64-bit executable (may crash)" |
| 191 | echo " --verbose verbose configuration" |
| 192 | echo "" |
| 193 | exit 1 |
| 194 | fi |
| 195 | |
| 196 | # Various probes are going to need to run a small C program |
| 197 | TMPC=/tmp/android-qemu-$$.c |
| 198 | TMPO=/tmp/android-qemu-$$.o |
| 199 | TMPE=/tmp/android-qemu-$$$EXE |
| 200 | TMPL=/tmp/android-qemu-$$.log |
| 201 | |
| 202 | function clean-exit () |
| 203 | { |
| 204 | rm -f $TMPC $TMPO $TMPL $TMPE |
| 205 | exit 1 |
| 206 | } |
| 207 | |
| 208 | # Adjust a few things when we're building within the Android build |
| 209 | # system: |
| 210 | # - locate prebuilt directory |
| 211 | # - locate and use prebuilt libraries |
| 212 | # - copy the new binary to the correct location |
| 213 | # |
| 214 | if [ "$OPTION_NO_PREBUILTS" = "yes" ] ; then |
| 215 | IN_ANDROID_BUILD=no |
| 216 | fi |
| 217 | |
| 218 | if [ "$IN_ANDROID_BUILD" = "yes" ] ; then |
| 219 | |
| 220 | # Get the value of a build variable as an absolute path. |
| 221 | function get_abs_build_var() |
| 222 | { |
| 223 | (cd $TOP && CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core make -f $ANDROID_CONFIG_MK dumpvar-abs-$1) |
| 224 | } |
| 225 | |
| 226 | # locate prebuilt directory |
| 227 | PREBUILT_HOST_TAG=$OS |
| 228 | case $OS in |
| 229 | linux-*) |
| 230 | # Linux is a special case because in the old tree layout |
| 231 | # we simply used 'Linux' as the prebuilt host tag, but |
| 232 | # are now using "linux-x86" in the new layout |
| 233 | # check which one should be used |
| 234 | # |
| 235 | if [ -d $TOP/prebuilt/Linux ] ; then |
| 236 | PREBUILT_HOST_TAG=Linux |
| 237 | fi |
| 238 | ;; |
| 239 | esac |
| 240 | PREBUILT=$TOP/prebuilt/$PREBUILT_HOST_TAG |
| 241 | if [ ! -d $PREBUILT ] ; then |
| 242 | # this can happen when building on x86_64 |
| 243 | case $OS in |
| 244 | linux-x86_64) |
| 245 | PREBUILT_HOST_TAG=linux-x86 |
| 246 | PREBUILT=$TOP/prebuilt/$PREBUILT_HOST_TAG |
| 247 | log "Forcing usage of 32-bit prebuilts" |
| 248 | ;; |
| 249 | *) |
| 250 | esac |
| 251 | if [ ! -d $PREBUILT ] ; then |
| 252 | echo "Can't find the prebuilt directory $PREBUILT in Android build" |
| 253 | exit 1 |
| 254 | fi |
| 255 | fi |
| 256 | log "Prebuilt : PREBUILT=$PREBUILT" |
| 257 | |
| 258 | # use ccache if USE_CCACHE is defined and the corresponding |
| 259 | # binary is available. |
| 260 | # |
| 261 | # note: located in PREBUILT/ccache/ccache in the new tree layout |
| 262 | # located in PREBUILT/ccache in the old one |
| 263 | # |
| 264 | if [ -n "$USE_CCACHE" ] ; then |
| 265 | CCACHE="$PREBUILT/ccache/ccache$EXE" |
| 266 | if [ ! -f $CCACHE ] ; then |
| 267 | CCACHE="$PREBUILT/ccache$EXE" |
| 268 | fi |
| 269 | if [ -f $CCACHE ] ; then |
| 270 | CC="$CCACHE $CC" |
| 271 | fi |
| 272 | log "Prebuilt : CCACHE=$CCACHE" |
| 273 | fi |
| 274 | |
| 275 | # if the user didn't specify a sdl-config script, get the prebuilt one |
| 276 | if [ -z "$SDL_CONFIG" -a "$OPTION_NO_PREBUILTS" = "no" ] ; then |
| 277 | # always use our own static libSDL by default |
| 278 | SDL_CONFIG=$PREBUILT/sdl/bin/sdl-config |
| 279 | log "Prebuilt : SDL_CONFIG=$SDL_CONFIG" |
| 280 | fi |
| 281 | |
| 282 | # finally ensure that our new binary is copied to the 'out' |
| 283 | # subdirectory as 'emulator' |
| 284 | HOST_BIN=$(get_abs_build_var HOST_OUT_EXECUTABLES) |
| 285 | if [ -n "$HOST_BIN" ] ; then |
| 286 | TARGETS="$TARGETS $HOST_BIN/emulator$EXE" |
| 287 | log "Targets : TARGETS=$TARGETS" |
| 288 | fi |
| 289 | fi # IN_ANDROID_BUILD = no |
| 290 | |
| 291 | |
| 292 | #### |
| 293 | #### Compiler checks |
| 294 | #### |
| 295 | #### |
| 296 | if [ -z "$CC" ] ; then |
| 297 | CC=gcc |
| 298 | if [ $CPU = "powerpc" ] ; then |
| 299 | CC=gcc-3.3 |
| 300 | fi |
| 301 | fi |
| 302 | |
| 303 | cat > $TMPC <<EOF |
| 304 | int main(void) {} |
| 305 | EOF |
| 306 | |
| 307 | if [ -z "$LD" ] ; then |
| 308 | LD=$CC |
| 309 | fi |
| 310 | |
| 311 | # we only support generating 32-bit binaris on 64-bit systems. |
| 312 | # And we may need to add a -Wa,--32 to CFLAGS to let the assembler |
| 313 | # generate 32-bit binaries on Linux x86_64. |
| 314 | # |
| 315 | if [ "$OPTION_TRY_64" != "yes" ] ; then |
| 316 | if [ "$CPU" = "x86_64" -o "$CPU" = "amd64" ] ; then |
| 317 | log "Check32Bits: Forcing generation of 32-bit binaries (--try-64 to disable)" |
| 318 | CPU="i386" |
| 319 | case $OS in |
| 320 | linux-*) |
| 321 | OS=linux-x86 |
| 322 | ;; |
| 323 | darwin-*) |
| 324 | OS=darwin-x86 |
| 325 | ;; |
| 326 | esac |
| 327 | CFLAGS="$CFLAGS -m32" |
| 328 | LDFLAGS="$LDFLAGS -m32" |
| 329 | compile |
| 330 | if [ $? != 0 ] ; then |
| 331 | CFLAGS="$CFLAGS -Wa,--32" |
| 332 | fi |
| 333 | # check that the compiler can link 32-bit executables |
| 334 | # if not, try the host linker |
| 335 | link |
| 336 | if [ $? != 0 ] ; then |
| 337 | OLD_LD=$LD |
| 338 | LD=gcc |
| 339 | compile |
| 340 | link |
| 341 | if [ $? != 0 ] ; then |
| 342 | log "not using gcc for LD" |
| 343 | LD=$OLD_LD |
| 344 | fi |
| 345 | fi |
| 346 | fi |
| 347 | fi |
| 348 | |
| 349 | compile |
| 350 | if [ $? != 0 ] ; then |
| 351 | echo "C compiler doesn't seem to work:" |
| 352 | cat $TMPL |
| 353 | clean-exit |
| 354 | fi |
| 355 | log "CC : compiler check ok ($CC)" |
| 356 | |
| 357 | # on 64-bit systems, some of our prebuilt compilers are not |
| 358 | # capable of linking 32-bit executables properly |
| 359 | # |
| 360 | link |
| 361 | if [ $? != 0 ] ; then |
| 362 | echo "Linker doesn't seem to work:" |
| 363 | cat $TMPL |
| 364 | clean-exit |
| 365 | fi |
| 366 | log "LD : linker check ok ($LD)" |
| 367 | |
| 368 | ### |
| 369 | ### SDL Probe |
| 370 | ### |
| 371 | |
| 372 | # For now, we require an external libSDL library, if SDL_CONFIG is not |
| 373 | # defined, try to grab it from the environment |
| 374 | # |
| 375 | if [ -z "$SDL_CONFIG" ] ; then |
| 376 | SDL_CONFIG=`which sdl-config` |
| 377 | if [ $? != 0 ] ; then |
| 378 | echo "Please ensure that you have the emulator's patched libSDL" |
| 379 | echo "built somewhere and point to its sdl-config script either" |
| 380 | echo "with the SDL_CONFIG env. variable, or the --sdl-config=<script>" |
| 381 | echo "option." |
| 382 | clean-exit |
| 383 | fi |
| 384 | fi |
| 385 | |
| 386 | # check that we can link statically with the library. |
| 387 | # |
| 388 | SDL_CFLAGS=`$SDL_CONFIG --cflags` |
| 389 | SDL_LIBS=`$SDL_CONFIG --static-libs` |
| 390 | |
| 391 | # quick hack, remove the -D_GNU_SOURCE=1 of some SDL Cflags |
| 392 | # since they break recent Mingw releases |
| 393 | SDL_CFLAGS=`echo $SDL_CFLAGS | sed -e s/-D_GNU_SOURCE=1//g` |
| 394 | |
| 395 | log "SDL-probe : SDL_CFLAGS = $SDL_CFLAGS" |
| 396 | log "SDL-probe : SDL_LIBS = $SDL_LIBS" |
| 397 | |
| 398 | OLD_CFLAGS=$CFLAGS |
| 399 | OLD_LDFLAGS=$LDFLAGS |
| 400 | |
| 401 | CFLAGS="$CFLAGS $SDL_CFLAGS" |
| 402 | LDFLAGS="$LDFLAGS $SDL_LIBS" |
| 403 | |
| 404 | cat > $TMPC << EOF |
| 405 | #include <SDL.h> |
| 406 | #undef main |
| 407 | int main( void ) { |
| 408 | return SDL_Init (SDL_INIT_VIDEO); |
| 409 | } |
| 410 | EOF |
| 411 | compile |
| 412 | if [ $? != 0 ] ; then |
| 413 | echo "You provided an explicit sdl-config script, but the corresponding library" |
| 414 | echo "cannot be statically linked with the Android emulator directly." |
| 415 | echo "Error message:" |
| 416 | cat $TMPL |
| 417 | clean-exit |
| 418 | fi |
| 419 | log "SDL-probe : static linking ok" |
| 420 | |
| 421 | # now, let's check that the SDL library has the special functions |
| 422 | # we added to our own sources |
| 423 | # |
| 424 | cat > $TMPC << EOF |
| 425 | #include <SDL.h> |
| 426 | #undef main |
| 427 | int main( void ) { |
| 428 | int x, y; |
| 429 | SDL_WM_GetPos(&x, &y); |
| 430 | SDL_WM_SetPos(x, y); |
| 431 | return SDL_Init (SDL_INIT_VIDEO); |
| 432 | } |
| 433 | EOF |
| 434 | compile |
| 435 | if [ $? != 0 ] ; then |
| 436 | echo "You provided an explicit sdl-config script in SDL_CONFIG, but the" |
| 437 | echo "corresponding library doesn't have the patches required to link" |
| 438 | echo "with the Android emulator. Unsetting SDL_CONFIG will use the" |
| 439 | echo "sources bundled with the emulator instead" |
| 440 | echo "Error:" |
| 441 | cat $TMPL |
| 442 | clean-exit |
| 443 | fi |
| 444 | |
| 445 | log "SDL-probe : extra features ok" |
| 446 | rm -f $TMPL $TMPC $TMPE |
| 447 | |
| 448 | CFLAGS=$OLD_CFLAGS |
| 449 | LDFLAGS=$OLD_LDFLAGS |
| 450 | |
| 451 | |
| 452 | ### |
| 453 | ### Audio subsystems probes |
| 454 | ### |
| 455 | PROBE_COREAUDIO=no |
| 456 | PROBE_ALSA=no |
| 457 | PROBE_OSS=no |
| 458 | PROBE_ESD=no |
| 459 | PROBE_WINAUDIO=no |
| 460 | |
| 461 | case "$OS" in |
| 462 | darwin*) PROBE_COREAUDIO=yes; |
| 463 | ;; |
| 464 | linux-*) PROBE_ALSA=yes; PROBE_OSS=yes; PROBE_ESD=yes; |
| 465 | ;; |
| 466 | windows) PROBE_WINAUDIO=yes |
| 467 | ;; |
| 468 | esac |
| 469 | |
| 470 | ORG_CFLAGS=$CFLAGS |
| 471 | ORG_LDFLAGS=$LDFLAGS |
| 472 | |
| 473 | if [ "$PROBE_ESD" = yes ] ; then |
| 474 | CFLAGS="$ORG_CFLAGS" |
| 475 | LDFLAGS="$ORG_LDFLAGS -ldl" |
| 476 | cp -f android/config/check-esd.c $TMPC |
| 477 | compile && link && $TMPE |
| 478 | if [ $? = 0 ] ; then |
| 479 | log "AudioProbe : ESD seems to be usable on this system" |
| 480 | else |
| 481 | if [ "$OPTION_IGNORE_AUDIO" = no ] ; then |
| 482 | echo "the EsounD development files do not seem to be installed on this system" |
| 483 | echo "Are you missing the libesd-dev package ?" |
| 484 | echo "Correct the errors below and try again:" |
| 485 | cat $TMPL |
| 486 | clean-exit |
| 487 | fi |
| 488 | PROBE_ESD=no |
| 489 | log "AudioProbe : ESD seems to be UNUSABLE on this system !!" |
| 490 | fi |
| 491 | fi |
| 492 | |
| 493 | if [ "$PROBE_ALSA" = yes ] ; then |
| 494 | CFLAGS="$ORG_CFLAGS" |
| 495 | LDFLAGS="$ORG_CFLAGS -ldl" |
| 496 | cp -f android/config/check-alsa.c $TMPC |
| 497 | compile && link && $TMPE |
| 498 | if [ $? = 0 ] ; then |
| 499 | log "AudioProbe : ALSA seems to be usable on this system" |
| 500 | else |
| 501 | if [ "$OPTION_IGNORE_AUDIO" = no ] ; then |
| 502 | echo "the ALSA development files do not seem to be installed on this system" |
| 503 | echo "Are you missing the libasound-dev package ?" |
| 504 | echo "Correct the erros below and try again" |
| 505 | cat $TMPL |
| 506 | clean-exit |
| 507 | fi |
| 508 | PROBE_ALSA=no |
| 509 | log "AudioProbe : ALSA seems to be UNUSABLE on this system !!" |
| 510 | fi |
| 511 | fi |
| 512 | |
| 513 | CFLAGS=$ORG_CFLAGS |
| 514 | LDFLAGS=$ORG_LDFLAGS |
| 515 | |
| 516 | # create the objs directory that is going to contain all generated files |
| 517 | # including the configuration ones |
| 518 | # |
| 519 | mkdir -p objs |
| 520 | |
| 521 | ### |
| 522 | ### Compiler probe |
| 523 | ### |
| 524 | |
| 525 | #### |
| 526 | #### Host system probe |
| 527 | #### |
| 528 | |
| 529 | # because the previous version could be read-only |
| 530 | rm -f $TMPC |
| 531 | |
| 532 | # check host endianess |
| 533 | # |
| 534 | HOST_BIGENDIAN=no |
| 535 | cat > $TMPC << EOF |
| 536 | #include <inttypes.h> |
| 537 | int main(int argc, char ** argv){ |
| 538 | volatile uint32_t i=0x01234567; |
| 539 | return (*((uint8_t*)(&i))) == 0x67; |
| 540 | } |
| 541 | EOF |
| 542 | compile-exec-run && HOST_BIGENDIAN=yes |
| 543 | log "Host : HOST_BIGENDIAN=$HOST_BIGENDIAN" |
| 544 | |
| 545 | # check size of host long bits |
| 546 | HOST_LONGBITS=32 |
| 547 | cat > $TMPC << EOF |
| 548 | int main(void) { |
| 549 | return sizeof(void*)*8; |
| 550 | } |
| 551 | EOF |
| 552 | compile-exec-run |
| 553 | HOST_LONGBITS=$? |
| 554 | log "Host : HOST_LONGBITS=$HOST_LONGBITS" |
| 555 | |
| 556 | # check whether we have <byteswap.h> |
| 557 | # |
| 558 | HAVE_BYTESWAP_H=yes |
| 559 | cat > $TMPC << EOF |
| 560 | #include <byteswap.h> |
| 561 | EOF |
| 562 | compile |
| 563 | if [ $? != 0 ] ; then |
| 564 | HAVE_BYTESWAP_H=no |
| 565 | fi |
| 566 | log "Host : HAVE_BYTESWAP_H=$HAVE_BYTESWAP_H" |
| 567 | |
| 568 | # Build the config.make file |
| 569 | # |
| 570 | rm -rf objs |
| 571 | mkdir -p objs |
| 572 | config_mk=objs/config.make |
| 573 | echo "# This file was autogenerated by $PROGNAME" > $config_mk |
| 574 | echo "TARGET_ARCH := arm" >> $config_mk |
| 575 | case $OS in |
| 576 | linux-*) HOST_OS=linux |
| 577 | ;; |
| 578 | darwin-*) HOST_OS=darwin |
| 579 | ;; |
| 580 | *) HOST_OS=$OS |
| 581 | esac |
| 582 | echo "OS := $OS" >> $config_mk |
| 583 | echo "HOST_OS := $HOST_OS" >> $config_mk |
| 584 | case $CPU in |
| 585 | i?86) HOST_ARCH=x86 |
| 586 | ;; |
| 587 | amd64) HOST_ARCH=x86_64 |
| 588 | ;; |
| 589 | powerpc) HOST_ARCH=ppc |
| 590 | ;; |
| 591 | *) HOST_ARCH=$CPU |
| 592 | esac |
| 593 | echo "HOST_ARCH := $HOST_ARCH" >> $config_mk |
| 594 | PWD=`pwd` |
| 595 | echo "SRC_PATH := $PWD" >> $config_mk |
| 596 | echo "CC := $CC" >> $config_mk |
| 597 | echo "HOST_CC := $CC" >> $config_mk |
| 598 | echo "LD := $LD" >> $config_mk |
| 599 | echo "NO_PREBUILT := $OPTION_NO_PREBUILTS" >> $config_mk |
| 600 | echo "HOST_PREBUILT_TAG := $PREBUILT_HOST_TAG" >> $config_mk |
| 601 | echo "PREBUILT := $PREBUILT" >> $config_mk |
| 602 | echo "CFLAGS := $CFLAGS" >> $config_mk |
| 603 | echo "LDFLAGS := $LDFLAGS" >> $config_mk |
| 604 | echo "SDL_CONFIG := $SDL_CONFIG" >> $config_mk |
| 605 | echo "CONFIG_COREAUDIO := $PROBE_COREAUDIO" >> $config_mk |
| 606 | echo "CONFIG_WINAUDIO := $PROBE_WINAUDIO" >> $config_mk |
| 607 | echo "CONFIG_ESD := $PROBE_ESD" >> $config_mk |
| 608 | echo "CONFIG_ALSA := $PROBE_ALSA" >> $config_mk |
| 609 | echo "CONFIG_OSS := $PROBE_OSS" >> $config_mk |
| 610 | echo "" >> $config_mk |
| 611 | echo "BUILD_STANDALONE_EMULATOR := true" >> $config_mk |
| 612 | echo "HOST_PREBUILT_TAG := $PREBUILT_HOST_TAG" >> $config_mk |
| 613 | |
| 614 | log "Generate : $config_mk" |
| 615 | |
| 616 | # Build the config-host.h file |
| 617 | # |
| 618 | config_h=objs/config-host.h |
| 619 | echo "/* This file was autogenerated by '$PROGNAME' */" > $config_h |
| 620 | echo "#define CONFIG_QEMU_SHAREDIR \"/usr/local/share/qemu\"" >> $config_h |
| 621 | echo "#define HOST_LONG_BITS $HOST_LONGBITS" >> $config_h |
| 622 | if [ "$HAVE_BYTESWAP_H" = "yes" ] ; then |
| 623 | echo "#define HAVE_BYTESWAP_H 1" >> $config_h |
| 624 | fi |
| 625 | echo "#define CONFIG_GDBSTUB 1" >> $config_h |
| 626 | echo "#define CONFIG_SLIRP 1" >> $config_h |
| 627 | echo "#define CONFIG_SKINS 1" >> $config_h |
| 628 | # the -nand-limits options can only work on non-windows systems |
| 629 | if [ "$OS" != "windows" ] ; then |
| 630 | echo "#define CONFIG_NAND_LIMITS 1" >> $config_h |
| 631 | fi |
| 632 | echo "#define QEMU_VERSION \"0.8.2\"" >> $config_h |
| 633 | case "$CPU" in |
| 634 | i386) HOST_CPU=I386 |
| 635 | ;; |
| 636 | powerpc) HOST_CPU=PPC |
| 637 | ;; |
| 638 | x86_64|amd64) HOST_CPU=X86_64 |
| 639 | ;; |
| 640 | *) HOST_CPU=$CPU |
| 641 | ;; |
| 642 | esac |
| 643 | echo "#define HOST_$HOST_CPU 1" >> $config_h |
| 644 | log "Generate : $config_h" |
| 645 | |
| 646 | echo "Ready to go. Type 'make' to build emulator" |