aoqi@0: #! /bin/sh aoqi@0: # aoqi@0: # Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved. aoqi@0: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: # aoqi@0: # This code is free software; you can redistribute it and/or modify it aoqi@0: # under the terms of the GNU General Public License version 2 only, as aoqi@0: # published by the Free Software Foundation. aoqi@0: # aoqi@0: # This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: # version 2 for more details (a copy is included in the LICENSE file that aoqi@0: # accompanied this code). aoqi@0: # aoqi@0: # You should have received a copy of the GNU General Public License version aoqi@0: # 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: # aoqi@0: # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: # or visit www.oracle.com if you need additional information or have any aoqi@0: # questions. aoqi@0: # aoqi@0: # aoqi@0: aoqi@0: # This script is used only from top.make. aoqi@0: # The macro $(MFLAGS-adjusted) calls this script to aoqi@0: # adjust the "-j" arguments to take into account aoqi@0: # the HOTSPOT_BUILD_JOBS variable. The default aoqi@0: # handling of the "-j" argument by gnumake does aoqi@0: # not meet our needs, so we must adjust it ourselves. aoqi@0: aoqi@0: # This argument adjustment applies to two recursive aoqi@0: # calls to "$(MAKE) $(MFLAGS-adjusted)" in top.make. aoqi@0: # One invokes adlc.make, and the other invokes vm.make. aoqi@0: # The adjustment propagates the desired concurrency aoqi@0: # level down to the sub-make (of the adlc or vm). aoqi@0: # The default behavior of gnumake is to run all aoqi@0: # sub-makes without concurrency ("-j1"). aoqi@0: aoqi@0: # Also, we use a make variable rather than an explicit aoqi@0: # "-j" argument to control this setting, so that aoqi@0: # the concurrency setting (which must be tuned separately aoqi@0: # for each MP system) can be set via an environment variable. aoqi@0: # The recommended setting is 1.5x to 2x the number of available aoqi@0: # CPUs on the MP system, which is large enough to keep the CPUs aoqi@0: # busy (even though some jobs may be I/O bound) but not too large, aoqi@0: # we may presume, to overflow the system's swap space. aoqi@0: aoqi@0: set -eu aoqi@0: aoqi@0: default_build_jobs=4 aoqi@0: aoqi@0: case $# in aoqi@0: [12]) true;; aoqi@0: *) >&2 echo "Usage: $0 ${MFLAGS} ${HOTSPOT_BUILD_JOBS}"; exit 2;; aoqi@0: esac aoqi@0: aoqi@0: MFLAGS=$1 aoqi@0: HOTSPOT_BUILD_JOBS=${2-} aoqi@0: aoqi@0: # Normalize any -jN argument to the form " -j${HBJ}" aoqi@0: MFLAGS=` aoqi@0: echo "$MFLAGS" \ aoqi@0: | sed ' aoqi@0: s/^-/ -/ aoqi@0: s/ -\([^ ][^ ]*\)j/ -\1 -j/ aoqi@0: s/ -j[0-9][0-9]*/ -j/ aoqi@0: s/ -j\([^ ]\)/ -j -\1/ aoqi@0: s/ -j/ -j'${HOTSPOT_BUILD_JOBS:-${default_build_jobs}}'/ aoqi@0: ' ` aoqi@0: aoqi@0: case ${HOTSPOT_BUILD_JOBS} in \ aoqi@0: aoqi@0: '') case ${MFLAGS} in aoqi@0: *\ -j*) aoqi@0: >&2 echo "# Note: -jN is ineffective for setting parallelism in this makefile." aoqi@0: >&2 echo "# please set HOTSPOT_BUILD_JOBS=${default_build_jobs} in the command line or environment." aoqi@0: esac;; aoqi@0: aoqi@0: ?*) case ${MFLAGS} in aoqi@0: *\ -j*) true;; aoqi@0: *) MFLAGS="-j${HOTSPOT_BUILD_JOBS} ${MFLAGS}";; aoqi@0: esac;; aoqi@0: esac aoqi@0: aoqi@0: echo "${MFLAGS}"