Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/make/aix/makefiles/adjust-mflags.sh
32284 views
#! /bin/sh1#2# Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.4#5# This code is free software; you can redistribute it and/or modify it6# under the terms of the GNU General Public License version 2 only, as7# published by the Free Software Foundation.8#9# This code is distributed in the hope that it will be useful, but WITHOUT10# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12# version 2 for more details (a copy is included in the LICENSE file that13# accompanied this code).14#15# You should have received a copy of the GNU General Public License version16# 2 along with this work; if not, write to the Free Software Foundation,17# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18#19# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20# or visit www.oracle.com if you need additional information or have any21# questions.22#23#2425# This script is used only from top.make.26# The macro $(MFLAGS-adjusted) calls this script to27# adjust the "-j" arguments to take into account28# the HOTSPOT_BUILD_JOBS variable. The default29# handling of the "-j" argument by gnumake does30# not meet our needs, so we must adjust it ourselves.3132# This argument adjustment applies to two recursive33# calls to "$(MAKE) $(MFLAGS-adjusted)" in top.make.34# One invokes adlc.make, and the other invokes vm.make.35# The adjustment propagates the desired concurrency36# level down to the sub-make (of the adlc or vm).37# The default behavior of gnumake is to run all38# sub-makes without concurrency ("-j1").3940# Also, we use a make variable rather than an explicit41# "-j<N>" argument to control this setting, so that42# the concurrency setting (which must be tuned separately43# for each MP system) can be set via an environment variable.44# The recommended setting is 1.5x to 2x the number of available45# CPUs on the MP system, which is large enough to keep the CPUs46# busy (even though some jobs may be I/O bound) but not too large,47# we may presume, to overflow the system's swap space.4849set -eu5051default_build_jobs=45253case $# in54[12]) true;;55*) >&2 echo "Usage: $0 ${MFLAGS} ${HOTSPOT_BUILD_JOBS}"; exit 2;;56esac5758MFLAGS=$159HOTSPOT_BUILD_JOBS=${2-}6061# Normalize any -jN argument to the form " -j${HBJ}"62MFLAGS=`63echo "$MFLAGS" \64| sed '65s/^-/ -/66s/ -\([^ I][^ I]*\)j/ -\1 -j/67s/ -j[0-9][0-9]*/ -j/68s/ -j\([^ ]\)/ -j -\1/69s/ -j/ -j'${HOTSPOT_BUILD_JOBS:-${default_build_jobs}}'/70' `7172case ${HOTSPOT_BUILD_JOBS} in \7374'') case ${MFLAGS} in75*\ -j*)76>&2 echo "# Note: -jN is ineffective for setting parallelism in this makefile."77>&2 echo "# please set HOTSPOT_BUILD_JOBS=${default_build_jobs} in the command line or environment."78esac;;7980?*) case ${MFLAGS} in81*\ -j*) true;;82*) MFLAGS="-j${HOTSPOT_BUILD_JOBS} ${MFLAGS}";;83esac;;84esac8586echo "${MFLAGS}"878889