David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 1 | #!/bin/sh |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 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` |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 19 | |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 20 | # source common functions definitions |
| 21 | . android/build/common.sh |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 22 | |
| 23 | # Parse options |
| 24 | OPTION_TARGETS="" |
| 25 | OPTION_DEBUG=no |
| 26 | OPTION_IGNORE_AUDIO=no |
| 27 | OPTION_NO_PREBUILTS=no |
| 28 | OPTION_TRY_64=no |
| 29 | OPTION_HELP=no |
David 'Digit' Turner | d68b487 | 2009-07-24 16:33:05 +0200 | [diff] [blame^] | 30 | OPTION_DEBUG=no |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 31 | |
| 32 | if [ -z "$CC" ] ; then |
| 33 | CC=gcc |
| 34 | fi |
| 35 | |
| 36 | for opt do |
| 37 | optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` |
| 38 | case "$opt" in |
| 39 | --help|-h|-\?) OPTION_HELP=yes |
| 40 | ;; |
| 41 | --verbose) |
| 42 | if [ "$VERBOSE" = "yes" ] ; then |
| 43 | VERBOSE2=yes |
| 44 | else |
| 45 | VERBOSE=yes |
| 46 | fi |
| 47 | ;; |
David 'Digit' Turner | d68b487 | 2009-07-24 16:33:05 +0200 | [diff] [blame^] | 48 | --debug) OPTION_DEBUG=yes |
| 49 | ;; |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 50 | --install=*) OPTION_TARGETS="$OPTION_TARGETS $optarg"; |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 51 | ;; |
| 52 | --sdl-config=*) SDL_CONFIG=$optarg |
| 53 | ;; |
| 54 | --cc=*) CC="$optarg" ; HOSTCC=$CC |
| 55 | ;; |
| 56 | --no-strip) OPTION_NO_STRIP=yes |
| 57 | ;; |
| 58 | --debug) OPTION_DEBUG=yes |
| 59 | ;; |
| 60 | --ignore-audio) OPTION_IGNORE_AUDIO=yes |
| 61 | ;; |
| 62 | --no-prebuilts) OPTION_NO_PREBUILTS=yes |
| 63 | ;; |
| 64 | --try-64) OPTION_TRY_64=yes |
| 65 | ;; |
| 66 | *) |
| 67 | echo "unknown option '$opt', use --help" |
| 68 | exit 1 |
| 69 | esac |
| 70 | done |
| 71 | |
| 72 | # Print the help message |
| 73 | # |
| 74 | if [ "$OPTION_HELP" = "yes" ] ; then |
| 75 | cat << EOF |
| 76 | |
| 77 | Usage: rebuild.sh [options] |
| 78 | Options: [defaults in brackets after descriptions] |
| 79 | EOF |
| 80 | echo "Standard options:" |
| 81 | echo " --help print this message" |
| 82 | echo " --install=FILEPATH copy emulator executable to FILEPATH [$TARGETS]" |
| 83 | echo " --cc=PATH specify C compiler [$CC]" |
| 84 | echo " --sdl-config=FILE use specific sdl-config script [$SDL_CONFIG]" |
| 85 | echo " --no-strip do not strip emulator executable" |
| 86 | echo " --debug enable debug (-O0 -g) build" |
| 87 | echo " --ignore-audio ignore audio messages (may build sound-less emulator)" |
| 88 | echo " --no-prebuilts do not use prebuilt libraries and compiler" |
| 89 | echo " --try-64 try to build a 64-bit executable (may crash)" |
| 90 | echo " --verbose verbose configuration" |
David 'Digit' Turner | d68b487 | 2009-07-24 16:33:05 +0200 | [diff] [blame^] | 91 | echo " --debug build debug version of the emulator" |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 92 | echo "" |
| 93 | exit 1 |
| 94 | fi |
| 95 | |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 96 | # we only support generating 32-bit binaris on 64-bit systems. |
| 97 | # And we may need to add a -Wa,--32 to CFLAGS to let the assembler |
| 98 | # generate 32-bit binaries on Linux x86_64. |
| 99 | # |
| 100 | if [ "$OPTION_TRY_64" != "yes" ] ; then |
| 101 | force_32bit_binaries |
| 102 | fi |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 103 | |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 104 | # Are we running in the Android build system ? |
| 105 | check_android_build |
| 106 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 107 | |
| 108 | # Adjust a few things when we're building within the Android build |
| 109 | # system: |
| 110 | # - locate prebuilt directory |
| 111 | # - locate and use prebuilt libraries |
| 112 | # - copy the new binary to the correct location |
| 113 | # |
| 114 | if [ "$OPTION_NO_PREBUILTS" = "yes" ] ; then |
| 115 | IN_ANDROID_BUILD=no |
| 116 | fi |
| 117 | |
| 118 | if [ "$IN_ANDROID_BUILD" = "yes" ] ; then |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 119 | locate_android_prebuilt |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 120 | |
| 121 | # use ccache if USE_CCACHE is defined and the corresponding |
| 122 | # binary is available. |
| 123 | # |
| 124 | # note: located in PREBUILT/ccache/ccache in the new tree layout |
| 125 | # located in PREBUILT/ccache in the old one |
| 126 | # |
| 127 | if [ -n "$USE_CCACHE" ] ; then |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 128 | CCACHE="$ANDROID_PREBUILT/ccache/ccache$EXE" |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 129 | if [ ! -f $CCACHE ] ; then |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 130 | CCACHE="$ANDROID_PREBUILT/ccache$EXE" |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 131 | fi |
| 132 | if [ -f $CCACHE ] ; then |
| 133 | CC="$CCACHE $CC" |
| 134 | fi |
| 135 | log "Prebuilt : CCACHE=$CCACHE" |
| 136 | fi |
| 137 | |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 138 | # if the user didn't specify an sdl-config script, get the prebuilt one |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 139 | if [ -z "$SDL_CONFIG" -a "$OPTION_NO_PREBUILTS" = "no" ] ; then |
| 140 | # always use our own static libSDL by default |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 141 | SDL_CONFIG=$ANDROID_PREBUILT/sdl/bin/sdl-config |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 142 | log "Prebuilt : SDL_CONFIG=$SDL_CONFIG" |
| 143 | fi |
| 144 | |
| 145 | # finally ensure that our new binary is copied to the 'out' |
| 146 | # subdirectory as 'emulator' |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 147 | HOST_BIN=$(get_android_abs_build_var HOST_OUT_EXECUTABLES) |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 148 | if [ -n "$HOST_BIN" ] ; then |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 149 | OPTION_TARGETS="$OPTION_TARGETS $HOST_BIN/emulator$EXE" |
| 150 | log "Targets : TARGETS=$OPTION_TARGETS" |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 151 | fi |
| 152 | fi # IN_ANDROID_BUILD = no |
| 153 | |
| 154 | |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 155 | # we can build the emulator with Cygwin, so enable it |
| 156 | enable_cygwin |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 157 | |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 158 | setup_toolchain |
The Android Open Source Project | 92c7311 | 2009-03-05 14:34:31 -0800 | [diff] [blame] | 159 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 160 | ### |
| 161 | ### SDL Probe |
| 162 | ### |
| 163 | |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 164 | # if the user didn't specify a sdl-config script, get the prebuilt one |
| 165 | if [ -z "$SDL_CONFIG" -a "$OPTION_NO_PREBUILTS" = "no" ] ; then |
| 166 | # try to find one from our git repository |
| 167 | SDL_CONFIG=../sdl/out/$OS/bin/sdl-config |
| 168 | if [ -f $SDL_CONFIG ] ; then |
| 169 | log "Prebuilt : SDL_CONFIG=$SDL_CONFIG" |
| 170 | else |
| 171 | echo "WARNING: YOU SHOULD USE THE --sdl-config OPTION" |
| 172 | SDL_CONFIG= |
| 173 | fi |
| 174 | fi |
| 175 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 176 | # For now, we require an external libSDL library, if SDL_CONFIG is not |
| 177 | # defined, try to grab it from the environment |
| 178 | # |
| 179 | if [ -z "$SDL_CONFIG" ] ; then |
| 180 | SDL_CONFIG=`which sdl-config` |
| 181 | if [ $? != 0 ] ; then |
| 182 | echo "Please ensure that you have the emulator's patched libSDL" |
| 183 | echo "built somewhere and point to its sdl-config script either" |
| 184 | echo "with the SDL_CONFIG env. variable, or the --sdl-config=<script>" |
| 185 | echo "option." |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 186 | clean_exit |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 187 | fi |
| 188 | fi |
| 189 | |
| 190 | # check that we can link statically with the library. |
| 191 | # |
| 192 | SDL_CFLAGS=`$SDL_CONFIG --cflags` |
| 193 | SDL_LIBS=`$SDL_CONFIG --static-libs` |
| 194 | |
| 195 | # quick hack, remove the -D_GNU_SOURCE=1 of some SDL Cflags |
| 196 | # since they break recent Mingw releases |
| 197 | SDL_CFLAGS=`echo $SDL_CFLAGS | sed -e s/-D_GNU_SOURCE=1//g` |
| 198 | |
| 199 | log "SDL-probe : SDL_CFLAGS = $SDL_CFLAGS" |
| 200 | log "SDL-probe : SDL_LIBS = $SDL_LIBS" |
| 201 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 202 | |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 203 | EXTRA_CFLAGS="$SDL_CFLAGS" |
| 204 | EXTRA_LDFLAGS="$SDL_LIBS" |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 205 | |
| 206 | cat > $TMPC << EOF |
| 207 | #include <SDL.h> |
| 208 | #undef main |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 209 | int main( int argc, char** argv ) { |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 210 | return SDL_Init (SDL_INIT_VIDEO); |
| 211 | } |
| 212 | EOF |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 213 | feature_check_link SDL_LINKING |
| 214 | |
| 215 | if [ $SDL_LINKING != "yes" ] ; then |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 216 | echo "You provided an explicit sdl-config script, but the corresponding library" |
| 217 | echo "cannot be statically linked with the Android emulator directly." |
| 218 | echo "Error message:" |
| 219 | cat $TMPL |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 220 | clean_exit |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 221 | fi |
| 222 | log "SDL-probe : static linking ok" |
| 223 | |
| 224 | # now, let's check that the SDL library has the special functions |
| 225 | # we added to our own sources |
| 226 | # |
| 227 | cat > $TMPC << EOF |
| 228 | #include <SDL.h> |
| 229 | #undef main |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 230 | int main( int argc, char** argv ) { |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 231 | int x, y; |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 232 | SDL_Rect r; |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 233 | SDL_WM_GetPos(&x, &y); |
| 234 | SDL_WM_SetPos(x, y); |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 235 | SDL_WM_GetMonitorDPI(&x, &y); |
| 236 | SDL_WM_GetMonitorRect(&r); |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 237 | return SDL_Init (SDL_INIT_VIDEO); |
| 238 | } |
| 239 | EOF |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 240 | feature_check_link SDL_LINKING |
| 241 | |
| 242 | if [ $SDL_LINKING != "yes" ] ; then |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 243 | echo "You provided an explicit sdl-config script in SDL_CONFIG, but the" |
| 244 | echo "corresponding library doesn't have the patches required to link" |
| 245 | echo "with the Android emulator. Unsetting SDL_CONFIG will use the" |
| 246 | echo "sources bundled with the emulator instead" |
| 247 | echo "Error:" |
| 248 | cat $TMPL |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 249 | clean_exit |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 250 | fi |
| 251 | |
| 252 | log "SDL-probe : extra features ok" |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 253 | clean_temp |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 254 | |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 255 | EXTRA_CFLAGS= |
| 256 | EXTRA_LDFLAGS= |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 257 | |
| 258 | ### |
| 259 | ### Audio subsystems probes |
| 260 | ### |
| 261 | PROBE_COREAUDIO=no |
| 262 | PROBE_ALSA=no |
| 263 | PROBE_OSS=no |
| 264 | PROBE_ESD=no |
| 265 | PROBE_WINAUDIO=no |
| 266 | |
| 267 | case "$OS" in |
| 268 | darwin*) PROBE_COREAUDIO=yes; |
| 269 | ;; |
| 270 | linux-*) PROBE_ALSA=yes; PROBE_OSS=yes; PROBE_ESD=yes; |
| 271 | ;; |
| 272 | windows) PROBE_WINAUDIO=yes |
| 273 | ;; |
| 274 | esac |
| 275 | |
| 276 | ORG_CFLAGS=$CFLAGS |
| 277 | ORG_LDFLAGS=$LDFLAGS |
| 278 | |
| 279 | if [ "$PROBE_ESD" = yes ] ; then |
| 280 | CFLAGS="$ORG_CFLAGS" |
| 281 | LDFLAGS="$ORG_LDFLAGS -ldl" |
| 282 | cp -f android/config/check-esd.c $TMPC |
| 283 | compile && link && $TMPE |
| 284 | if [ $? = 0 ] ; then |
| 285 | log "AudioProbe : ESD seems to be usable on this system" |
| 286 | else |
| 287 | if [ "$OPTION_IGNORE_AUDIO" = no ] ; then |
| 288 | echo "the EsounD development files do not seem to be installed on this system" |
| 289 | echo "Are you missing the libesd-dev package ?" |
| 290 | echo "Correct the errors below and try again:" |
| 291 | cat $TMPL |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 292 | clean_exit |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 293 | fi |
| 294 | PROBE_ESD=no |
| 295 | log "AudioProbe : ESD seems to be UNUSABLE on this system !!" |
| 296 | fi |
| 297 | fi |
| 298 | |
| 299 | if [ "$PROBE_ALSA" = yes ] ; then |
| 300 | CFLAGS="$ORG_CFLAGS" |
| 301 | LDFLAGS="$ORG_CFLAGS -ldl" |
| 302 | cp -f android/config/check-alsa.c $TMPC |
| 303 | compile && link && $TMPE |
| 304 | if [ $? = 0 ] ; then |
| 305 | log "AudioProbe : ALSA seems to be usable on this system" |
| 306 | else |
| 307 | if [ "$OPTION_IGNORE_AUDIO" = no ] ; then |
| 308 | echo "the ALSA development files do not seem to be installed on this system" |
| 309 | echo "Are you missing the libasound-dev package ?" |
| 310 | echo "Correct the erros below and try again" |
| 311 | cat $TMPL |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 312 | clean_exit |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 313 | fi |
| 314 | PROBE_ALSA=no |
| 315 | log "AudioProbe : ALSA seems to be UNUSABLE on this system !!" |
| 316 | fi |
| 317 | fi |
| 318 | |
| 319 | CFLAGS=$ORG_CFLAGS |
| 320 | LDFLAGS=$ORG_LDFLAGS |
| 321 | |
| 322 | # create the objs directory that is going to contain all generated files |
| 323 | # including the configuration ones |
| 324 | # |
| 325 | mkdir -p objs |
| 326 | |
| 327 | ### |
| 328 | ### Compiler probe |
| 329 | ### |
| 330 | |
| 331 | #### |
| 332 | #### Host system probe |
| 333 | #### |
| 334 | |
| 335 | # because the previous version could be read-only |
| 336 | rm -f $TMPC |
| 337 | |
| 338 | # check host endianess |
| 339 | # |
| 340 | HOST_BIGENDIAN=no |
| 341 | cat > $TMPC << EOF |
| 342 | #include <inttypes.h> |
| 343 | int main(int argc, char ** argv){ |
| 344 | volatile uint32_t i=0x01234567; |
| 345 | return (*((uint8_t*)(&i))) == 0x67; |
| 346 | } |
| 347 | EOF |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 348 | feature_run_exec HOST_BIGENDIAN |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 349 | |
| 350 | # check size of host long bits |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 351 | cat > $TMPC << EOF |
| 352 | int main(void) { |
| 353 | return sizeof(void*)*8; |
| 354 | } |
| 355 | EOF |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 356 | feature_run_exec HOST_LONGBITS |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 357 | |
| 358 | # check whether we have <byteswap.h> |
| 359 | # |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 360 | feature_check_header HAVE_BYTESWAP_H "<byteswap.h>" |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 361 | |
| 362 | # Build the config.make file |
| 363 | # |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 364 | |
| 365 | create_config_mk |
| 366 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 367 | PWD=`pwd` |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 368 | echo "TARGET_ARCH := arm" >> $config_mk |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 369 | echo "SRC_PATH := $PWD" >> $config_mk |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 370 | echo "SDL_CONFIG := $SDL_CONFIG" >> $config_mk |
| 371 | echo "CONFIG_COREAUDIO := $PROBE_COREAUDIO" >> $config_mk |
| 372 | echo "CONFIG_WINAUDIO := $PROBE_WINAUDIO" >> $config_mk |
| 373 | echo "CONFIG_ESD := $PROBE_ESD" >> $config_mk |
| 374 | echo "CONFIG_ALSA := $PROBE_ALSA" >> $config_mk |
| 375 | echo "CONFIG_OSS := $PROBE_OSS" >> $config_mk |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 376 | echo "BUILD_STANDALONE_EMULATOR := true" >> $config_mk |
David 'Digit' Turner | d68b487 | 2009-07-24 16:33:05 +0200 | [diff] [blame^] | 377 | if [ $OPTION_DEBUG = yes ] ; then |
| 378 | echo "BUILD_DEBUG_EMULATOR := true" >> $config_mk |
| 379 | fi |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 380 | |
| 381 | # Build the config-host.h file |
| 382 | # |
| 383 | config_h=objs/config-host.h |
| 384 | echo "/* This file was autogenerated by '$PROGNAME' */" > $config_h |
| 385 | echo "#define CONFIG_QEMU_SHAREDIR \"/usr/local/share/qemu\"" >> $config_h |
| 386 | echo "#define HOST_LONG_BITS $HOST_LONGBITS" >> $config_h |
| 387 | if [ "$HAVE_BYTESWAP_H" = "yes" ] ; then |
| 388 | echo "#define HAVE_BYTESWAP_H 1" >> $config_h |
| 389 | fi |
| 390 | echo "#define CONFIG_GDBSTUB 1" >> $config_h |
| 391 | echo "#define CONFIG_SLIRP 1" >> $config_h |
| 392 | echo "#define CONFIG_SKINS 1" >> $config_h |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 393 | echo "#define CONFIG_TRACE 1" >> $config_h |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 394 | # the -nand-limits options can only work on non-windows systems |
| 395 | if [ "$OS" != "windows" ] ; then |
| 396 | echo "#define CONFIG_NAND_LIMITS 1" >> $config_h |
| 397 | fi |
| 398 | echo "#define QEMU_VERSION \"0.8.2\"" >> $config_h |
| 399 | case "$CPU" in |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 400 | x86) CONFIG_CPU=I386 |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 401 | ;; |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 402 | ppc) CONFIG_CPU=PPC |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 403 | ;; |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 404 | x86_64) CONFIG_CPU=X86_64 |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 405 | ;; |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 406 | *) CONFIG_CPU=$CPU |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 407 | ;; |
| 408 | esac |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 409 | echo "#define HOST_$CONFIG_CPU 1" >> $config_h |
| 410 | BSD=0 |
| 411 | case "$OS" in |
| 412 | linux-*) CONFIG_OS=LINUX |
| 413 | ;; |
| 414 | darwin-*) CONFIG_OS=DARWIN |
| 415 | BSD=1 |
| 416 | ;; |
| 417 | windows*) CONFIG_OS=WIN32 |
| 418 | ;; |
| 419 | *) CONFIG_OS=$OS |
| 420 | esac |
| 421 | echo "#define CONFIG_$CONFIG_OS 1" >> $config_h |
| 422 | if [ $BSD = 1 ] ; then |
| 423 | echo "#define _BSD 1" >> $config_h |
| 424 | echo "#define O_LARGEFILE 0" >> $config_h |
| 425 | echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h |
| 426 | fi |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 427 | log "Generate : $config_h" |
| 428 | |
| 429 | echo "Ready to go. Type 'make' to build emulator" |