annotate make/linux/makefiles/adjust-mflags.sh @ 196:d1605aabd0a1

6719955: Update copyright year Summary: Update copyright year for files that have been modified in 2008 Reviewed-by: ohair, tbell
author xdono
date Wed, 02 Jul 2008 12:55:16 -0700
parents a294fd0c4b38
children c18cbe5936b8
rev   line source
duke@0 1 #! /bin/sh
duke@0 2 #
xdono@196 3 # Copyright 1999-2008 Sun Microsystems, Inc. All Rights Reserved.
duke@0 4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0 5 #
duke@0 6 # This code is free software; you can redistribute it and/or modify it
duke@0 7 # under the terms of the GNU General Public License version 2 only, as
duke@0 8 # published by the Free Software Foundation.
duke@0 9 #
duke@0 10 # This code is distributed in the hope that it will be useful, but WITHOUT
duke@0 11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0 12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@0 13 # version 2 for more details (a copy is included in the LICENSE file that
duke@0 14 # accompanied this code).
duke@0 15 #
duke@0 16 # You should have received a copy of the GNU General Public License version
duke@0 17 # 2 along with this work; if not, write to the Free Software Foundation,
duke@0 18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0 19 #
duke@0 20 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@0 21 # CA 95054 USA or visit www.sun.com if you need additional information or
duke@0 22 # have any questions.
duke@0 23 #
duke@0 24 #
duke@0 25
duke@0 26 # This script is used only from top.make.
duke@0 27 # The macro $(MFLAGS-adjusted) calls this script to
duke@0 28 # adjust the "-j" arguments to take into account
duke@0 29 # the HOTSPOT_BUILD_JOBS variable. The default
duke@0 30 # handling of the "-j" argument by gnumake does
duke@0 31 # not meet our needs, so we must adjust it ourselves.
duke@0 32
duke@0 33 # This argument adjustment applies to two recursive
duke@0 34 # calls to "$(MAKE) $(MFLAGS-adjusted)" in top.make.
duke@0 35 # One invokes adlc.make, and the other invokes vm.make.
duke@0 36 # The adjustment propagates the desired concurrency
duke@0 37 # level down to the sub-make (of the adlc or vm).
duke@0 38 # The default behavior of gnumake is to run all
duke@0 39 # sub-makes without concurrency ("-j1").
duke@0 40
duke@0 41 # Also, we use a make variable rather than an explicit
duke@0 42 # "-j<N>" argument to control this setting, so that
duke@0 43 # the concurrency setting (which must be tuned separately
duke@0 44 # for each MP system) can be set via an environment variable.
duke@0 45 # The recommended setting is 1.5x to 2x the number of available
duke@0 46 # CPUs on the MP system, which is large enough to keep the CPUs
duke@0 47 # busy (even though some jobs may be I/O bound) but not too large,
duke@0 48 # we may presume, to overflow the system's swap space.
duke@0 49
duke@0 50 set -eu
duke@0 51
duke@0 52 default_build_jobs=4
duke@0 53
duke@0 54 case $# in
duke@0 55 [12]) true;;
duke@0 56 *) >&2 echo "Usage: $0 ${MFLAGS} ${HOTSPOT_BUILD_JOBS}"; exit 2;;
duke@0 57 esac
duke@0 58
duke@0 59 MFLAGS=$1
duke@0 60 HOTSPOT_BUILD_JOBS=${2-}
duke@0 61
duke@0 62 # Normalize any -jN argument to the form " -j${HBJ}"
duke@0 63 MFLAGS=`
duke@0 64 echo "$MFLAGS" \
duke@0 65 | sed '
duke@0 66 s/^-/ -/
duke@0 67 s/ -\([^ ][^ ]*\)j/ -\1 -j/
duke@0 68 s/ -j[0-9][0-9]*/ -j/
duke@0 69 s/ -j\([^ ]\)/ -j -\1/
duke@0 70 s/ -j/ -j'${HOTSPOT_BUILD_JOBS:-${default_build_jobs}}'/
duke@0 71 ' `
duke@0 72
duke@0 73 case ${HOTSPOT_BUILD_JOBS} in \
duke@0 74
duke@0 75 '') case ${MFLAGS} in
duke@0 76 *\ -j*)
duke@0 77 >&2 echo "# Note: -jN is ineffective for setting parallelism in this makefile."
duke@0 78 >&2 echo "# please set HOTSPOT_BUILD_JOBS=${default_build_jobs} in the command line or environment."
duke@0 79 esac;;
duke@0 80
duke@0 81 ?*) case ${MFLAGS} in
duke@0 82 *\ -j*) true;;
duke@0 83 *) MFLAGS="-j${HOTSPOT_BUILD_JOBS} ${MFLAGS}";;
duke@0 84 esac;;
duke@0 85 esac
duke@0 86
duke@0 87 echo "${MFLAGS}"