Changeset 1679


Ignore:
Timestamp:
Jul 28, 2012, 11:41:21 AM (11 years ago)
Author:
sam
Message:

build: try to autodetect the number of CPU threads available and tweak the
parallel builds accordingly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/build/lol-build

    r1677 r1679  
    3232platform="$2"
    3333
     34###############################################################################
     35# Initialisation code
     36#
     37#  - sets the top_srcdir variable
     38#  - sets the LOL_PARALLEL variable
     39#  - fix PATH and MKPATH if necessary
     40#
    3441__init__()
    3542{
     
    3744    cd "$top_srcdir"
    3845    top_srcdir="`pwd`"
     46
     47    case "$cpu_count" in
     48      [1-9]|[1-9][0-9]|[1-9][0-9][0-9]) ;;
     49      *) if [ -r "/proc/cpuinfo" ]; then
     50           cpu_count="$(grep -c '^processor\>' /proc/cpuinfo)"
     51         fi ;;
     52    esac
     53    case "$cpu_count" in
     54      [1-9]|[1-9][0-9]|[1-9][0-9][0-9]) ;;
     55      *) cpu_count="$(sysctl -n hw.ncpu 2>/dev/null)" ;;
     56    esac
     57    case "$cpu_count" in
     58      [1-9]|[1-9][0-9]|[1-9][0-9][0-9]) ;;
     59      *) cpu_count=1 ;;
     60    esac
     61    case "$cpu_count" in
     62      1) LOL_PARALLEL=1 ;;
     63      2) LOL_PARALLEL=3 ;;
     64      *) LOL_PARALLEL="$(expr $cpu_count '*' 3 / 2)" ;;
     65    esac
    3966
    4067    case "${MSYSTEM}" in
     
    189216            ;;
    190217        *)
    191             make -j6
     218            make -j$LOL_PARALLEL
    192219            ;;
    193220    esac
Note: See TracChangeset for help on using the changeset viewer.