Annotation of kernel/conf/tools/doconf/doconf.csh, revision 1.1.1.1

1.1       root        1: #!/bin/csh -f
                      2: set path = ($path .)
                      3: 
                      4: ##
                      5: # Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
                      6: #
                      7: # @APPLE_LICENSE_HEADER_START@
                      8: # 
                      9: # Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
                     10: # Reserved.  This file contains Original Code and/or Modifications of
                     11: # Original Code as defined in and that are subject to the Apple Public
                     12: # Source License Version 1.1 (the "License").  You may not use this file
                     13: # except in compliance with the License.  Please obtain a copy of the
                     14: # License at http://www.apple.com/publicsource and read it before using
                     15: # this file.
                     16: # 
                     17: # The Original Code and all software distributed under the License are
                     18: # distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
                     19: # EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
                     20: # INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
                     21: # FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
                     22: # License for the specific language governing rights and limitations
                     23: # under the License.
                     24: # 
                     25: # @APPLE_LICENSE_HEADER_END@
                     26: ##
                     27: 
                     28: set prog=$0
                     29: set prog=$prog:t
                     30: set nonomatch
                     31: set OBJDIR=../BUILD
                     32: set CONFIG_DIR=/usr/local/bin
                     33: 
                     34: unset domake
                     35: unset doconfig
                     36: unset beverbose
                     37: unset MACHINE
                     38: unset profile
                     39: 
                     40: while ($#argv >= 1)
                     41:     if ("$argv[1]" =~ -*) then
                     42:         switch ("$argv[1]")
                     43:        case "-c":
                     44:        case "-config":
                     45:            set doconfig
                     46:            breaksw
                     47:        case "-m":
                     48:        case "-make":
                     49:            set domake
                     50:            breaksw
                     51:        case "-cpu":
                     52:            if ($#argv < 2) then
                     53:                echo "${prog}: missing argument to ${argv[1]}"
                     54:                exit 1
                     55:            endif
                     56:            set MACHINE="$argv[2]"
                     57:            shift
                     58:            breaksw
                     59:        case "-d":
                     60:            if ($#argv < 2) then
                     61:                echo "${prog}: missing argument to ${argv[1]}"
                     62:                exit 1
                     63:            endif
                     64:            set OBJDIR="$argv[2]"
                     65:            shift
                     66:            breaksw
                     67:        case "-verbose":
                     68:            set beverbose
                     69:            breaksw
                     70:        case "-p":
                     71:        case "-profile":
                     72:            set profile
                     73:            breaksw
                     74:        default:
                     75:            echo "${prog}: ${argv[1]}: unknown switch"
                     76:            exit 1
                     77:            breaksw
                     78:        endsw
                     79:        shift
                     80:     else
                     81:        break
                     82:     endif
                     83: end
                     84: 
                     85: if ($#argv == 0) set argv=(GENERIC)
                     86: 
                     87: if (! $?MACHINE) then
                     88:     if (-d /NextApps) then
                     89:        set MACHINE=`hostinfo | awk '/MC680x0/ { printf("m68k") } /MC880x0/ { printf("m88k") }'`
                     90:     endif
                     91: endif
                     92: 
                     93: if (! $?MACHINE) then
                     94:     if (-f /etc/machine) then
                     95:            set MACHINE="`/etc/machine`"
                     96:     else
                     97:            echo "${prog}: no /etc/machine, specify machine type with -cpu"
                     98:            echo "${prog}: e.g. ${prog} -cpu VAX CONFIGURATION"
                     99:            exit 1
                    100:     endif
                    101: endif
                    102: 
                    103: set FEATURES_EXTRA=
                    104: 
                    105: switch ("$MACHINE")
                    106:     case IBMRT:
                    107:        set cpu=ca
                    108:        set ID=RT
                    109:        set FEATURES_EXTRA="romp_dualcall.h romp_fpa.h"
                    110:        breaksw
                    111:     case SUN:
                    112:        set cpu=sun3
                    113:        set ID=SUN3
                    114:        breaksw
                    115:     default:
                    116:        set cpu=`echo $MACHINE | tr A-Z a-z`
                    117:        set ID=`echo $MACHINE | tr a-z A-Z`
                    118:        breaksw
                    119: endsw
                    120: set FEATURES=../h/features.h
                    121: set FEATURES_H=(cs_*.h mach_*.h net_*.h\
                    122:                cputypes.h cpus.h vice.h\
                    123:                $FEATURES_EXTRA)
                    124: set MASTER_DIR=../conf
                    125: set MASTER =   ${MASTER_DIR}/MASTER
                    126: set MASTER_CPU=${MASTER}.${cpu}
                    127: 
                    128: set MASTER_LOCAL = ${MASTER}.local
                    129: set MASTER_CPU_LOCAL = ${MASTER_CPU}.local
                    130: if (! -f $MASTER_LOCAL) set MASTER_LOCAL = ""
                    131: if (! -f $MASTER_CPU_LOCAL) set MASTER_CPU_LOCAL = ""
                    132: 
                    133: if (! -d $OBJDIR) then
                    134:     echo "[ creating $OBJDIR ]"
                    135:     mkdir -p $OBJDIR
                    136: endif
                    137: 
                    138: foreach SYS ($argv)
                    139:     set SYSID=${SYS}_${ID}
                    140:     set SYSCONF=$OBJDIR/config.$SYSID
                    141:     set BLDDIR=$OBJDIR/$SYSID
                    142:     if ($?beverbose) then
                    143:        echo "[ generating $SYSID from $MASTER_DIR/MASTER{,.$cpu}{,.local} ]"
                    144:     endif
                    145:     echo +$SYS \
                    146:     | \
                    147:     cat $MASTER $MASTER_LOCAL $MASTER_CPU $MASTER_CPU_LOCAL - \
                    148:         $MASTER $MASTER_LOCAL $MASTER_CPU $MASTER_CPU_LOCAL \
                    149:     | \
                    150:     sed -n \
                    151:        -e "/^+/{" \
                    152:           -e "s;[-+];#&;gp" \
                    153:              -e 't loop' \
                    154:           -e ': loop' \
                    155:            -e 'n' \
                    156:           -e '/^#/b loop' \
                    157:           -e '/^$/b loop' \
                    158:           -e 's;^\([^#]*\).*#[         ]*<\(.*\)>[     ]*$;\2#\1;' \
                    159:              -e 't not' \
                    160:           -e 's;\([^#]*\).*;#\1;' \
                    161:              -e 't not' \
                    162:           -e ': not' \
                    163:           -e 's;[      ]*$;;' \
                    164:           -e 's;^\!\(.*\);\1#\!;' \
                    165:           -e 'p' \
                    166:              -e 't loop' \
                    167:            -e 'b loop' \
                    168:        -e '}' \
                    169:        -e "/^[^#]/d" \
                    170:        -e 's;  ; ;g' \
                    171:        -e "s;^# *\([^ ]*\)[ ]*=[ ]*\[\(.*\)\].*;\1#\2;p" \
                    172:     | \
                    173:     awk '-F#' '\
                    174: part == 0 && $1 != "" {\
                    175:        m[$1]=m[$1] " " $2;\
                    176:        next;\
                    177: }\
                    178: part == 0 && $1 == "" {\
                    179:        for (i=NF;i>1;i--){\
                    180:                s=substr($i,2);\
                    181:                c[++na]=substr($i,1,1);\
                    182:                a[na]=s;\
                    183:        }\
                    184:        while (na > 0){\
                    185:                s=a[na];\
                    186:                d=c[na--];\
                    187:                if (m[s] == "") {\
                    188:                        f[s]=d;\
                    189:                } else {\
                    190:                        nx=split(m[s],x," ");\
                    191:                        for (j=nx;j>0;j--) {\
                    192:                                z=x[j];\
                    193:                                a[++na]=z;\
                    194:                                c[na]=d;\
                    195:                        }\
                    196:                }\
                    197:        }\
                    198:        part=1;\
                    199:        next;\
                    200: }\
                    201: part != 0 {\
                    202:        if ($1 != "") {\
                    203:                n=split($1,x,",");\
                    204:                ok=0;\
                    205:                for (i=1;i<=n;i++) {\
                    206:                        if (f[x[i]] == "+") {\
                    207:                                ok=1;\
                    208:                        }\
                    209:                }\
                    210:                if (NF > 2 && ok == 0 || NF <= 2 && ok != 0) {\
                    211:                        print $2; \
                    212:                }\
                    213:        } else { \
                    214:                print $2; \
                    215:        }\
                    216: }\
                    217: ' >$SYSCONF.new
                    218:     if (-z $SYSCONF.new) then
                    219:        echo "${prog}: ${$SYSID}: no such configuration in $MASTER_DIR/MASTER{,.$cpu}"
                    220:        rm -f $SYSCONF.new
                    221:     endif
                    222:     if (! -d $BLDDIR) then
                    223:        echo "[ creating $BLDDIR ]"
                    224:        mkdir -p $BLDDIR
                    225:     endif
                    226: #
                    227: # These paths are used by config.
                    228: #
                    229: # "builddir" is the name of the directory where kernel binaries
                    230: # are put.  It is a single path element, never absolute, and is
                    231: # always relative to "objectdir".  "builddir" is used by config
                    232: # solely to determine where to put files created by "config" (e.g.
                    233: # the created Makefile and *.h's.)
                    234: #
                    235: # "objectdir" is the name of the directory which will hold "builddir".
                    236: # It is a path; if relative, it is relative to the current directory
                    237: # where config is run.  It's sole use is to be prepended to "builddir"
                    238: # to indicate where config-created files are to be placed (see above).
                    239: #
                    240: # "sourcedir" is the location of the sources used to build the kernel.
                    241: # It is a path; if relative, it is relative to the directory specified
                    242: # by the concatenation of "objectdir" and "builddir" (i.e. where the
                    243: # kernel binaries are put).
                    244: #
                    245:     echo 'builddir     '${SYSID}               >> $SYSCONF.new
                    246:     echo 'objectdir    "'$OBJDIR'"'            >> $SYSCONF.new
                    247:     set SRCDIR=`relpath -d .. $BLDDIR ..`
                    248:     echo 'sourcedir    "'$SRCDIR'"'            >> $SYSCONF.new
                    249:     if (-f $SYSCONF) then
                    250:        diff $SYSCONF $SYSCONF.new
                    251:        rm -f $SYSCONF.old
                    252:        mv $SYSCONF $SYSCONF.old
                    253:     endif
                    254:     rm -f $SYSCONF
                    255:     mv $SYSCONF.new $SYSCONF
                    256:     if ($?doconfig) then
                    257:        echo "[ configuring $SYSID ]"
                    258:        if ($?profile) then
                    259:            $CONFIG_DIR/config -p $SYSCONF
                    260:        else
                    261:            $CONFIG_DIR/config $SYSCONF
                    262:        endif
                    263:     endif
                    264:     if ($?domake) then
                    265:         echo "[ making $SYSID ]"
                    266:         (cd $BLDDIR; make)
                    267:     endif
                    268: end

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.