sets.subr revision 1.96
11.94Suebayasi# $NetBSD: sets.subr,v 1.96 2009/12/02 14:32:15 uebayasi 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.92Suebayasi# extlists list of extsrc sets 101.9Slukem# obsolete controls if obsolete files are selected instead 111.76Stsutsui# module if != "no", enable MODULE sets 121.9Slukem# shlib shared library format (a.out, elf, or "") 131.9Slukem# stlib static library format (a.out, elf) 141.11Slukem# 151.11Slukem# The following <bsd.own.mk> variables are exported to the environment: 161.11Slukem# MACHINE 171.11Slukem# MACHINE_ARCH 181.11Slukem# MACHINE_CPU 191.87Sskrll# HAVE_BINUTILS 201.48Smrg# HAVE_GCC 211.52Slukem# HAVE_GDB 221.11Slukem# TOOLCHAIN_MISSING 231.11Slukem# OBJECT_FMT 241.22Slukem# as well as: 251.22Slukem# 261.95Suebayasi 271.95Suebayasi# XXX don't hardcode 281.95SuebayasiMKEXTRAVARS="\ 291.41Slukem USE_INET6 \ 301.41Slukem USE_KERBEROS \ 311.63Slukem USE_LDAP \ 321.41Slukem USE_YP \ 331.64She NETBSDSRCDIR \ 341.65She MAKEVERBOSE \ 351.22Slukem" 361.42Sapb# 371.42Sapb# The following variables refer to tools that are used when building sets: 381.42Sapb# 391.43Sapb: ${AWK:=awk} 401.42Sapb: ${CKSUM:=cksum} 411.43Sapb: ${COMM:=comm} 421.44Sapb: ${DATE:=date} 431.43Sapb: ${DB:=db} 441.43Sapb: ${EGREP:=egrep} 451.43Sapb: ${ENV_CMD:=env} # ${ENV} is special to sh(1), ksh(1), etc. 461.44Sapb: ${FGREP:=fgrep} 471.43Sapb: ${FIND:=find} 481.44Sapb: ${GREP:=grep} 491.43Sapb: ${GZIP_CMD:=gzip} # ${GZIP} is special to gzip(1) 501.44Sapb: ${HOSTNAME:=hostname} 511.42Sapb: ${HOST_SH:=sh} 521.43Sapb: ${IDENT:=ident} 531.43Sapb: ${JOIN:=join} 541.43Sapb: ${LS:=ls} 551.43Sapb: ${MAKE:=make} 561.42Sapb: ${MKTEMP:=mktemp} 571.43Sapb: ${MTREE:=mtree} 581.43Sapb: ${PASTE:=paste} 591.42Sapb: ${PAX:=pax} 601.43Sapb: ${PRINTF:=printf} 611.43Sapb: ${SED:=sed} 621.43Sapb: ${SORT:=sort} 631.44Sapb: ${STAT:=stat} 641.44Sapb: ${TSORT:=tsort} 651.43Sapb: ${UNAME:=uname} 661.43Sapb: ${WC:=wc} 671.43Sapb 681.45Sapb# 691.45Sapb# If printf is a shell builtin command, then we can 701.45Sapb# implement cheaper versions of basename and dirname 711.45Sapb# that do not involve any fork/exec overhead. 721.45Sapb# If printf is not builtin, approximate it using echo, 731.45Sapb# and hope there are no weird file names that cause 741.45Sapb# some versions of echo to do the wrong thing. 751.45Sapb# (Converting to this version of dirname speeded up the 761.45Sapb# syspkgdeps script by an order of magnitude, from 68 771.45Sapb# seconds to 6.3 seconds on one particular host.) 781.45Sapb# 791.45Sapb# Note that naive approximations for dirname 801.45Sapb# using ${foo%/*} do not do the right thing in cases 811.45Sapb# where the result should be "/" or ".". 821.45Sapb# 831.45Sapbcase "$(type printf)" in 841.45Sapb*builtin*) 851.45Sapb basename () 861.45Sapb { 871.45Sapb local bn 881.45Sapb bn="${1##*/}" 891.45Sapb bn="${bn%$2}" 901.45Sapb printf "%s\n" "$bn" 911.45Sapb } 921.45Sapb dirname () 931.45Sapb { 941.45Sapb local dn 951.45Sapb case "$1" in 961.45Sapb ?*/*) dn="${1%/*}" ;; 971.45Sapb /*) dn=/ ;; 981.45Sapb *) dn=. ;; 991.45Sapb esac 1001.45Sapb printf "%s\n" "$dn" 1011.45Sapb } 1021.45Sapb ;; 1031.45Sapb*) 1041.45Sapb basename () 1051.45Sapb { 1061.45Sapb local bn 1071.45Sapb bn="${1##*/}" 1081.45Sapb bn="${bn%$2}" 1091.45Sapb echo "$bn" 1101.45Sapb } 1111.45Sapb dirname () 1121.45Sapb { 1131.45Sapb local dn 1141.45Sapb case "$1" in 1151.45Sapb ?*/*) dn="${1%/*}" ;; 1161.45Sapb /*) dn=/ ;; 1171.45Sapb *) dn=. ;; 1181.45Sapb esac 1191.45Sapb echo "$dn" 1201.45Sapb } 1211.45Sapb ;; 1221.45Sapbesac 1231.45Sapb 1241.9SlukemoIFS=$IFS 1251.9SlukemIFS=" 1261.9Slukem" 1271.9Slukemfor x in $( 1281.43Sapb${MAKE} -B -f- all <<EOMAKE 1291.9Slukem.include <bsd.own.mk> 1301.33Sjmc.if (\${MKMAN} == "no" || empty(MANINSTALL:Mmaninstall)) 1311.33SjmcMKMANPAGES=no 1321.33Sjmc.else 1331.33SjmcMKMANPAGES=yes 1341.33Sjmc.endif 1351.72Smrg.if \${MKX11} != "no" 1361.72Smrg. if \${X11FLAVOUR} == "Xorg" 1371.72SmrgMKXORG:=yes 1381.72SmrgMKX11:=no 1391.72Smrg. else 1401.72SmrgMKXORG:=no 1411.72Smrg. endif 1421.72Smrg.endif 1431.9Slukemall: 1441.11Slukem.for i in MACHINE MACHINE_ARCH MACHINE_CPU \ 1451.87Sskrll HAVE_BINUTILS HAVE_GCC HAVE_GDB OBJECT_FMT TOOLCHAIN_MISSING \ 1461.95Suebayasi ${MKEXTRAVARS} \${_MKVARS.yes} \${_MKVARS.no} 1471.96Suebayasi @echo "export \$i=\"\${\$i}\"" 1481.11Slukem.endfor 1491.9Slukem 1501.12SlukemEOMAKE 1511.9Slukem); do 1521.96Suebayasi# echo 1>&2 "DEBUG: read $x" 1531.9Slukem eval $x 1541.9Slukemdone 1551.9SlukemIFS=$oIFS 1561.9Slukem 1571.34Serhsetsdir=${0%/*} 1581.9Slukemobsolete=0 1591.76Stsutsuimodule=yes 1601.91Sdyoungif [ "${MKKMOD}" = "no" ]; then 1611.91Sdyoung module=no # MODULEs are off. 1621.91Sdyoungelif [ "${MACHINE}" = "evbppc" ]; then 1631.76Stsutsui module=no # Turn off MODULEs for some ports. 1641.9Slukemfi 1651.31Sjmc# Determine lib type. Do this first so stlib also gets set. 1661.31Sjmcif [ "${OBJECT_FMT}" = "ELF" ]; then 1671.9Slukem shlib=elf 1681.9Slukemelse 1691.9Slukem shlib=aout 1701.9Slukemfi 1711.9Slukemstlib=$shlib 1721.31Sjmc# Now check for MKPIC or specials and turn off shlib if need be. 1731.31Sjmcif [ "${MKPIC}" = "no" ]; then 1741.31Sjmc shlib=no 1751.31Sjmcfi 1761.29Suweif [ "${MACHINE_ARCH}" = "m68000" ]; then 1771.9Slukem shlib=no # Turn off shlibs for some ports. 1781.9Slukemfi 1791.86Sjnemethif [ "$module" != "no" ]; then 1801.86Sjnemeth nlists="base comp etc games man misc modules tests text" 1811.86Sjnemethelse 1821.86Sjnemeth nlists="base comp etc games man misc tests text" 1831.86Sjnemethfi 1841.86Sjnemethxlists="xbase xcomp xetc xfont xserver" 1851.92Suebayasiextlists="extbase extcomp extetc" 1861.9Slukem 1871.64SheOSRELEASE=`${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh` 1881.81SrmindMODULEDIR="stand/${MACHINE}/${OSRELEASE}/modules" 1891.62SadSUBST="s#@MODULEDIR@#${MODULEDIR}#g" 1901.62SadSUBST="${SUBST};s#@OSRELEASE@#${OSRELEASE}#g" 1911.62SadSUBST="${SUBST};s#@MACHINE@#${MACHINE}#g" 1921.60Sad 1931.9Slukem# 1941.9Slukem# list_set_files setfile [...] 1951.1Sdyoung# 1961.9Slukem# Produce a packing list for setfile(s). 1971.9Slukem# In each file, a record consists of a path and a System Package name, 1981.9Slukem# separated by whitespace. E.g., 1991.9Slukem# 2001.94Suebayasi# # $NetBSD: sets.subr,v 1.96 2009/12/02 14:32:15 uebayasi Exp $ 2011.9Slukem# . base-sys-root [keyword[,...]] 2021.9Slukem# ./altroot base-sys-root 2031.9Slukem# ./bin base-sys-root 2041.9Slukem# ./bin/[ base-util-root 2051.9Slukem# ./bin/cat base-util-root 2061.9Slukem# [...] 2071.9Slukem# 2081.9Slukem# A # in the first column marks a comment. 2091.9Slukem# 2101.9Slukem# If ${obsolete} != 0, only entries with an "obsolete" keyword will 2111.52Slukem# be printed. All other keywords must be present. 2121.9Slukem# 2131.9Slukem# The third field is an optional comma separated list of keywords to 2141.9Slukem# control if a record is printed; every keyword listed must be enabled 2151.9Slukem# for the record to be printed. The following keywords are available: 2161.9Slukem# dummy dummy entry (ignored) 2171.13Slukem# obsolete file is obsolete, and only printed if 2181.13Slukem# ${obsolete} != 0 2191.13Slukem# 2201.87Sskrll# bfd obsolete, use binutils. 2211.87Sskrll# binutils ${MKBINUTILS} != no 2221.22Slukem# catpages ${MKCATPAGES} != no 2231.71Smrg# compat ${MKCOMPAT} != no 2241.22Slukem# crypto ${MKCRYPTO} != no 2251.22Slukem# crypto_idea ${MKCRYPTO_IDEA} != no 2261.22Slukem# crypto_mdc2 ${MKCRYPTO_MDC2} != no 2271.22Slukem# crypto_rc5 ${MKCRYPTO_RC5} != no 2281.22Slukem# cvs ${MKCVS} != no 2291.53Slukem# debug ${MKDEBUG} != no 2301.69Slukem# debuglib ${MKDEBUGLIB} != no 2311.23Slukem# doc ${MKDOC} != no 2321.67Slukem# dynamicroot ${MKDYNAMICROOT} != no 2331.92Suebayasi# extsrc ${MKEXTSRC} != no 2341.52Slukem# gcc ${MKGCC} != no 2351.36Smatt# gcccmds ${MKGCCCMDS} != no 2361.32Sscw# gdb ${MKGDB} != no 2371.22Slukem# hesiod ${MKHESIOD} != no 2381.68Slukem# html ${MKHTML} != no 2391.67Slukem# inet6 ${MKINET6} != no 2401.23Slukem# info ${MKINFO} != no 2411.39Speter# ipfilter ${MKIPFILTER} != no 2421.51Smrg# iscsi ${MKISCSI} != no 2431.22Slukem# kerberos ${MKKERBEROS} != no 2441.85Sdyoung# kmod ${MKKMOD} != no 2451.67Slukem# ldap ${MKLDAP} != no 2461.22Slukem# lint ${MKLINT} != no 2471.78Sagc# lvm ${MKLVM} != no 2481.22Slukem# man ${MKMAN} != no 2491.67Slukem# manpages ${MKMANPAGES} != no 2501.22Slukem# manz ${MKMANZ} != no 2511.88Stsarna# mdns ${MKMDNS} != no 2521.23Slukem# nls ${MKNLS} != no 2531.66Sdyoung# nvi ${MKNVI} != no 2541.37She# pam ${MKPAM} != no 2551.39Speter# pf ${MKPF} != no 2561.67Slukem# pic ${MKPIC} != no 2571.22Slukem# postfix ${MKPOSTFIX} != no 2581.22Slukem# profile ${MKPROFILE} != no 2591.24Slukem# share ${MKSHARE} != no 2601.22Slukem# skey ${MKSKEY} != no 2611.73Smrg# x11 ${MKX11} != no && ${X11FLAVOUR} != "Xorg" 2621.73Smrg# xorg ${MKX11} != no && ${X11FLAVOUR} == "Xorg" 2631.22Slukem# yp ${MKYP} != no 2641.89Shaad# zfs ${MKZFS} != no 2651.22Slukem# 2661.87Sskrll# binutils=<n> <n> = value of ${HAVE_BINUTILS} 2671.52Slukem# gcc=<n> <n> = value of ${HAVE_GCC} 2681.52Slukem# gdb=<n> <n> = value of ${HAVE_GDB} 2691.52Slukem# 2701.41Slukem# use_inet6 ${USE_INET6} != no 2711.41Slukem# use_kerberos ${USE_KERBEROS} != no 2721.41Slukem# use_yp ${USE_YP} != no 2731.41Slukem# 2741.22Slukem# .cat if ${MKMANZ} != "no" && ${MKCATPAGES} != "no" 2751.22Slukem# automatically append ".gz" to the filename 2761.22Slukem# 2771.22Slukem# .man if ${MKMANZ} != "no" && ${MKMAN} != "no" 2781.22Slukem# automatically append ".gz" to the filename 2791.1Sdyoung# 2801.8Slukemlist_set_files() 2811.8Slukem{ 2821.83Sapb if [ ${MAKEVERBOSE:-2} -lt 3 ]; then 2831.65She verbose=false 2841.65She else 2851.65She verbose=true 2861.65She fi 2871.1Sdyoung for setname; do 2881.65She list=`list_set_lists $setname` 2891.65She for l in $list; do 2901.65She echo $l 2911.65She if $verbose; then 2921.82Sapb echo >&2 "DEBUG: list_set_files: $l" 2931.65She fi 2941.65She done 2951.62Sad done | xargs cat | ${SED} ${SUBST} | \ 2961.43Sapb ${AWK} -v obsolete=${obsolete} ' 2971.9Slukem BEGIN { 2981.52Slukem if (obsolete) 2991.52Slukem wanted["obsolete"] = 1 3001.52Slukem 3011.52Slukem split("'"${MKVARS}"'", needvars) 3021.52Slukem for (vi in needvars) { 3031.52Slukem nv = needvars[vi] 3041.52Slukem kw = tolower(nv) 3051.52Slukem sub(/^mk/, "", kw) 3061.52Slukem if (ENVIRON[nv] != "no") 3071.52Slukem wanted[kw] = 1 3081.52Slukem } 3091.52Slukem 3101.52Slukem if ("'"${TOOLCHAIN_MISSING}"'" != "yes") { 3111.90Sdyoung if ("binutils" in wanted) 3121.90Sdyoung wanted["binutils=" "'"${HAVE_BINUTILS}"'"] = 1 3131.90Sdyoung if ("gcc" in wanted) 3141.90Sdyoung wanted["gcc=" "'"${HAVE_GCC}"'"] = 1 3151.90Sdyoung if ("gdb" in wanted) 3161.90Sdyoung wanted["gdb=" "'"${HAVE_GDB}"'"] = 1 3171.9Slukem } 3181.52Slukem if (("man" in wanted) && ("catpages" in wanted)) 3191.52Slukem wanted[".cat"] = 1 3201.52Slukem if (("man" in wanted) && ("manpages" in wanted)) 3211.52Slukem wanted[".man"] = 1 3221.9Slukem } 3231.9Slukem 3241.9Slukem /^#/ { 3251.9Slukem next; 3261.9Slukem } 3271.9Slukem 3281.9Slukem NF > 2 && $3 != "-" { 3291.9Slukem split($3, keywords, ",") 3301.9Slukem show = 1 3311.52Slukem haveobs = 0 3321.9Slukem for (ki in keywords) { 3331.9Slukem kw = keywords[ki] 3341.22Slukem if (("manz" in wanted) && 3351.22Slukem (kw == ".cat" || kw == ".man")) 3361.22Slukem $1 = $1 ".gz" 3371.59Sjmmv negated = match(kw, "! *") 3381.59Sjmmv if (negated > 0) { 3391.59Sjmmv kw = substr(kw, RSTART + RLENGTH) 3401.59Sjmmv if (kw in wanted) 3411.59Sjmmv show = 0 3421.59Sjmmv } else { 3431.59Sjmmv if (! (kw in wanted)) 3441.59Sjmmv show = 0 3451.59Sjmmv } 3461.52Slukem if (kw == "obsolete") 3471.52Slukem haveobs = 1 3481.9Slukem } 3491.52Slukem if (obsolete && ! haveobs) 3501.52Slukem next 3511.9Slukem if (show) 3521.9Slukem print 3531.9Slukem next 3541.9Slukem } 3551.9Slukem 3561.9Slukem { 3571.9Slukem if (! obsolete) 3581.9Slukem print 3591.9Slukem }' 3601.9Slukem 3611.1Sdyoung} 3621.1Sdyoung 3631.1Sdyoung# 3641.1Sdyoung# list_set_lists setname 3651.1Sdyoung# 3661.1Sdyoung# Print to stdout a list of files, one filename per line, which 3671.1Sdyoung# concatenate to create the packing list for setname. E.g., 3681.1Sdyoung# 3691.1Sdyoung# .../lists/base/mi 3701.1Sdyoung# .../lists/base/rescue.mi 3711.1Sdyoung# .../lists/base/md.i386 3721.9Slukem# [...] 3731.1Sdyoung# 3741.9Slukem# For a given setname $set, the following files may be selected from 3751.9Slukem# .../list/$set: 3761.9Slukem# mi 3771.92Suebayasi# mi.ext.* 3781.11Slukem# ad.${MACHINE_ARCH} 3791.11Slukem# (or) ad.${MACHINE_CPU} 3801.11Slukem# ad.${MACHINE_CPU}.shl 3811.11Slukem# md.${MACHINE}.${MACHINE_ARCH} 3821.11Slukem# (or) md.${MACHINE} 3831.9Slukem# stl.mi 3841.92Suebayasi# stl.${stlib} 3851.9Slukem# shl.mi 3861.92Suebayasi# shl.mi.ext.* 3871.92Suebayasi# shl.${shlib} 3881.92Suebayasi# shl.${shlib}.ext.* 3891.77Stsutsui# module.mi if ${module} != no 3901.77Stsutsui# module.${MACHINE} if ${module} != no 3911.77Stsutsui# module.ad.${MACHINE_ARCH} if ${module} != no 3921.77Stsutsui# (or) module.ad.${MACHINE_CPU} if ${module} != no 3931.9Slukem# rescue.shl 3941.11Slukem# rescue.${MACHINE} 3951.11Slukem# rescue.ad.${MACHINE_ARCH} 3961.11Slukem# (or) rescue.ad.${MACHINE_CPU} 3971.11Slukem# rescue.ad.${MACHINE_CPU}.shl 3981.1Sdyoung# 3991.9Slukem# Environment: 4001.1Sdyoung# shlib 4011.1Sdyoung# stlib 4021.1Sdyoung# 4031.8Slukemlist_set_lists() 4041.8Slukem{ 4051.1Sdyoung setname=$1 4061.1Sdyoung 4071.9Slukem setdir=$setsdir/lists/$setname 4081.9Slukem echo $setdir/mi 4091.92Suebayasi for _extsrc_pkg in ${EXTSRCS}; do 4101.92Suebayasi if [ -f $setdir/mi.ext.${_extsrc_pkg} ]; then 4111.92Suebayasi echo $setdir/mi.ext.${_extsrc_pkg} 4121.92Suebayasi fi 4131.92Suebayasi done 4141.11Slukem if [ "${MACHINE}" != "${MACHINE_ARCH}" ]; then 4151.11Slukem # Prefer an ad.${MACHINE_ARCH} over an ad.${MACHINE_CPU}, 4161.1Sdyoung # since the arch-specific one will be more specific than 4171.1Sdyoung # the cpu-specific one. 4181.11Slukem if [ -f $setdir/ad.${MACHINE_ARCH} ]; then 4191.11Slukem echo $setdir/ad.${MACHINE_ARCH} 4201.11Slukem elif [ -f $setdir/ad.${MACHINE_CPU} ]; then 4211.11Slukem echo $setdir/ad.${MACHINE_CPU} 4221.1Sdyoung fi 4231.1Sdyoung if [ "$shlib" != "no" -a \ 4241.11Slukem -f $setdir/ad.${MACHINE_CPU}.shl ]; then 4251.11Slukem echo $setdir/ad.${MACHINE_CPU}.shl 4261.1Sdyoung fi 4271.1Sdyoung fi 4281.11Slukem if [ -f $setdir/md.${MACHINE}.${MACHINE_ARCH} ]; then 4291.11Slukem echo $setdir/md.${MACHINE}.${MACHINE_ARCH} 4301.11Slukem elif [ -f $setdir/md.${MACHINE} ]; then 4311.11Slukem echo $setdir/md.${MACHINE} 4321.1Sdyoung fi 4331.9Slukem if [ -f $setdir/stl.mi ]; then 4341.9Slukem echo $setdir/stl.mi 4351.1Sdyoung fi 4361.9Slukem if [ -f $setdir/stl.${stlib} ]; then 4371.9Slukem echo $setdir/stl.${stlib} 4381.1Sdyoung fi 4391.1Sdyoung if [ "$shlib" != "no" ]; then 4401.9Slukem if [ -f $setdir/shl.mi ]; then 4411.9Slukem echo $setdir/shl.mi 4421.7Sdyoung fi 4431.92Suebayasi for _extsrc_pkg in ${EXTSRCS}; do 4441.92Suebayasi if [ -f $setdir/shl.mi.ext.${_extsrc_pkg} ]; then 4451.92Suebayasi echo $setdir/shl.mi.ext.${_extsrc_pkg} 4461.92Suebayasi fi 4471.92Suebayasi done 4481.9Slukem if [ -f $setdir/shl.${shlib} ]; then 4491.9Slukem echo $setdir/shl.${shlib} 4501.7Sdyoung fi 4511.92Suebayasi for _extsrc_pkg in ${EXTSRCS}; do 4521.92Suebayasi if [ -f $setdir/shl.${shlib}.ext.${_extsrc_pkg} ]; then 4531.92Suebayasi echo $setdir/shl.${shlib}.ext.${_extsrc_pkg} 4541.92Suebayasi fi 4551.92Suebayasi done 4561.1Sdyoung fi 4571.76Stsutsui if [ "$module" != "no" ]; then 4581.76Stsutsui if [ -f $setdir/module.mi ]; then 4591.76Stsutsui echo $setdir/module.mi 4601.1Sdyoung fi 4611.77Stsutsui if [ -f $setdir/module.${MACHINE} ]; then 4621.77Stsutsui echo $setdir/module.${MACHINE} 4631.77Stsutsui fi 4641.77Stsutsui if [ "${MACHINE}" != "${MACHINE_ARCH}" ]; then 4651.77Stsutsui # Prefer a module.ad.${MACHINE_ARCH} over a 4661.77Stsutsui # module.ad.${MACHINE_CPU}, since the arch- 4671.77Stsutsui # specific one will be more specific than the 4681.77Stsutsui # cpu-specific one. 4691.77Stsutsui if [ -f $setdir/module.ad.${MACHINE_ARCH} ]; then 4701.77Stsutsui echo $setdir/module.ad.${MACHINE_ARCH} 4711.77Stsutsui elif [ -f $setdir/module.ad.${MACHINE_CPU} ]; then 4721.77Stsutsui echo $setdir/module.ad.${MACHINE_CPU} 4731.77Stsutsui fi 4741.77Stsutsui fi 4751.1Sdyoung fi 4761.1Sdyoung 4771.9Slukem if [ -f $setdir/rescue.mi ]; then 4781.9Slukem echo $setdir/rescue.mi 4791.1Sdyoung fi 4801.11Slukem if [ -f $setdir/rescue.${MACHINE} ]; then 4811.11Slukem echo $setdir/rescue.${MACHINE} 4821.1Sdyoung fi 4831.11Slukem if [ "${MACHINE}" != "${MACHINE_ARCH}" ]; then 4841.11Slukem # Prefer a rescue.ad.${MACHINE_ARCH} over a 4851.11Slukem # rescue.ad.${MACHINE_CPU}, since the arch- 4861.1Sdyoung # specific one will be more specific than the 4871.1Sdyoung # cpu-specific one. 4881.11Slukem if [ -f $setdir/rescue.ad.${MACHINE_ARCH} ]; then 4891.11Slukem echo $setdir/rescue.ad.${MACHINE_ARCH} 4901.11Slukem elif [ -f $setdir/rescue.ad.${MACHINE_CPU} ]; then 4911.11Slukem echo $setdir/rescue.ad.${MACHINE_CPU} 4921.1Sdyoung fi 4931.10Sjmc if [ "$shlib" != "no" -a \ 4941.11Slukem -f $setdir/rescue.ad.${MACHINE_CPU}.shl ]; then 4951.11Slukem echo $setdir/rescue.ad.${MACHINE_CPU}.shl 4961.10Sjmc fi 4971.1Sdyoung fi 4981.5Sdyoung} 4991.5Sdyoung 5001.9Slukem# arch_to_cpu mach 5011.9Slukem# 5021.11Slukem# Print the ${MACHINE_CPU} for ${MACHINE_ARCH}=mach, 5031.9Slukem# as determined by <bsd.own.mk>. 5041.9Slukem# 5051.8Slukemarch_to_cpu() 5061.8Slukem{ 5071.56Sapb MACHINE_ARCH=${1} ${MAKE} -B -f- all <<EOMAKE 5081.5Sdyoung.include <bsd.own.mk> 5091.5Sdyoungall: 5101.5Sdyoung @echo \${MACHINE_CPU} 5111.12SlukemEOMAKE 5121.1Sdyoung} 5131.46Sapb 5141.46Sapb# arch_to_endian mach 5151.46Sapb# 5161.46Sapb# Print the ${TARGET_ENDIANNESS} for ${MACHINE_ARCH}=mach, 5171.46Sapb# as determined by <bsd.endian.mk>. 5181.46Sapb# 5191.46Sapbarch_to_endian() 5201.46Sapb{ 5211.56Sapb MACHINE_ARCH=${1} ${MAKE} -B -f- all <<EOMAKE 5221.46Sapb.include <bsd.endian.mk> 5231.46Sapball: 5241.46Sapb @echo \${TARGET_ENDIANNESS} 5251.46SapbEOMAKE 5261.46Sapb} 527