make/aix/makefiles/adjust-mflags.sh

changeset 6464
b83f7d608548
parent 0
f90c822e73f8
child 7375
9dee5f673903
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/make/aix/makefiles/adjust-mflags.sh	Fri Sep 06 20:08:29 2013 +0200
     1.3 @@ -0,0 +1,87 @@
     1.4 +#! /bin/sh
     1.5 +#
     1.6 +# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
     1.7 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8 +#
     1.9 +# This code is free software; you can redistribute it and/or modify it
    1.10 +# under the terms of the GNU General Public License version 2 only, as
    1.11 +# published by the Free Software Foundation.
    1.12 +#
    1.13 +# This code is distributed in the hope that it will be useful, but WITHOUT
    1.14 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.15 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.16 +# version 2 for more details (a copy is included in the LICENSE file that
    1.17 +# accompanied this code).
    1.18 +#
    1.19 +# You should have received a copy of the GNU General Public License version
    1.20 +# 2 along with this work; if not, write to the Free Software Foundation,
    1.21 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.22 +#
    1.23 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.24 +# or visit www.oracle.com if you need additional information or have any
    1.25 +# questions.
    1.26 +#  
    1.27 +#
    1.28 +
    1.29 +# This script is used only from top.make.
    1.30 +# The macro $(MFLAGS-adjusted) calls this script to
    1.31 +# adjust the "-j" arguments to take into account
    1.32 +# the HOTSPOT_BUILD_JOBS variable.  The default
    1.33 +# handling of the "-j" argument by gnumake does
    1.34 +# not meet our needs, so we must adjust it ourselves.
    1.35 +
    1.36 +# This argument adjustment applies to two recursive
    1.37 +# calls to "$(MAKE) $(MFLAGS-adjusted)" in top.make.
    1.38 +# One invokes adlc.make, and the other invokes vm.make.
    1.39 +# The adjustment propagates the desired concurrency
    1.40 +# level down to the sub-make (of the adlc or vm).
    1.41 +# The default behavior of gnumake is to run all
    1.42 +# sub-makes without concurrency ("-j1").
    1.43 +
    1.44 +# Also, we use a make variable rather than an explicit
    1.45 +# "-j<N>" argument to control this setting, so that
    1.46 +# the concurrency setting (which must be tuned separately
    1.47 +# for each MP system) can be set via an environment variable.
    1.48 +# The recommended setting is 1.5x to 2x the number of available
    1.49 +# CPUs on the MP system, which is large enough to keep the CPUs
    1.50 +# busy (even though some jobs may be I/O bound) but not too large,
    1.51 +# we may presume, to overflow the system's swap space.
    1.52 +
    1.53 +set -eu
    1.54 +
    1.55 +default_build_jobs=4
    1.56 +
    1.57 +case $# in
    1.58 +[12])	true;;
    1.59 +*)	>&2 echo "Usage: $0 ${MFLAGS} ${HOTSPOT_BUILD_JOBS}"; exit 2;;
    1.60 +esac
    1.61 +
    1.62 +MFLAGS=$1
    1.63 +HOTSPOT_BUILD_JOBS=${2-}
    1.64 +
    1.65 +# Normalize any -jN argument to the form " -j${HBJ}"
    1.66 +MFLAGS=`
    1.67 +	echo "$MFLAGS" \
    1.68 +	| sed '
    1.69 +		s/^-/ -/
    1.70 +		s/ -\([^ 	][^ 	]*\)j/ -\1 -j/
    1.71 +		s/ -j[0-9][0-9]*/ -j/
    1.72 +		s/ -j\([^ 	]\)/ -j -\1/
    1.73 +		s/ -j/ -j'${HOTSPOT_BUILD_JOBS:-${default_build_jobs}}'/
    1.74 +	' `
    1.75 +
    1.76 +case ${HOTSPOT_BUILD_JOBS} in \
    1.77 +
    1.78 +'') case ${MFLAGS} in
    1.79 +    *\ -j*)
    1.80 +	>&2 echo "# Note: -jN is ineffective for setting parallelism in this makefile." 
    1.81 +	>&2 echo "# please set HOTSPOT_BUILD_JOBS=${default_build_jobs} in the command line or environment."
    1.82 +    esac;;
    1.83 +
    1.84 +?*) case ${MFLAGS} in
    1.85 +     *\ -j*) true;;
    1.86 +     *)      MFLAGS="-j${HOTSPOT_BUILD_JOBS} ${MFLAGS}";;
    1.87 +    esac;;
    1.88 +esac
    1.89 +
    1.90 +echo "${MFLAGS}"

mercurial