Changeset 253

Show
Ignore:
Timestamp:
05/02/08 13:34:37 (8 months ago)
Author:
conrad
Message:

build: add --tmpdir option, and pass -n through to make for DRY_RUN to
show what make would do, rather than simply echoing "make -n" :-)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • home/bin/build

    r251 r253  
    3535  echo >&2 "Options:" 
    3636  echo >&2 "  -a ARCH, --arch ARCH        Specify target architecture" 
     37  echo >&2 "  -i, --in-tree               Force building in the source tree" 
     38  echo >&2 "  -t, --tmpdir                Force building in \$TMPDIR" 
    3739  echo >&2 
    3840  echo >&2 "Miscellaneous options" 
     
    129131 
    130132  maybe_home=$(pwd | cut -c -$(( ${home_len} - 1)) ) 
    131   if test "x$maybe_home" = "x$HOME" ; then 
     133  if [ "x$BUILD_IN_TMPDIR" != "xy" -a "x$maybe_home" = "x$HOME" ] ; then 
    132134    # We are home 
    133135    reldir=$(pwd | cut -c $(( ${home_len} + 1))-) 
     
    162164  builddir=$(build_get_dir) 
    163165  build_try_run "$msg" \ 
    164     "mkdir -p $builddir && $MAKE ARCH=$BUILD_TARGET_ARCH O=$builddir $*" 
     166    mkdir -p $builddir 
     167 
     168  # $MAKE handles DRY_RUN via make -n 
     169  $MAKE ARCH=$BUILD_TARGET_ARCH O=$builddir $* 
    165170} 
    166171 
     
    201206      "mkdir -p $builddir && cd $builddir" 
    202207 
    203     build_try_run "Running \"$*\"" \ 
    204       "$*" 
     208    # $MAKE handles DRY_RUN via make -n, but make doubly 
     209    # sure that we are in $builddir 
     210    if test "x$1" = "xmake" ; then 
     211      build_verbose_echo "Running \"$*\"" 
     212        (cd $builddir && $* && cd $srcdir) 
     213    else 
     214      build_try_run "Running \"$*\"" \ 
     215        "$*" 
     216    fi 
    205217 
    206218    build_try_run "Returning to $srcdir" \ 
     
    227239  elif [ -e configure ] ; then 
    228240    build_configure_customize 
    229     build_in_builddir $srcdir/configure $CONFIGURE_FLAGS $* 
     241    build_in_builddir $srcdir/configure $CONFIGURE_FLAGS $* 
    230242  fi 
    231243} 
     
    321333BUILD_VERBOSE="" 
    322334BUILD_IN_TREE="" 
     335BUILD_IN_TMPDIR="" 
    323336 
    324337GETOPTEST=`getopt --version` 
    325 SHORTOPTS="nhva:
     338SHORTOPTS="nhva:it
    326339 
    327340case $GETOPTEST in 
    328341  getopt*) # GNU getopt 
    329     TEMP=`getopt -l dry-run -l help -l verbose -l arch:: -l in-tree -- +$SHORTOPTS $@` 
     342    TEMP=`getopt -l dry-run -l help -l verbose -l arch:: -l in-tree -l tmpdir -- +$SHORTOPTS $@` 
    330343    ;; 
    331344  *) # POSIX getopt ? 
     
    344357    -n | --dry-run) 
    345358      BUILD_DRY_RUN="y" 
     359      MAKE="$MAKE -n" 
    346360      ;; 
    347361    -v | verbose) 
     
    358372    --in-tree) 
    359373      BUILD_IN_TREE="y" 
     374      ;; 
     375    --tmpdir) 
     376      BUILD_IN_TMPDIR="n" 
    360377      ;; 
    361378  esac