1*27b03b36SApple OSS Distributions#!/bin/csh -f 2*27b03b36SApple OSS Distributionsset path = ($path .) 3*27b03b36SApple OSS Distributions###################################################################### 4*27b03b36SApple OSS Distributions# HISTORY 5*27b03b36SApple OSS Distributions# 1-Dec-87 Michael Young (mwyoung) at Carnegie-Mellon University 6*27b03b36SApple OSS Distributions# Added "-verbose" switch, so this script produces no output 7*27b03b36SApple OSS Distributions# in the normal case. 8*27b03b36SApple OSS Distributions# 9*27b03b36SApple OSS Distributions# 10-Oct-87 Mike Accetta (mja) at Carnegie-Mellon University 10*27b03b36SApple OSS Distributions# Flushed cmu_*.h and spin_locks.h 11*27b03b36SApple OSS Distributions# [ V5.1(XF18) ] 12*27b03b36SApple OSS Distributions# 13*27b03b36SApple OSS Distributions# 6-Apr-87 Avadis Tevanian (avie) at Carnegie-Mellon University 14*27b03b36SApple OSS Distributions# Use MASTER.local and MASTER.<machine>.local for generation of 15*27b03b36SApple OSS Distributions# configuration files in addition to MASTER and MASTER.<machine>. 16*27b03b36SApple OSS Distributions# 17*27b03b36SApple OSS Distributions# 25-Mar-87 Mike Accetta (mja) at Carnegie-Mellon University 18*27b03b36SApple OSS Distributions# Removed use of obsolete wb_*.h files when building the feature 19*27b03b36SApple OSS Distributions# list; modified to save the previous configuration file and 20*27b03b36SApple OSS Distributions# display the differences between it and the new file. 21*27b03b36SApple OSS Distributions# [ V5.1(F8) ] 22*27b03b36SApple OSS Distributions# 23*27b03b36SApple OSS Distributions# 25-Mar-87 Avadis Tevanian (avie) at Carnegie-Mellon University 24*27b03b36SApple OSS Distributions# If there is no /etc/machine just print out a message telling 25*27b03b36SApple OSS Distributions# user to use the -cpu option. I thought this script was supposed 26*27b03b36SApple OSS Distributions# to work even without a /etc/machine, but it doesn't... and this 27*27b03b36SApple OSS Distributions# is the easiest way out. 28*27b03b36SApple OSS Distributions# 29*27b03b36SApple OSS Distributions# 13-Mar-87 Mike Accetta (mja) at Carnegie-Mellon University 30*27b03b36SApple OSS Distributions# Added "romp_fpa.h" file to extra features for the RT. 31*27b03b36SApple OSS Distributions# [ V5.1(F7) ] 32*27b03b36SApple OSS Distributions# 33*27b03b36SApple OSS Distributions# 11-Mar-87 Mike Accetta (mja) at Carnegie-Mellon University 34*27b03b36SApple OSS Distributions# Updated to maintain the appropriate configuration features file 35*27b03b36SApple OSS Distributions# in the "machine" directory whenever the corresponding 36*27b03b36SApple OSS Distributions# configuration is generated. This replaces the old mechanism of 37*27b03b36SApple OSS Distributions# storing this directly in the <sys/features.h> file since it was 38*27b03b36SApple OSS Distributions# machine dependent and also precluded building programs for more 39*27b03b36SApple OSS Distributions# than one configuration from the same set of sources. 40*27b03b36SApple OSS Distributions# [ V5.1(F6) ] 41*27b03b36SApple OSS Distributions# 42*27b03b36SApple OSS Distributions# 21-Feb-87 Mike Accetta (mja) at Carnegie-Mellon University 43*27b03b36SApple OSS Distributions# Fixed to require wired-in cpu type names for only those 44*27b03b36SApple OSS Distributions# machines where the kernel name differs from that provided by 45*27b03b36SApple OSS Distributions# /etc/machine (i.e. IBMRT => ca and SUN => sun3); updated to 46*27b03b36SApple OSS Distributions# permit configuration descriptions in both machine indepedent 47*27b03b36SApple OSS Distributions# and dependent master configuration files so that attributes can 48*27b03b36SApple OSS Distributions# be grouped accordingly. 49*27b03b36SApple OSS Distributions# [ V5.1(F3) ] 50*27b03b36SApple OSS Distributions# 51*27b03b36SApple OSS Distributions# 17-Jan-87 Mike Accetta (mja) at Carnegie-Mellon University 52*27b03b36SApple OSS Distributions# Updated to work from any directory at the same level as 53*27b03b36SApple OSS Distributions# "conf"; generate configuration from both MASTER and 54*27b03b36SApple OSS Distributions# MASTER.<machine-type> files; added -cpu switch. 55*27b03b36SApple OSS Distributions# [ V5.1(F1) ] 56*27b03b36SApple OSS Distributions# 57*27b03b36SApple OSS Distributions# 18-Aug-86 Mike Accetta (mja) at Carnegie-Mellon University 58*27b03b36SApple OSS Distributions# Added -make switch and changed meaning of -config; upgraded to 59*27b03b36SApple OSS Distributions# allow multiple attributes per configuration and to define 60*27b03b36SApple OSS Distributions# configurations in terms of these attributes within MASTER. 61*27b03b36SApple OSS Distributions# 62*27b03b36SApple OSS Distributions# 14-Apr-83 Mike Accetta (mja) at Carnegie-Mellon University 63*27b03b36SApple OSS Distributions# Added -config switch to only run /etc/config without 64*27b03b36SApple OSS Distributions# "make depend" and "make". 65*27b03b36SApple OSS Distributions# 66*27b03b36SApple OSS Distributions###################################################################### 67*27b03b36SApple OSS Distributions 68*27b03b36SApple OSS Distributionsset prog=$0 69*27b03b36SApple OSS Distributionsset prog=$prog:t 70*27b03b36SApple OSS Distributionsset nonomatch 71*27b03b36SApple OSS Distributionsset OBJDIR=../BUILD 72*27b03b36SApple OSS Distributionsset SOURCEDIR=. 73*27b03b36SApple OSS Distributionsset CONFIG_DIR=$OBJROOT/SETUP/config 74*27b03b36SApple OSS Distributionsset MASTER_CONF_DIR=. 75*27b03b36SApple OSS Distributions 76*27b03b36SApple OSS Distributionsunset doconfig 77*27b03b36SApple OSS Distributionsunset beverbose 78*27b03b36SApple OSS Distributionsunset MACHINE 79*27b03b36SApple OSS Distributionsunset profile 80*27b03b36SApple OSS Distributionsunset SOC_CONFIG 81*27b03b36SApple OSS Distributionsunset PLATFORM 82*27b03b36SApple OSS Distributions 83*27b03b36SApple OSS Distributionswhile ($#argv >= 1) 84*27b03b36SApple OSS Distributions if ("$argv[1]" =~ -*) then 85*27b03b36SApple OSS Distributions switch ("$argv[1]") 86*27b03b36SApple OSS Distributions case "-c": 87*27b03b36SApple OSS Distributions case "-config": 88*27b03b36SApple OSS Distributions set doconfig 89*27b03b36SApple OSS Distributions breaksw 90*27b03b36SApple OSS Distributions case "-cpu": 91*27b03b36SApple OSS Distributions if ($#argv < 2) then 92*27b03b36SApple OSS Distributions echo "${prog}: missing argument to ${argv[1]}" 93*27b03b36SApple OSS Distributions exit 1 94*27b03b36SApple OSS Distributions endif 95*27b03b36SApple OSS Distributions set MACHINE="$argv[2]" 96*27b03b36SApple OSS Distributions shift 97*27b03b36SApple OSS Distributions breaksw 98*27b03b36SApple OSS Distributions case "-soc": 99*27b03b36SApple OSS Distributions if ($#argv < 2) then 100*27b03b36SApple OSS Distributions echo "${prog}: missing argument to ${argv[1]}" 101*27b03b36SApple OSS Distributions exit 1 102*27b03b36SApple OSS Distributions endif 103*27b03b36SApple OSS Distributions set SOC_CONFIG="$argv[2]" 104*27b03b36SApple OSS Distributions if (`echo $SOC_CONFIG | awk '{print substr($0,0,2)}'` == "vm") then 105*27b03b36SApple OSS Distributions set DEF_AVP="-DSOC_IS_VIRTUALIZED" 106*27b03b36SApple OSS Distributions else 107*27b03b36SApple OSS Distributions set DEF_AVP="" 108*27b03b36SApple OSS Distributions endif 109*27b03b36SApple OSS Distributions shift 110*27b03b36SApple OSS Distributions breaksw 111*27b03b36SApple OSS Distributions case "-platform": 112*27b03b36SApple OSS Distributions if ($#argv < 2) then 113*27b03b36SApple OSS Distributions echo "${prog}: missing argument to ${argv[1]}" 114*27b03b36SApple OSS Distributions exit 1 115*27b03b36SApple OSS Distributions endif 116*27b03b36SApple OSS Distributions set PLATFORM="$argv[2]" 117*27b03b36SApple OSS Distributions shift 118*27b03b36SApple OSS Distributions breaksw 119*27b03b36SApple OSS Distributions case "-d": 120*27b03b36SApple OSS Distributions if ($#argv < 2) then 121*27b03b36SApple OSS Distributions echo "${prog}: missing argument to ${argv[1]}" 122*27b03b36SApple OSS Distributions exit 1 123*27b03b36SApple OSS Distributions endif 124*27b03b36SApple OSS Distributions set OBJDIR="$argv[2]" 125*27b03b36SApple OSS Distributions shift 126*27b03b36SApple OSS Distributions breaksw 127*27b03b36SApple OSS Distributions case "-m": 128*27b03b36SApple OSS Distributions if ($#argv < 2) then 129*27b03b36SApple OSS Distributions echo "${prog}: missing argument to ${argv[1]}" 130*27b03b36SApple OSS Distributions exit 1 131*27b03b36SApple OSS Distributions endif 132*27b03b36SApple OSS Distributions set MASTER_CONF_DIR="$argv[2]" 133*27b03b36SApple OSS Distributions shift 134*27b03b36SApple OSS Distributions breaksw 135*27b03b36SApple OSS Distributions case "-s": 136*27b03b36SApple OSS Distributions if ($#argv < 2) then 137*27b03b36SApple OSS Distributions echo "${prog}: missing argument to ${argv[1]}" 138*27b03b36SApple OSS Distributions exit 1 139*27b03b36SApple OSS Distributions endif 140*27b03b36SApple OSS Distributions set SOURCEDIR="$argv[2]" 141*27b03b36SApple OSS Distributions shift 142*27b03b36SApple OSS Distributions breaksw 143*27b03b36SApple OSS Distributions case "-verbose": 144*27b03b36SApple OSS Distributions set beverbose 145*27b03b36SApple OSS Distributions breaksw 146*27b03b36SApple OSS Distributions case "-p": 147*27b03b36SApple OSS Distributions case "-profile": 148*27b03b36SApple OSS Distributions set profile 149*27b03b36SApple OSS Distributions breaksw 150*27b03b36SApple OSS Distributions default: 151*27b03b36SApple OSS Distributions echo "${prog}: ${argv[1]}: unknown switch" 152*27b03b36SApple OSS Distributions exit 1 153*27b03b36SApple OSS Distributions breaksw 154*27b03b36SApple OSS Distributions endsw 155*27b03b36SApple OSS Distributions shift 156*27b03b36SApple OSS Distributions else 157*27b03b36SApple OSS Distributions break 158*27b03b36SApple OSS Distributions endif 159*27b03b36SApple OSS Distributionsend 160*27b03b36SApple OSS Distributions 161*27b03b36SApple OSS Distributionsif ($#argv == 0) set argv=(GENERIC) 162*27b03b36SApple OSS Distributions 163*27b03b36SApple OSS Distributionsif (! $?MACHINE) then 164*27b03b36SApple OSS Distributions echo "${prog}: MACHINE not set" 165*27b03b36SApple OSS Distributions exit 1 166*27b03b36SApple OSS Distributionsendif 167*27b03b36SApple OSS Distributions 168*27b03b36SApple OSS Distributionsset cpu=`echo $MACHINE | tr A-Z a-z` 169*27b03b36SApple OSS Distributionsset ID=`echo $MACHINE | tr a-z A-Z` 170*27b03b36SApple OSS Distributionsset MASTER_DIR=${MASTER_CONF_DIR} 171*27b03b36SApple OSS Distributionsset MASTER = ${MASTER_DIR}/MASTER 172*27b03b36SApple OSS Distributions 173*27b03b36SApple OSS Distributionsforeach master_file (${MASTER}.${cpu}.${SOC_CONFIG}.${PLATFORM} ${MASTER}.${cpu}.${SOC_CONFIG} ${MASTER}.${cpu}.${PLATFORM} ${MASTER}.${cpu}) 174*27b03b36SApple OSS Distributions if (-f $master_file) then 175*27b03b36SApple OSS Distributions set MASTER_CPU = $master_file 176*27b03b36SApple OSS Distributions break 177*27b03b36SApple OSS Distributions endif 178*27b03b36SApple OSS Distributionsend 179*27b03b36SApple OSS Distributions 180*27b03b36SApple OSS Distributionsif ($?beverbose) then 181*27b03b36SApple OSS Distributions echo MASTER_CPU=$MASTER_CPU 182*27b03b36SApple OSS Distributionsendif 183*27b03b36SApple OSS Distributions 184*27b03b36SApple OSS Distributionsforeach SYS ($argv) 185*27b03b36SApple OSS Distributions set SYSID=${SYS}_${ID} 186*27b03b36SApple OSS Distributions set SYSCONF=$OBJDIR/config.$SYSID 187*27b03b36SApple OSS Distributions set BLDDIR=$OBJDIR 188*27b03b36SApple OSS Distributions if ($?beverbose) then 189*27b03b36SApple OSS Distributions echo "[ generating $SYSID from $MASTER_DIR/MASTER{,.$cpu}{,.local} ]" 190*27b03b36SApple OSS Distributions endif 191*27b03b36SApple OSS Distributions echo +$SYS \ 192*27b03b36SApple OSS Distributions | \ 193*27b03b36SApple OSS Distributions cat $MASTER $MASTER_CPU - \ 194*27b03b36SApple OSS Distributions $MASTER $MASTER_CPU \ 195*27b03b36SApple OSS Distributions | \ 196*27b03b36SApple OSS Distributions unifdef -t -DPLATFORM_${PLATFORM} -DCPU_$cpu -DSOC_CONFIG_${SOC_CONFIG} -DSYS_${SYS} $DEF_AVP - \ 197*27b03b36SApple OSS Distributions | \ 198*27b03b36SApple OSS Distributions sed -n \ 199*27b03b36SApple OSS Distributions -e "/^+/{" \ 200*27b03b36SApple OSS Distributions -e "s;[-+];#&;gp" \ 201*27b03b36SApple OSS Distributions -e 't loop' \ 202*27b03b36SApple OSS Distributions -e ': loop' \ 203*27b03b36SApple OSS Distributions -e 'n' \ 204*27b03b36SApple OSS Distributions -e '/^#/b loop' \ 205*27b03b36SApple OSS Distributions -e '/^$/b loop' \ 206*27b03b36SApple OSS Distributions -e 's;^\([^#]*\).*#[ ]*<\(.*\)>[ ]*$;\2#\1;' \ 207*27b03b36SApple OSS Distributions -e 't not' \ 208*27b03b36SApple OSS Distributions -e 's;\([^#]*\).*;#\1;' \ 209*27b03b36SApple OSS Distributions -e 't not' \ 210*27b03b36SApple OSS Distributions -e ': not' \ 211*27b03b36SApple OSS Distributions -e 's;[ ]*$;;' \ 212*27b03b36SApple OSS Distributions -e 's;^\!\(.*\);\1#\!;' \ 213*27b03b36SApple OSS Distributions -e 'p' \ 214*27b03b36SApple OSS Distributions -e 't loop' \ 215*27b03b36SApple OSS Distributions -e 'b loop' \ 216*27b03b36SApple OSS Distributions -e '}' \ 217*27b03b36SApple OSS Distributions -e "/^[^#]/d" \ 218*27b03b36SApple OSS Distributions -e 's; ; ;g' \ 219*27b03b36SApple OSS Distributions -e "s;^# *\([^ ]*\)[ ]*=[ ]*\[\(.*\)\].*;\1#\2;p" \ 220*27b03b36SApple OSS Distributions | \ 221*27b03b36SApple OSS Distributions awk '-F#' '\ 222*27b03b36SApple OSS Distributionspart == 0 && $1 != "" {\ 223*27b03b36SApple OSS Distributions m[$1]=m[$1] " " $2;\ 224*27b03b36SApple OSS Distributions next;\ 225*27b03b36SApple OSS Distributions}\ 226*27b03b36SApple OSS Distributionspart == 0 && $1 == "" {\ 227*27b03b36SApple OSS Distributions for (i=NF;i>1;i--){\ 228*27b03b36SApple OSS Distributions s=substr($i,2);\ 229*27b03b36SApple OSS Distributions c[++na]=substr($i,1,1);\ 230*27b03b36SApple OSS Distributions a[na]=s;\ 231*27b03b36SApple OSS Distributions }\ 232*27b03b36SApple OSS Distributions while (na > 0){\ 233*27b03b36SApple OSS Distributions s=a[na];\ 234*27b03b36SApple OSS Distributions d=c[na--];\ 235*27b03b36SApple OSS Distributions if (m[s] == "") {\ 236*27b03b36SApple OSS Distributions f[s]=d;\ 237*27b03b36SApple OSS Distributions } else {\ 238*27b03b36SApple OSS Distributions nx=split(m[s],x," ");\ 239*27b03b36SApple OSS Distributions for (j=nx;j>0;j--) {\ 240*27b03b36SApple OSS Distributions z=x[j];\ 241*27b03b36SApple OSS Distributions a[++na]=z;\ 242*27b03b36SApple OSS Distributions c[na]=d;\ 243*27b03b36SApple OSS Distributions }\ 244*27b03b36SApple OSS Distributions }\ 245*27b03b36SApple OSS Distributions }\ 246*27b03b36SApple OSS Distributions part=1;\ 247*27b03b36SApple OSS Distributions next;\ 248*27b03b36SApple OSS Distributions}\ 249*27b03b36SApple OSS Distributionspart != 0 {\ 250*27b03b36SApple OSS Distributions if ($1 != "") {\ 251*27b03b36SApple OSS Distributions n=split($1,x,",");\ 252*27b03b36SApple OSS Distributions ok=0;\ 253*27b03b36SApple OSS Distributions for (i=1;i<=n;i++) {\ 254*27b03b36SApple OSS Distributions if (f[x[i]] == "+") {\ 255*27b03b36SApple OSS Distributions ok=1;\ 256*27b03b36SApple OSS Distributions }\ 257*27b03b36SApple OSS Distributions }\ 258*27b03b36SApple OSS Distributions if (NF > 2 && ok == 0 || NF <= 2 && ok != 0) {\ 259*27b03b36SApple OSS Distributions print $2; \ 260*27b03b36SApple OSS Distributions }\ 261*27b03b36SApple OSS Distributions } else { \ 262*27b03b36SApple OSS Distributions print $2; \ 263*27b03b36SApple OSS Distributions }\ 264*27b03b36SApple OSS Distributions}\ 265*27b03b36SApple OSS Distributions' >$SYSCONF.new 266*27b03b36SApple OSS Distributions if (-z $SYSCONF.new) then 267*27b03b36SApple OSS Distributions echo "${prog}: ${$SYSID}: no such configuration in $MASTER_DIR/MASTER{,.$cpu}" 268*27b03b36SApple OSS Distributions rm -f $SYSCONF.new 269*27b03b36SApple OSS Distributions endif 270*27b03b36SApple OSS Distributions# 271*27b03b36SApple OSS Distributions# These paths are used by config. 272*27b03b36SApple OSS Distributions# 273*27b03b36SApple OSS Distributions# "builddir" is the name of the directory where kernel binaries 274*27b03b36SApple OSS Distributions# are put. It is a single path element, never absolute, and is 275*27b03b36SApple OSS Distributions# always relative to "objectdir". "builddir" is used by config 276*27b03b36SApple OSS Distributions# solely to determine where to put files created by "config" (e.g. 277*27b03b36SApple OSS Distributions# the created Makefile and *.h's.) 278*27b03b36SApple OSS Distributions# 279*27b03b36SApple OSS Distributions# "objectdir" is the name of the directory which will hold "builddir". 280*27b03b36SApple OSS Distributions# It is a path; if relative, it is relative to the current directory 281*27b03b36SApple OSS Distributions# where config is run. It's sole use is to be prepended to "builddir" 282*27b03b36SApple OSS Distributions# to indicate where config-created files are to be placed (see above). 283*27b03b36SApple OSS Distributions# 284*27b03b36SApple OSS Distributions# "sourcedir" is the location of the sources used to build the kernel. 285*27b03b36SApple OSS Distributions# It is a path; if relative, it is relative to the directory specified 286*27b03b36SApple OSS Distributions# by the concatenation of "objectdir" and "builddir" (i.e. where the 287*27b03b36SApple OSS Distributions# kernel binaries are put). 288*27b03b36SApple OSS Distributions# 289*27b03b36SApple OSS Distributions echo 'builddir "."' >> $SYSCONF.new 290*27b03b36SApple OSS Distributions echo 'objectdir "'$OBJDIR'"' >> $SYSCONF.new 291*27b03b36SApple OSS Distributions set SRCDIR=`dirname $SOURCE` 292*27b03b36SApple OSS Distributions echo 'sourcedir "'$SRCROOT'"' >> $SYSCONF.new 293*27b03b36SApple OSS Distributions if (-f $SYSCONF) then 294*27b03b36SApple OSS Distributions diff $SYSCONF $SYSCONF.new 295*27b03b36SApple OSS Distributions rm -f $SYSCONF.old 296*27b03b36SApple OSS Distributions mv $SYSCONF $SYSCONF.old 297*27b03b36SApple OSS Distributions endif 298*27b03b36SApple OSS Distributions rm -f $SYSCONF 299*27b03b36SApple OSS Distributions mv $SYSCONF.new $SYSCONF 300*27b03b36SApple OSS Distributions if ($?doconfig) then 301*27b03b36SApple OSS Distributions if ($?beverbose) then 302*27b03b36SApple OSS Distributions echo "[ configuring $SYSID ]" 303*27b03b36SApple OSS Distributions endif 304*27b03b36SApple OSS Distributions if ($?profile) then 305*27b03b36SApple OSS Distributions $CONFIG_DIR/config -c $SOURCEDIR -p $SYSCONF 306*27b03b36SApple OSS Distributions else 307*27b03b36SApple OSS Distributions $CONFIG_DIR/config -c $SOURCEDIR $SYSCONF 308*27b03b36SApple OSS Distributions endif 309*27b03b36SApple OSS Distributions endif 310*27b03b36SApple OSS Distributionsend 311