annotate make/solaris/makefiles/adjust-mflags.sh @ 20804:7848fc12602b

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