sets.subr revision 1.91
11.91Sdyoung# $NetBSD: sets.subr,v 1.91 2009/11/05 17:34:25 dyoung Exp $ 21.1Sdyoung# 31.9Slukem 41.9Slukem# 51.11Slukem# The following variables contain defaults for sets.subr functions and callers: 61.9Slukem# setsdir path to src/distrib/sets 71.9Slukem# nlists list of base sets 81.9Slukem# xlists list of x11 sets 91.9Slukem# obsolete controls if obsolete files are selected instead 101.76Stsutsui# module if != "no", enable MODULE sets 111.9Slukem# shlib shared library format (a.out, elf, or "") 121.9Slukem# stlib static library format (a.out, elf) 131.11Slukem# 141.11Slukem# The following <bsd.own.mk> variables are exported to the environment: 151.11Slukem# MACHINE 161.11Slukem# MACHINE_ARCH 171.11Slukem# MACHINE_CPU 181.87Sskrll# HAVE_BINUTILS 191.48Smrg# HAVE_GCC 201.52Slukem# HAVE_GDB 211.11Slukem# TOOLCHAIN_MISSING 221.11Slukem# OBJECT_FMT 231.22Slukem# as well as: 241.22Slukem# 251.22SlukemMKVARS="\ 261.22Slukem MKBFD \ 271.87Sskrll MKBINUTILS \ 281.22Slukem MKCATPAGES \ 291.71Smrg MKCOMPAT \ 301.22Slukem MKCRYPTO \ 311.22Slukem MKCRYPTO_IDEA \ 321.22Slukem MKCRYPTO_MDC2 \ 331.22Slukem MKCRYPTO_RC5 \ 341.22Slukem MKCVS \ 351.67Slukem MKDEBUG \ 361.69Slukem MKDEBUGLIB \ 371.67Slukem MKDOC \ 381.67Slukem MKDYNAMICROOT \ 391.52Slukem MKGCC \ 401.36Smatt MKGCCCMDS \ 411.32Sscw MKGDB \ 421.22Slukem MKHESIOD \ 431.68Slukem MKHTML \ 441.67Slukem MKINET6 \ 451.23Slukem MKINFO \ 461.39Speter MKIPFILTER \ 471.51Smrg MKISCSI \ 481.22Slukem MKKERBEROS \ 491.85Sdyoung MKKMOD \ 501.67Slukem MKLDAP \ 511.22Slukem MKLINT \ 521.78Sagc MKLVM \ 531.22Slukem MKMAN \ 541.33Sjmc MKMANPAGES \ 551.22Slukem MKMANZ \ 561.88Stsarna MKMDNS \ 571.23Slukem MKNLS \ 581.66Sdyoung MKNVI \ 591.37She MKPAM \ 601.39Speter MKPF \ 611.30Smatt MKPIC \ 621.22Slukem MKPOSTFIX \ 631.22Slukem MKPROFILE \ 641.24Slukem MKSHARE \ 651.22Slukem MKSKEY \ 661.40Stron MKX11 \ 671.84Smrg MKX11FONTS \ 681.68Slukem MKXORG \ 691.22Slukem MKYP \ 701.89Shaad MKZFS \ 711.41Slukem USE_INET6 \ 721.41Slukem USE_KERBEROS \ 731.63Slukem USE_LDAP \ 741.41Slukem USE_YP \ 751.64She NETBSDSRCDIR \ 761.65She MAKEVERBOSE \ 771.22Slukem" 781.42Sapb# 791.42Sapb# The following variables refer to tools that are used when building sets: 801.42Sapb# 811.43Sapb: ${AWK:=awk} 821.42Sapb: ${CKSUM:=cksum} 831.43Sapb: ${COMM:=comm} 841.44Sapb: ${DATE:=date} 851.43Sapb: ${DB:=db} 861.43Sapb: ${EGREP:=egrep} 871.43Sapb: ${ENV_CMD:=env} # ${ENV} is special to sh(1), ksh(1), etc. 881.44Sapb: ${FGREP:=fgrep} 891.43Sapb: ${FIND:=find} 901.44Sapb: ${GREP:=grep} 911.43Sapb: ${GZIP_CMD:=gzip} # ${GZIP} is special to gzip(1) 921.44Sapb: ${HOSTNAME:=hostname} 931.42Sapb: ${HOST_SH:=sh} 941.43Sapb: ${IDENT:=ident} 951.43Sapb: ${JOIN:=join} 961.43Sapb: ${LS:=ls} 971.43Sapb: ${MAKE:=make} 981.42Sapb: ${MKTEMP:=mktemp} 991.43Sapb: ${MTREE:=mtree} 1001.43Sapb: ${PASTE:=paste} 1011.42Sapb: ${PAX:=pax} 1021.43Sapb: ${PKG_CREATE:=pkg_create} 1031.43Sapb: ${PRINTF:=printf} 1041.43Sapb: ${SED:=sed} 1051.43Sapb: ${SORT:=sort} 1061.44Sapb: ${STAT:=stat} 1071.44Sapb: ${TSORT:=tsort} 1081.43Sapb: ${UNAME:=uname} 1091.43Sapb: ${WC:=wc} 1101.43Sapb 1111.45Sapb# 1121.45Sapb# If printf is a shell builtin command, then we can 1131.45Sapb# implement cheaper versions of basename and dirname 1141.45Sapb# that do not involve any fork/exec overhead. 1151.45Sapb# If printf is not builtin, approximate it using echo, 1161.45Sapb# and hope there are no weird file names that cause 1171.45Sapb# some versions of echo to do the wrong thing. 1181.45Sapb# (Converting to this version of dirname speeded up the 1191.45Sapb# syspkgdeps script by an order of magnitude, from 68 1201.45Sapb# seconds to 6.3 seconds on one particular host.) 1211.45Sapb# 1221.45Sapb# Note that naive approximations for dirname 1231.45Sapb# using ${foo%/*} do not do the right thing in cases 1241.45Sapb# where the result should be "/" or ".". 1251.45Sapb# 1261.45Sapbcase "$(type printf)" in 1271.45Sapb*builtin*) 1281.45Sapb basename () 1291.45Sapb { 1301.45Sapb local bn 1311.45Sapb bn="${1##*/}" 1321.45Sapb bn="${bn%$2}" 1331.45Sapb printf "%s\n" "$bn" 1341.45Sapb } 1351.45Sapb dirname () 1361.45Sapb { 1371.45Sapb local dn 1381.45Sapb case "$1" in 1391.45Sapb ?*/*) dn="${1%/*}" ;; 1401.45Sapb /*) dn=/ ;; 1411.45Sapb *) dn=. ;; 1421.45Sapb esac 1431.45Sapb printf "%s\n" "$dn" 1441.45Sapb } 1451.45Sapb ;; 1461.45Sapb*) 1471.45Sapb basename () 1481.45Sapb { 1491.45Sapb local bn 1501.45Sapb bn="${1##*/}" 1511.45Sapb bn="${bn%$2}" 1521.45Sapb echo "$bn" 1531.45Sapb } 1541.45Sapb dirname () 1551.45Sapb { 1561.45Sapb local dn 1571.45Sapb case "$1" in 1581.45Sapb ?*/*) dn="${1%/*}" ;; 1591.45Sapb /*) dn=/ ;; 1601.45Sapb *) dn=. ;; 1611.45Sapb esac 1621.45Sapb echo "$dn" 1631.45Sapb } 1641.45Sapb ;; 1651.45Sapbesac 1661.45Sapb 1671.9SlukemoIFS=$IFS 1681.9SlukemIFS=" 1691.9Slukem" 1701.9Slukemfor x in $( 1711.43Sapb${MAKE} -B -f- all <<EOMAKE 1721.9Slukem.include <bsd.own.mk> 1731.33Sjmc.if (\${MKMAN} == "no" || empty(MANINSTALL:Mmaninstall)) 1741.33SjmcMKMANPAGES=no 1751.33Sjmc.else 1761.33SjmcMKMANPAGES=yes 1771.33Sjmc.endif 1781.72Smrg.if \${MKX11} != "no" 1791.72Smrg. if \${X11FLAVOUR} == "Xorg" 1801.72SmrgMKXORG:=yes 1811.72SmrgMKX11:=no 1821.72Smrg. else 1831.72SmrgMKXORG:=no 1841.72Smrg. endif 1851.72Smrg.endif 1861.9Slukemall: 1871.11Slukem.for i in MACHINE MACHINE_ARCH MACHINE_CPU \ 1881.87Sskrll HAVE_BINUTILS HAVE_GCC HAVE_GDB OBJECT_FMT TOOLCHAIN_MISSING \ 1891.12Slukem ${MKVARS} 1901.12Slukem @echo "export \$i=\${\$i}" 1911.11Slukem.endfor 1921.9Slukem 1931.12SlukemEOMAKE 1941.9Slukem); do 1951.11Slukem# echo 1>&2 "DEBUG: read $x" 1961.9Slukem eval $x 1971.9Slukemdone 1981.9SlukemIFS=$oIFS 1991.9Slukem 2001.34Serhsetsdir=${0%/*} 2011.9Slukemobsolete=0 2021.76Stsutsuimodule=yes 2031.91Sdyoungif [ "${MKKMOD}" = "no" ]; then 2041.91Sdyoung module=no # MODULEs are off. 2051.91Sdyoungelif [ "${MACHINE}" = "evbppc" ]; then 2061.76Stsutsui module=no # Turn off MODULEs for some ports. 2071.9Slukemfi 2081.31Sjmc# Determine lib type. Do this first so stlib also gets set. 2091.31Sjmcif [ "${OBJECT_FMT}" = "ELF" ]; then 2101.9Slukem shlib=elf 2111.9Slukemelse 2121.9Slukem shlib=aout 2131.9Slukemfi 2141.9Slukemstlib=$shlib 2151.31Sjmc# Now check for MKPIC or specials and turn off shlib if need be. 2161.31Sjmcif [ "${MKPIC}" = "no" ]; then 2171.31Sjmc shlib=no 2181.31Sjmcfi 2191.29Suweif [ "${MACHINE_ARCH}" = "m68000" ]; then 2201.9Slukem shlib=no # Turn off shlibs for some ports. 2211.9Slukemfi 2221.86Sjnemethif [ "$module" != "no" ]; then 2231.86Sjnemeth nlists="base comp etc games man misc modules tests text" 2241.86Sjnemethelse 2251.86Sjnemeth nlists="base comp etc games man misc tests text" 2261.86Sjnemethfi 2271.86Sjnemethxlists="xbase xcomp xetc xfont xserver" 2281.9Slukem 2291.64SheOSRELEASE=`${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh` 2301.81SrmindMODULEDIR="stand/${MACHINE}/${OSRELEASE}/modules" 2311.62SadSUBST="s#@MODULEDIR@#${MODULEDIR}#g" 2321.62SadSUBST="${SUBST};s#@OSRELEASE@#${OSRELEASE}#g" 2331.62SadSUBST="${SUBST};s#@MACHINE@#${MACHINE}#g" 2341.60Sad 2351.9Slukem# 2361.9Slukem# list_set_files setfile [...] 2371.1Sdyoung# 2381.9Slukem# Produce a packing list for setfile(s). 2391.9Slukem# In each file, a record consists of a path and a System Package name, 2401.9Slukem# separated by whitespace. E.g., 2411.9Slukem# 2421.91Sdyoung# # $NetBSD: sets.subr,v 1.91 2009/11/05 17:34:25 dyoung Exp $ 2431.9Slukem# . base-sys-root [keyword[,...]] 2441.9Slukem# ./altroot base-sys-root 2451.9Slukem# ./bin base-sys-root 2461.9Slukem# ./bin/[ base-util-root 2471.9Slukem# ./bin/cat base-util-root 2481.9Slukem# [...] 2491.9Slukem# 2501.9Slukem# A # in the first column marks a comment. 2511.9Slukem# 2521.9Slukem# If ${obsolete} != 0, only entries with an "obsolete" keyword will 2531.52Slukem# be printed. All other keywords must be present. 2541.9Slukem# 2551.9Slukem# The third field is an optional comma separated list of keywords to 2561.9Slukem# control if a record is printed; every keyword listed must be enabled 2571.9Slukem# for the record to be printed. The following keywords are available: 2581.9Slukem# dummy dummy entry (ignored) 2591.13Slukem# obsolete file is obsolete, and only printed if 2601.13Slukem# ${obsolete} != 0 2611.13Slukem# 2621.87Sskrll# bfd obsolete, use binutils. 2631.87Sskrll# binutils ${MKBINUTILS} != no 2641.22Slukem# catpages ${MKCATPAGES} != no 2651.71Smrg# compat ${MKCOMPAT} != no 2661.22Slukem# crypto ${MKCRYPTO} != no 2671.22Slukem# crypto_idea ${MKCRYPTO_IDEA} != no 2681.22Slukem# crypto_mdc2 ${MKCRYPTO_MDC2} != no 2691.22Slukem# crypto_rc5 ${MKCRYPTO_RC5} != no 2701.22Slukem# cvs ${MKCVS} != no 2711.53Slukem# debug ${MKDEBUG} != no 2721.69Slukem# debuglib ${MKDEBUGLIB} != no 2731.23Slukem# doc ${MKDOC} != no 2741.67Slukem# dynamicroot ${MKDYNAMICROOT} != no 2751.52Slukem# gcc ${MKGCC} != no 2761.36Smatt# gcccmds ${MKGCCCMDS} != no 2771.32Sscw# gdb ${MKGDB} != no 2781.22Slukem# hesiod ${MKHESIOD} != no 2791.68Slukem# html ${MKHTML} != no 2801.67Slukem# inet6 ${MKINET6} != no 2811.23Slukem# info ${MKINFO} != no 2821.39Speter# ipfilter ${MKIPFILTER} != no 2831.51Smrg# iscsi ${MKISCSI} != no 2841.22Slukem# kerberos ${MKKERBEROS} != no 2851.85Sdyoung# kmod ${MKKMOD} != no 2861.67Slukem# ldap ${MKLDAP} != no 2871.22Slukem# lint ${MKLINT} != no 2881.78Sagc# lvm ${MKLVM} != no 2891.22Slukem# man ${MKMAN} != no 2901.67Slukem# manpages ${MKMANPAGES} != no 2911.22Slukem# manz ${MKMANZ} != no 2921.88Stsarna# mdns ${MKMDNS} != no 2931.23Slukem# nls ${MKNLS} != no 2941.66Sdyoung# nvi ${MKNVI} != no 2951.37She# pam ${MKPAM} != no 2961.39Speter# pf ${MKPF} != no 2971.67Slukem# pic ${MKPIC} != no 2981.22Slukem# postfix ${MKPOSTFIX} != no 2991.22Slukem# profile ${MKPROFILE} != no 3001.24Slukem# share ${MKSHARE} != no 3011.22Slukem# skey ${MKSKEY} != no 3021.73Smrg# x11 ${MKX11} != no && ${X11FLAVOUR} != "Xorg" 3031.73Smrg# xorg ${MKX11} != no && ${X11FLAVOUR} == "Xorg" 3041.22Slukem# yp ${MKYP} != no 3051.89Shaad# zfs ${MKZFS} != no 3061.22Slukem# 3071.87Sskrll# binutils=<n> <n> = value of ${HAVE_BINUTILS} 3081.52Slukem# gcc=<n> <n> = value of ${HAVE_GCC} 3091.52Slukem# gdb=<n> <n> = value of ${HAVE_GDB} 3101.52Slukem# 3111.41Slukem# use_inet6 ${USE_INET6} != no 3121.41Slukem# use_kerberos ${USE_KERBEROS} != no 3131.41Slukem# use_yp ${USE_YP} != no 3141.41Slukem# 3151.22Slukem# .cat if ${MKMANZ} != "no" && ${MKCATPAGES} != "no" 3161.22Slukem# automatically append ".gz" to the filename 3171.22Slukem# 3181.22Slukem# .man if ${MKMANZ} != "no" && ${MKMAN} != "no" 3191.22Slukem# automatically append ".gz" to the filename 3201.1Sdyoung# 3211.8Slukemlist_set_files() 3221.8Slukem{ 3231.83Sapb if [ ${MAKEVERBOSE:-2} -lt 3 ]; then 3241.65She verbose=false 3251.65She else 3261.65She verbose=true 3271.65She fi 3281.1Sdyoung for setname; do 3291.65She list=`list_set_lists $setname` 3301.65She for l in $list; do 3311.65She echo $l 3321.65She if $verbose; then 3331.82Sapb echo >&2 "DEBUG: list_set_files: $l" 3341.65She fi 3351.65She done 3361.62Sad done | xargs cat | ${SED} ${SUBST} | \ 3371.43Sapb ${AWK} -v obsolete=${obsolete} ' 3381.9Slukem BEGIN { 3391.52Slukem if (obsolete) 3401.52Slukem wanted["obsolete"] = 1 3411.52Slukem 3421.52Slukem split("'"${MKVARS}"'", needvars) 3431.52Slukem for (vi in needvars) { 3441.52Slukem nv = needvars[vi] 3451.52Slukem kw = tolower(nv) 3461.52Slukem sub(/^mk/, "", kw) 3471.52Slukem if (ENVIRON[nv] != "no") 3481.52Slukem wanted[kw] = 1 3491.52Slukem } 3501.52Slukem 3511.52Slukem if ("'"${TOOLCHAIN_MISSING}"'" != "yes") { 3521.90Sdyoung if ("binutils" in wanted) 3531.90Sdyoung wanted["binutils=" "'"${HAVE_BINUTILS}"'"] = 1 3541.90Sdyoung if ("gcc" in wanted) 3551.90Sdyoung wanted["gcc=" "'"${HAVE_GCC}"'"] = 1 3561.90Sdyoung if ("gdb" in wanted) 3571.90Sdyoung wanted["gdb=" "'"${HAVE_GDB}"'"] = 1 3581.9Slukem } 3591.52Slukem if (("man" in wanted) && ("catpages" in wanted)) 3601.52Slukem wanted[".cat"] = 1 3611.52Slukem if (("man" in wanted) && ("manpages" in wanted)) 3621.52Slukem wanted[".man"] = 1 3631.9Slukem } 3641.9Slukem 3651.9Slukem /^#/ { 3661.9Slukem next; 3671.9Slukem } 3681.9Slukem 3691.9Slukem NF > 2 && $3 != "-" { 3701.9Slukem split($3, keywords, ",") 3711.9Slukem show = 1 3721.52Slukem haveobs = 0 3731.9Slukem for (ki in keywords) { 3741.9Slukem kw = keywords[ki] 3751.22Slukem if (("manz" in wanted) && 3761.22Slukem (kw == ".cat" || kw == ".man")) 3771.22Slukem $1 = $1 ".gz" 3781.59Sjmmv negated = match(kw, "! *") 3791.59Sjmmv if (negated > 0) { 3801.59Sjmmv kw = substr(kw, RSTART + RLENGTH) 3811.59Sjmmv if (kw in wanted) 3821.59Sjmmv show = 0 3831.59Sjmmv } else { 3841.59Sjmmv if (! (kw in wanted)) 3851.59Sjmmv show = 0 3861.59Sjmmv } 3871.52Slukem if (kw == "obsolete") 3881.52Slukem haveobs = 1 3891.9Slukem } 3901.52Slukem if (obsolete && ! haveobs) 3911.52Slukem next 3921.9Slukem if (show) 3931.9Slukem print 3941.9Slukem next 3951.9Slukem } 3961.9Slukem 3971.9Slukem { 3981.9Slukem if (! obsolete) 3991.9Slukem print 4001.9Slukem }' 4011.9Slukem 4021.1Sdyoung} 4031.1Sdyoung 4041.1Sdyoung# 4051.1Sdyoung# list_set_lists setname 4061.1Sdyoung# 4071.1Sdyoung# Print to stdout a list of files, one filename per line, which 4081.1Sdyoung# concatenate to create the packing list for setname. E.g., 4091.1Sdyoung# 4101.1Sdyoung# .../lists/base/mi 4111.1Sdyoung# .../lists/base/rescue.mi 4121.1Sdyoung# .../lists/base/md.i386 4131.9Slukem# [...] 4141.1Sdyoung# 4151.9Slukem# For a given setname $set, the following files may be selected from 4161.9Slukem# .../list/$set: 4171.9Slukem# mi 4181.11Slukem# ad.${MACHINE_ARCH} 4191.11Slukem# (or) ad.${MACHINE_CPU} 4201.11Slukem# ad.${MACHINE_CPU}.shl 4211.11Slukem# md.${MACHINE}.${MACHINE_ARCH} 4221.11Slukem# (or) md.${MACHINE} 4231.9Slukem# stl.mi 4241.9Slukem# stl.stlib 4251.9Slukem# shl.mi 4261.9Slukem# shl.shlib 4271.77Stsutsui# module.mi if ${module} != no 4281.77Stsutsui# module.${MACHINE} if ${module} != no 4291.77Stsutsui# module.ad.${MACHINE_ARCH} if ${module} != no 4301.77Stsutsui# (or) module.ad.${MACHINE_CPU} if ${module} != no 4311.9Slukem# rescue.shl 4321.11Slukem# rescue.${MACHINE} 4331.11Slukem# rescue.ad.${MACHINE_ARCH} 4341.11Slukem# (or) rescue.ad.${MACHINE_CPU} 4351.11Slukem# rescue.ad.${MACHINE_CPU}.shl 4361.1Sdyoung# 4371.9Slukem# Environment: 4381.1Sdyoung# shlib 4391.1Sdyoung# stlib 4401.1Sdyoung# 4411.8Slukemlist_set_lists() 4421.8Slukem{ 4431.1Sdyoung setname=$1 4441.1Sdyoung 4451.9Slukem setdir=$setsdir/lists/$setname 4461.9Slukem echo $setdir/mi 4471.11Slukem if [ "${MACHINE}" != "${MACHINE_ARCH}" ]; then 4481.11Slukem # Prefer an ad.${MACHINE_ARCH} over an ad.${MACHINE_CPU}, 4491.1Sdyoung # since the arch-specific one will be more specific than 4501.1Sdyoung # the cpu-specific one. 4511.11Slukem if [ -f $setdir/ad.${MACHINE_ARCH} ]; then 4521.11Slukem echo $setdir/ad.${MACHINE_ARCH} 4531.11Slukem elif [ -f $setdir/ad.${MACHINE_CPU} ]; then 4541.11Slukem echo $setdir/ad.${MACHINE_CPU} 4551.1Sdyoung fi 4561.1Sdyoung if [ "$shlib" != "no" -a \ 4571.11Slukem -f $setdir/ad.${MACHINE_CPU}.shl ]; then 4581.11Slukem echo $setdir/ad.${MACHINE_CPU}.shl 4591.1Sdyoung fi 4601.1Sdyoung fi 4611.11Slukem if [ -f $setdir/md.${MACHINE}.${MACHINE_ARCH} ]; then 4621.11Slukem echo $setdir/md.${MACHINE}.${MACHINE_ARCH} 4631.11Slukem elif [ -f $setdir/md.${MACHINE} ]; then 4641.11Slukem echo $setdir/md.${MACHINE} 4651.1Sdyoung fi 4661.9Slukem if [ -f $setdir/stl.mi ]; then 4671.9Slukem echo $setdir/stl.mi 4681.1Sdyoung fi 4691.9Slukem if [ -f $setdir/stl.${stlib} ]; then 4701.9Slukem echo $setdir/stl.${stlib} 4711.1Sdyoung fi 4721.1Sdyoung if [ "$shlib" != "no" ]; then 4731.9Slukem if [ -f $setdir/shl.mi ]; then 4741.9Slukem echo $setdir/shl.mi 4751.7Sdyoung fi 4761.9Slukem if [ -f $setdir/shl.${shlib} ]; then 4771.9Slukem echo $setdir/shl.${shlib} 4781.7Sdyoung fi 4791.1Sdyoung fi 4801.76Stsutsui if [ "$module" != "no" ]; then 4811.76Stsutsui if [ -f $setdir/module.mi ]; then 4821.76Stsutsui echo $setdir/module.mi 4831.1Sdyoung fi 4841.77Stsutsui if [ -f $setdir/module.${MACHINE} ]; then 4851.77Stsutsui echo $setdir/module.${MACHINE} 4861.77Stsutsui fi 4871.77Stsutsui if [ "${MACHINE}" != "${MACHINE_ARCH}" ]; then 4881.77Stsutsui # Prefer a module.ad.${MACHINE_ARCH} over a 4891.77Stsutsui # module.ad.${MACHINE_CPU}, since the arch- 4901.77Stsutsui # specific one will be more specific than the 4911.77Stsutsui # cpu-specific one. 4921.77Stsutsui if [ -f $setdir/module.ad.${MACHINE_ARCH} ]; then 4931.77Stsutsui echo $setdir/module.ad.${MACHINE_ARCH} 4941.77Stsutsui elif [ -f $setdir/module.ad.${MACHINE_CPU} ]; then 4951.77Stsutsui echo $setdir/module.ad.${MACHINE_CPU} 4961.77Stsutsui fi 4971.77Stsutsui fi 4981.1Sdyoung fi 4991.1Sdyoung 5001.9Slukem if [ -f $setdir/rescue.mi ]; then 5011.9Slukem echo $setdir/rescue.mi 5021.1Sdyoung fi 5031.11Slukem if [ -f $setdir/rescue.${MACHINE} ]; then 5041.11Slukem echo $setdir/rescue.${MACHINE} 5051.1Sdyoung fi 5061.11Slukem if [ "${MACHINE}" != "${MACHINE_ARCH}" ]; then 5071.11Slukem # Prefer a rescue.ad.${MACHINE_ARCH} over a 5081.11Slukem # rescue.ad.${MACHINE_CPU}, since the arch- 5091.1Sdyoung # specific one will be more specific than the 5101.1Sdyoung # cpu-specific one. 5111.11Slukem if [ -f $setdir/rescue.ad.${MACHINE_ARCH} ]; then 5121.11Slukem echo $setdir/rescue.ad.${MACHINE_ARCH} 5131.11Slukem elif [ -f $setdir/rescue.ad.${MACHINE_CPU} ]; then 5141.11Slukem echo $setdir/rescue.ad.${MACHINE_CPU} 5151.1Sdyoung fi 5161.10Sjmc if [ "$shlib" != "no" -a \ 5171.11Slukem -f $setdir/rescue.ad.${MACHINE_CPU}.shl ]; then 5181.11Slukem echo $setdir/rescue.ad.${MACHINE_CPU}.shl 5191.10Sjmc fi 5201.1Sdyoung fi 5211.5Sdyoung} 5221.5Sdyoung 5231.9Slukem# arch_to_cpu mach 5241.9Slukem# 5251.11Slukem# Print the ${MACHINE_CPU} for ${MACHINE_ARCH}=mach, 5261.9Slukem# as determined by <bsd.own.mk>. 5271.9Slukem# 5281.8Slukemarch_to_cpu() 5291.8Slukem{ 5301.56Sapb MACHINE_ARCH=${1} ${MAKE} -B -f- all <<EOMAKE 5311.5Sdyoung.include <bsd.own.mk> 5321.5Sdyoungall: 5331.5Sdyoung @echo \${MACHINE_CPU} 5341.12SlukemEOMAKE 5351.1Sdyoung} 5361.46Sapb 5371.46Sapb# arch_to_endian mach 5381.46Sapb# 5391.46Sapb# Print the ${TARGET_ENDIANNESS} for ${MACHINE_ARCH}=mach, 5401.46Sapb# as determined by <bsd.endian.mk>. 5411.46Sapb# 5421.46Sapbarch_to_endian() 5431.46Sapb{ 5441.56Sapb MACHINE_ARCH=${1} ${MAKE} -B -f- all <<EOMAKE 5451.46Sapb.include <bsd.endian.mk> 5461.46Sapball: 5471.46Sapb @echo \${TARGET_ENDIANNESS} 5481.46SapbEOMAKE 5491.46Sapb} 550