xref: /titanic_41/usr/src/tools/gk/gen_make.machines.sh (revision 48bc00d6814e04ff3edb32cafe7d1bc580baff68)
1*48bc00d6Sjmcp#!/usr/bin/ksh93
2*48bc00d6Sjmcp#
3*48bc00d6Sjmcp# CDDL HEADER START
4*48bc00d6Sjmcp#
5*48bc00d6Sjmcp# The contents of this file are subject to the terms of the
6*48bc00d6Sjmcp# Common Development and Distribution License (the "License").
7*48bc00d6Sjmcp# You may not use this file except in compliance with the License.
8*48bc00d6Sjmcp#
9*48bc00d6Sjmcp# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*48bc00d6Sjmcp# or http://www.opensolaris.org/os/licensing.
11*48bc00d6Sjmcp# See the License for the specific language governing permissions
12*48bc00d6Sjmcp# and limitations under the License.
13*48bc00d6Sjmcp#
14*48bc00d6Sjmcp# When distributing Covered Code, include this CDDL HEADER in each
15*48bc00d6Sjmcp# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*48bc00d6Sjmcp# If applicable, add the following below this CDDL HEADER, with the
17*48bc00d6Sjmcp# fields enclosed by brackets "[]" replaced with your own identifying
18*48bc00d6Sjmcp# information: Portions Copyright [yyyy] [name of copyright owner]
19*48bc00d6Sjmcp#
20*48bc00d6Sjmcp# CDDL HEADER END
21*48bc00d6Sjmcp#
22*48bc00d6Sjmcp#
23*48bc00d6Sjmcp# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24*48bc00d6Sjmcp# Use is subject to license terms.
25*48bc00d6Sjmcp#
26*48bc00d6Sjmcp# script to generate example .make.machines for build users
27*48bc00d6Sjmcp#
28*48bc00d6Sjmcp
29*48bc00d6Sjmcp
30*48bc00d6SjmcpPATH=/usr/bin:/usr/sbin
31*48bc00d6Sjmcp
32*48bc00d6SjmcpTHISHOST=$(uname -n)
33*48bc00d6Sjmcp
34*48bc00d6Sjmcpcpus=$(psrinfo | grep on-line | wc -l)
35*48bc00d6Sjmcpmax=$(((cpus + 1) * 2))
36*48bc00d6Sjmcp
37*48bc00d6SjmcpEXISTING=$(grep "^$THISHOST" $HOME/.make.machines |awk -F"=" '{print $2}')
38*48bc00d6Sjmcp
39*48bc00d6Sjmcpif [[ -n "$EXISTING" ]] then
40*48bc00d6Sjmcp	printf "Your existing \$HOME/.make.machines has a concurrency "
41*48bc00d6Sjmcp	printf "setting of $EXISTING for host\n"
42*48bc00d6Sjmcp	printf "$THISHOST. If you wish to change the setting then this "
43*48bc00d6Sjmcp	printf "script suggests\nsetting concurrency to $max for a single-user "
44*48bc00d6Sjmcp	printf "machine. Multi-user machines might\nrequire different values.\n"
45*48bc00d6Sjmcpelse
46*48bc00d6Sjmcp	printf "$THISHOST max=$max\n" >> $HOME/.make.machines
47*48bc00d6Sjmcp	printf "dmake concurrency for host $THISHOST set to $max.\n"
48*48bc00d6Sjmcpfi
49