sets.subr revision 1.98
11.94Suebayasi# $NetBSD: sets.subr,v 1.98 2009/12/02 15:18:06 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.98Suebayasi EXTSRCS \ 301.41Slukem USE_INET6 \ 311.41Slukem USE_KERBEROS \ 321.63Slukem USE_LDAP \ 331.41Slukem USE_YP \ 341.64She NETBSDSRCDIR \ 351.65She MAKEVERBOSE \ 361.22Slukem" 371.42Sapb# 381.42Sapb# The following variables refer to tools that are used when building sets: 391.42Sapb# 401.43Sapb: ${AWK:=awk} 411.42Sapb: ${CKSUM:=cksum} 421.43Sapb: ${COMM:=comm} 431.44Sapb: ${DATE:=date} 441.43Sapb: ${DB:=db} 451.43Sapb: ${EGREP:=egrep} 461.43Sapb: ${ENV_CMD:=env} # ${ENV} is special to sh(1), ksh(1), etc. 471.44Sapb: ${FGREP:=fgrep} 481.43Sapb: ${FIND:=find} 491.44Sapb: ${GREP:=grep} 501.43Sapb: ${GZIP_CMD:=gzip} # ${GZIP} is special to gzip(1) 511.44Sapb: ${HOSTNAME:=hostname} 521.42Sapb: ${HOST_SH:=sh} 531.43Sapb: ${IDENT:=ident} 541.43Sapb: ${JOIN:=join} 551.43Sapb: ${LS:=ls} 561.43Sapb: ${MAKE:=make} 571.42Sapb: ${MKTEMP:=mktemp} 581.43Sapb: ${MTREE:=mtree} 591.43Sapb: ${PASTE:=paste} 601.42Sapb: ${PAX:=pax} 611.43Sapb: ${PRINTF:=printf} 621.43Sapb: ${SED:=sed} 631.43Sapb: ${SORT:=sort} 641.44Sapb: ${STAT:=stat} 651.44Sapb: ${TSORT:=tsort} 661.43Sapb: ${UNAME:=uname} 671.43Sapb: ${WC:=wc} 681.43Sapb 691.45Sapb# 701.45Sapb# If printf is a shell builtin command, then we can 711.45Sapb# implement cheaper versions of basename and dirname 721.45Sapb# that do not involve any fork/exec overhead. 731.45Sapb# If printf is not builtin, approximate it using echo, 741.45Sapb# and hope there are no weird file names that cause 751.45Sapb# some versions of echo to do the wrong thing. 761.45Sapb# (Converting to this version of dirname speeded up the 771.45Sapb# syspkgdeps script by an order of magnitude, from 68 781.45Sapb# seconds to 6.3 seconds on one particular host.) 791.45Sapb# 801.45Sapb# Note that naive approximations for dirname 811.45Sapb# using ${foo%/*} do not do the right thing in cases 821.45Sapb# where the result should be "/" or ".". 831.45Sapb# 841.45Sapbcase "$(type printf)" in 851.45Sapb*builtin*) 861.45Sapb basename () 871.45Sapb { 881.45Sapb local bn 891.45Sapb bn="${1##*/}" 901.45Sapb bn="${bn%$2}" 911.45Sapb printf "%s\n" "$bn" 921.45Sapb } 931.45Sapb dirname () 941.45Sapb { 951.45Sapb local dn 961.45Sapb case "$1" in 971.45Sapb ?*/*) dn="${1%/*}" ;; 981.45Sapb /*) dn=/ ;; 991.45Sapb *) dn=. ;; 1001.45Sapb esac 1011.45Sapb printf "%s\n" "$dn" 1021.45Sapb } 1031.45Sapb ;; 1041.45Sapb*) 1051.45Sapb basename () 1061.45Sapb { 1071.45Sapb local bn 1081.45Sapb bn="${1##*/}" 1091.45Sapb bn="${bn%$2}" 1101.45Sapb echo "$bn" 1111.45Sapb } 1121.45Sapb dirname () 1131.45Sapb { 1141.45Sapb local dn 1151.45Sapb case "$1" in 1161.45Sapb ?*/*) dn="${1%/*}" ;; 1171.45Sapb /*) dn=/ ;; 1181.45Sapb *) dn=. ;; 1191.45Sapb esac 1201.45Sapb echo "$dn" 1211.45Sapb } 1221.45Sapb ;; 1231.45Sapbesac 1241.45Sapb 1251.9SlukemoIFS=$IFS 1261.9SlukemIFS=" 1271.9Slukem" 1281.97Suebayasifor i in _MKVARS.yes _MKVARS.no; do 1291.97Suebayasi eval $( 1301.97Suebayasi${MAKE} -B -f- all <<EOMAKE 1311.97Suebayasi.include <bsd.own.mk> 1321.97Suebayasiall: 1331.97Suebayasi @echo "export _MKVARS_${i#*.}=\"\${$i}\"" 1341.97SuebayasiEOMAKE 1351.97Suebayasi) 1361.97Suebayasidone 1371.9Slukemfor x in $( 1381.43Sapb${MAKE} -B -f- all <<EOMAKE 1391.9Slukem.include <bsd.own.mk> 1401.33Sjmc.if (\${MKMAN} == "no" || empty(MANINSTALL:Mmaninstall)) 1411.33SjmcMKMANPAGES=no 1421.33Sjmc.else 1431.33SjmcMKMANPAGES=yes 1441.33Sjmc.endif 1451.72Smrg.if \${MKX11} != "no" 1461.72Smrg. if \${X11FLAVOUR} == "Xorg" 1471.72SmrgMKXORG:=yes 1481.72SmrgMKX11:=no 1491.72Smrg. else 1501.72SmrgMKXORG:=no 1511.72Smrg. endif 1521.72Smrg.endif 1531.9Slukemall: 1541.11Slukem.for i in MACHINE MACHINE_ARCH MACHINE_CPU \ 1551.87Sskrll HAVE_BINUTILS HAVE_GCC HAVE_GDB OBJECT_FMT TOOLCHAIN_MISSING \ 1561.95Suebayasi ${MKEXTRAVARS} \${_MKVARS.yes} \${_MKVARS.no} 1571.96Suebayasi @echo "export \$i=\"\${\$i}\"" 1581.11Slukem.endfor 1591.9Slukem 1601.12SlukemEOMAKE 1611.9Slukem); do 1621.96Suebayasi# echo 1>&2 "DEBUG: read $x" 1631.9Slukem eval $x 1641.9Slukemdone 1651.9SlukemIFS=$oIFS 1661.9Slukem 1671.34Serhsetsdir=${0%/*} 1681.9Slukemobsolete=0 1691.76Stsutsuimodule=yes 1701.91Sdyoungif [ "${MKKMOD}" = "no" ]; then 1711.91Sdyoung module=no # MODULEs are off. 1721.91Sdyoungelif [ "${MACHINE}" = "evbppc" ]; then 1731.76Stsutsui module=no # Turn off MODULEs for some ports. 1741.9Slukemfi 1751.31Sjmc# Determine lib type. Do this first so stlib also gets set. 1761.31Sjmcif [ "${OBJECT_FMT}" = "ELF" ]; then 1771.9Slukem shlib=elf 1781.9Slukemelse 1791.9Slukem shlib=aout 1801.9Slukemfi 1811.9Slukemstlib=$shlib 1821.31Sjmc# Now check for MKPIC or specials and turn off shlib if need be. 1831.31Sjmcif [ "${MKPIC}" = "no" ]; then 1841.31Sjmc shlib=no 1851.31Sjmcfi 1861.29Suweif [ "${MACHINE_ARCH}" = "m68000" ]; then 1871.9Slukem shlib=no # Turn off shlibs for some ports. 1881.9Slukemfi 1891.86Sjnemethif [ "$module" != "no" ]; then 1901.86Sjnemeth nlists="base comp etc games man misc modules tests text" 1911.86Sjnemethelse 1921.86Sjnemeth nlists="base comp etc games man misc tests text" 1931.86Sjnemethfi 1941.86Sjnemethxlists="xbase xcomp xetc xfont xserver" 1951.92Suebayasiextlists="extbase extcomp extetc" 1961.9Slukem 1971.64SheOSRELEASE=`${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh` 1981.81SrmindMODULEDIR="stand/${MACHINE}/${OSRELEASE}/modules" 1991.62SadSUBST="s#@MODULEDIR@#${MODULEDIR}#g" 2001.62SadSUBST="${SUBST};s#@OSRELEASE@#${OSRELEASE}#g" 2011.62SadSUBST="${SUBST};s#@MACHINE@#${MACHINE}#g" 2021.60Sad 2031.9Slukem# 2041.9Slukem# list_set_files setfile [...] 2051.1Sdyoung# 2061.9Slukem# Produce a packing list for setfile(s). 2071.9Slukem# In each file, a record consists of a path and a System Package name, 2081.9Slukem# separated by whitespace. E.g., 2091.9Slukem# 2101.94Suebayasi# # $NetBSD: sets.subr,v 1.98 2009/12/02 15:18:06 uebayasi Exp $ 2111.9Slukem# . base-sys-root [keyword[,...]] 2121.9Slukem# ./altroot base-sys-root 2131.9Slukem# ./bin base-sys-root 2141.9Slukem# ./bin/[ base-util-root 2151.9Slukem# ./bin/cat base-util-root 2161.9Slukem# [...] 2171.9Slukem# 2181.9Slukem# A # in the first column marks a comment. 2191.9Slukem# 2201.9Slukem# If ${obsolete} != 0, only entries with an "obsolete" keyword will 2211.52Slukem# be printed. All other keywords must be present. 2221.9Slukem# 2231.9Slukem# The third field is an optional comma separated list of keywords to 2241.9Slukem# control if a record is printed; every keyword listed must be enabled 2251.9Slukem# for the record to be printed. The following keywords are available: 2261.9Slukem# dummy dummy entry (ignored) 2271.13Slukem# obsolete file is obsolete, and only printed if 2281.13Slukem# ${obsolete} != 0 2291.13Slukem# 2301.87Sskrll# bfd obsolete, use binutils. 2311.87Sskrll# binutils ${MKBINUTILS} != no 2321.22Slukem# catpages ${MKCATPAGES} != no 2331.71Smrg# compat ${MKCOMPAT} != no 2341.22Slukem# crypto ${MKCRYPTO} != no 2351.22Slukem# crypto_idea ${MKCRYPTO_IDEA} != no 2361.22Slukem# crypto_mdc2 ${MKCRYPTO_MDC2} != no 2371.22Slukem# crypto_rc5 ${MKCRYPTO_RC5} != no 2381.22Slukem# cvs ${MKCVS} != no 2391.53Slukem# debug ${MKDEBUG} != no 2401.69Slukem# debuglib ${MKDEBUGLIB} != no 2411.23Slukem# doc ${MKDOC} != no 2421.67Slukem# dynamicroot ${MKDYNAMICROOT} != no 2431.92Suebayasi# extsrc ${MKEXTSRC} != no 2441.52Slukem# gcc ${MKGCC} != no 2451.36Smatt# gcccmds ${MKGCCCMDS} != no 2461.32Sscw# gdb ${MKGDB} != no 2471.22Slukem# hesiod ${MKHESIOD} != no 2481.68Slukem# html ${MKHTML} != no 2491.67Slukem# inet6 ${MKINET6} != no 2501.23Slukem# info ${MKINFO} != no 2511.39Speter# ipfilter ${MKIPFILTER} != no 2521.51Smrg# iscsi ${MKISCSI} != no 2531.22Slukem# kerberos ${MKKERBEROS} != no 2541.85Sdyoung# kmod ${MKKMOD} != no 2551.67Slukem# ldap ${MKLDAP} != no 2561.22Slukem# lint ${MKLINT} != no 2571.78Sagc# lvm ${MKLVM} != no 2581.22Slukem# man ${MKMAN} != no 2591.67Slukem# manpages ${MKMANPAGES} != no 2601.22Slukem# manz ${MKMANZ} != no 2611.88Stsarna# mdns ${MKMDNS} != no 2621.23Slukem# nls ${MKNLS} != no 2631.66Sdyoung# nvi ${MKNVI} != no 2641.37She# pam ${MKPAM} != no 2651.39Speter# pf ${MKPF} != no 2661.67Slukem# pic ${MKPIC} != no 2671.22Slukem# postfix ${MKPOSTFIX} != no 2681.22Slukem# profile ${MKPROFILE} != no 2691.24Slukem# share ${MKSHARE} != no 2701.22Slukem# skey ${MKSKEY} != no 2711.73Smrg# x11 ${MKX11} != no && ${X11FLAVOUR} != "Xorg" 2721.73Smrg# xorg ${MKX11} != no && ${X11FLAVOUR} == "Xorg" 2731.22Slukem# yp ${MKYP} != no 2741.89Shaad# zfs ${MKZFS} != no 2751.22Slukem# 2761.87Sskrll# binutils=<n> <n> = value of ${HAVE_BINUTILS} 2771.52Slukem# gcc=<n> <n> = value of ${HAVE_GCC} 2781.52Slukem# gdb=<n> <n> = value of ${HAVE_GDB} 2791.52Slukem# 2801.41Slukem# use_inet6 ${USE_INET6} != no 2811.41Slukem# use_kerberos ${USE_KERBEROS} != no 2821.41Slukem# use_yp ${USE_YP} != no 2831.41Slukem# 2841.22Slukem# .cat if ${MKMANZ} != "no" && ${MKCATPAGES} != "no" 2851.22Slukem# automatically append ".gz" to the filename 2861.22Slukem# 2871.22Slukem# .man if ${MKMANZ} != "no" && ${MKMAN} != "no" 2881.22Slukem# automatically append ".gz" to the filename 2891.1Sdyoung# 2901.8Slukemlist_set_files() 2911.8Slukem{ 2921.83Sapb if [ ${MAKEVERBOSE:-2} -lt 3 ]; then 2931.65She verbose=false 2941.65She else 2951.65She verbose=true 2961.65She fi 2971.1Sdyoung for setname; do 2981.65She list=`list_set_lists $setname` 2991.65She for l in $list; do 3001.65She echo $l 3011.65She if $verbose; then 3021.82Sapb echo >&2 "DEBUG: list_set_files: $l" 3031.65She fi 3041.65She done 3051.62Sad done | xargs cat | ${SED} ${SUBST} | \ 3061.43Sapb ${AWK} -v obsolete=${obsolete} ' 3071.9Slukem BEGIN { 3081.52Slukem if (obsolete) 3091.52Slukem wanted["obsolete"] = 1 3101.52Slukem 3111.97Suebayasi split("'"${MKEXTRAVARS} ${_MKVARS_yes} ${_MKVARS_no}"'", needvars) 3121.52Slukem for (vi in needvars) { 3131.52Slukem nv = needvars[vi] 3141.52Slukem kw = tolower(nv) 3151.52Slukem sub(/^mk/, "", kw) 3161.52Slukem if (ENVIRON[nv] != "no") 3171.52Slukem wanted[kw] = 1 3181.52Slukem } 3191.52Slukem 3201.52Slukem if ("'"${TOOLCHAIN_MISSING}"'" != "yes") { 3211.90Sdyoung if ("binutils" in wanted) 3221.90Sdyoung wanted["binutils=" "'"${HAVE_BINUTILS}"'"] = 1 3231.90Sdyoung if ("gcc" in wanted) 3241.90Sdyoung wanted["gcc=" "'"${HAVE_GCC}"'"] = 1 3251.90Sdyoung if ("gdb" in wanted) 3261.90Sdyoung wanted["gdb=" "'"${HAVE_GDB}"'"] = 1 3271.9Slukem } 3281.52Slukem if (("man" in wanted) && ("catpages" in wanted)) 3291.52Slukem wanted[".cat"] = 1 3301.52Slukem if (("man" in wanted) && ("manpages" in wanted)) 3311.52Slukem wanted[".man"] = 1 3321.9Slukem } 3331.9Slukem 3341.9Slukem /^#/ { 3351.9Slukem next; 3361.9Slukem } 3371.9Slukem 3381.9Slukem NF > 2 && $3 != "-" { 3391.9Slukem split($3, keywords, ",") 3401.9Slukem show = 1 3411.52Slukem haveobs = 0 3421.9Slukem for (ki in keywords) { 3431.9Slukem kw = keywords[ki] 3441.22Slukem if (("manz" in wanted) && 3451.22Slukem (kw == ".cat" || kw == ".man")) 3461.22Slukem $1 = $1 ".gz" 3471.59Sjmmv negated = match(kw, "! *") 3481.59Sjmmv if (negated > 0) { 3491.59Sjmmv kw = substr(kw, RSTART + RLENGTH) 3501.59Sjmmv if (kw in wanted) 3511.59Sjmmv show = 0 3521.59Sjmmv } else { 3531.59Sjmmv if (! (kw in wanted)) 3541.59Sjmmv show = 0 3551.59Sjmmv } 3561.52Slukem if (kw == "obsolete") 3571.52Slukem haveobs = 1 3581.9Slukem } 3591.52Slukem if (obsolete && ! haveobs) 3601.52Slukem next 3611.9Slukem if (show) 3621.9Slukem print 3631.9Slukem next 3641.9Slukem } 3651.9Slukem 3661.9Slukem { 3671.9Slukem if (! obsolete) 3681.9Slukem print 3691.9Slukem }' 3701.9Slukem 3711.1Sdyoung} 3721.1Sdyoung 3731.1Sdyoung# 3741.1Sdyoung# list_set_lists setname 3751.1Sdyoung# 3761.1Sdyoung# Print to stdout a list of files, one filename per line, which 3771.1Sdyoung# concatenate to create the packing list for setname. E.g., 3781.1Sdyoung# 3791.1Sdyoung# .../lists/base/mi 3801.1Sdyoung# .../lists/base/rescue.mi 3811.1Sdyoung# .../lists/base/md.i386 3821.9Slukem# [...] 3831.1Sdyoung# 3841.9Slukem# For a given setname $set, the following files may be selected from 3851.9Slukem# .../list/$set: 3861.9Slukem# mi 3871.92Suebayasi# mi.ext.* 3881.11Slukem# ad.${MACHINE_ARCH} 3891.11Slukem# (or) ad.${MACHINE_CPU} 3901.11Slukem# ad.${MACHINE_CPU}.shl 3911.11Slukem# md.${MACHINE}.${MACHINE_ARCH} 3921.11Slukem# (or) md.${MACHINE} 3931.9Slukem# stl.mi 3941.92Suebayasi# stl.${stlib} 3951.9Slukem# shl.mi 3961.92Suebayasi# shl.mi.ext.* 3971.92Suebayasi# shl.${shlib} 3981.92Suebayasi# shl.${shlib}.ext.* 3991.77Stsutsui# module.mi if ${module} != no 4001.77Stsutsui# module.${MACHINE} if ${module} != no 4011.77Stsutsui# module.ad.${MACHINE_ARCH} if ${module} != no 4021.77Stsutsui# (or) module.ad.${MACHINE_CPU} if ${module} != no 4031.9Slukem# rescue.shl 4041.11Slukem# rescue.${MACHINE} 4051.11Slukem# rescue.ad.${MACHINE_ARCH} 4061.11Slukem# (or) rescue.ad.${MACHINE_CPU} 4071.11Slukem# rescue.ad.${MACHINE_CPU}.shl 4081.1Sdyoung# 4091.9Slukem# Environment: 4101.1Sdyoung# shlib 4111.1Sdyoung# stlib 4121.1Sdyoung# 4131.8Slukemlist_set_lists() 4141.8Slukem{ 4151.1Sdyoung setname=$1 4161.1Sdyoung 4171.9Slukem setdir=$setsdir/lists/$setname 4181.9Slukem echo $setdir/mi 4191.92Suebayasi for _extsrc_pkg in ${EXTSRCS}; do 4201.92Suebayasi if [ -f $setdir/mi.ext.${_extsrc_pkg} ]; then 4211.92Suebayasi echo $setdir/mi.ext.${_extsrc_pkg} 4221.92Suebayasi fi 4231.92Suebayasi done 4241.11Slukem if [ "${MACHINE}" != "${MACHINE_ARCH}" ]; then 4251.11Slukem # Prefer an ad.${MACHINE_ARCH} over an ad.${MACHINE_CPU}, 4261.1Sdyoung # since the arch-specific one will be more specific than 4271.1Sdyoung # the cpu-specific one. 4281.11Slukem if [ -f $setdir/ad.${MACHINE_ARCH} ]; then 4291.11Slukem echo $setdir/ad.${MACHINE_ARCH} 4301.11Slukem elif [ -f $setdir/ad.${MACHINE_CPU} ]; then 4311.11Slukem echo $setdir/ad.${MACHINE_CPU} 4321.1Sdyoung fi 4331.1Sdyoung if [ "$shlib" != "no" -a \ 4341.11Slukem -f $setdir/ad.${MACHINE_CPU}.shl ]; then 4351.11Slukem echo $setdir/ad.${MACHINE_CPU}.shl 4361.1Sdyoung fi 4371.1Sdyoung fi 4381.11Slukem if [ -f $setdir/md.${MACHINE}.${MACHINE_ARCH} ]; then 4391.11Slukem echo $setdir/md.${MACHINE}.${MACHINE_ARCH} 4401.11Slukem elif [ -f $setdir/md.${MACHINE} ]; then 4411.11Slukem echo $setdir/md.${MACHINE} 4421.1Sdyoung fi 4431.9Slukem if [ -f $setdir/stl.mi ]; then 4441.9Slukem echo $setdir/stl.mi 4451.1Sdyoung fi 4461.9Slukem if [ -f $setdir/stl.${stlib} ]; then 4471.9Slukem echo $setdir/stl.${stlib} 4481.1Sdyoung fi 4491.1Sdyoung if [ "$shlib" != "no" ]; then 4501.9Slukem if [ -f $setdir/shl.mi ]; then 4511.9Slukem echo $setdir/shl.mi 4521.7Sdyoung fi 4531.92Suebayasi for _extsrc_pkg in ${EXTSRCS}; do 4541.92Suebayasi if [ -f $setdir/shl.mi.ext.${_extsrc_pkg} ]; then 4551.92Suebayasi echo $setdir/shl.mi.ext.${_extsrc_pkg} 4561.92Suebayasi fi 4571.92Suebayasi done 4581.9Slukem if [ -f $setdir/shl.${shlib} ]; then 4591.9Slukem echo $setdir/shl.${shlib} 4601.7Sdyoung fi 4611.92Suebayasi for _extsrc_pkg in ${EXTSRCS}; do 4621.92Suebayasi if [ -f $setdir/shl.${shlib}.ext.${_extsrc_pkg} ]; then 4631.92Suebayasi echo $setdir/shl.${shlib}.ext.${_extsrc_pkg} 4641.92Suebayasi fi 4651.92Suebayasi done 4661.1Sdyoung fi 4671.76Stsutsui if [ "$module" != "no" ]; then 4681.76Stsutsui if [ -f $setdir/module.mi ]; then 4691.76Stsutsui echo $setdir/module.mi 4701.1Sdyoung fi 4711.77Stsutsui if [ -f $setdir/module.${MACHINE} ]; then 4721.77Stsutsui echo $setdir/module.${MACHINE} 4731.77Stsutsui fi 4741.77Stsutsui if [ "${MACHINE}" != "${MACHINE_ARCH}" ]; then 4751.77Stsutsui # Prefer a module.ad.${MACHINE_ARCH} over a 4761.77Stsutsui # module.ad.${MACHINE_CPU}, since the arch- 4771.77Stsutsui # specific one will be more specific than the 4781.77Stsutsui # cpu-specific one. 4791.77Stsutsui if [ -f $setdir/module.ad.${MACHINE_ARCH} ]; then 4801.77Stsutsui echo $setdir/module.ad.${MACHINE_ARCH} 4811.77Stsutsui elif [ -f $setdir/module.ad.${MACHINE_CPU} ]; then 4821.77Stsutsui echo $setdir/module.ad.${MACHINE_CPU} 4831.77Stsutsui fi 4841.77Stsutsui fi 4851.1Sdyoung fi 4861.1Sdyoung 4871.9Slukem if [ -f $setdir/rescue.mi ]; then 4881.9Slukem echo $setdir/rescue.mi 4891.1Sdyoung fi 4901.11Slukem if [ -f $setdir/rescue.${MACHINE} ]; then 4911.11Slukem echo $setdir/rescue.${MACHINE} 4921.1Sdyoung fi 4931.11Slukem if [ "${MACHINE}" != "${MACHINE_ARCH}" ]; then 4941.11Slukem # Prefer a rescue.ad.${MACHINE_ARCH} over a 4951.11Slukem # rescue.ad.${MACHINE_CPU}, since the arch- 4961.1Sdyoung # specific one will be more specific than the 4971.1Sdyoung # cpu-specific one. 4981.11Slukem if [ -f $setdir/rescue.ad.${MACHINE_ARCH} ]; then 4991.11Slukem echo $setdir/rescue.ad.${MACHINE_ARCH} 5001.11Slukem elif [ -f $setdir/rescue.ad.${MACHINE_CPU} ]; then 5011.11Slukem echo $setdir/rescue.ad.${MACHINE_CPU} 5021.1Sdyoung fi 5031.10Sjmc if [ "$shlib" != "no" -a \ 5041.11Slukem -f $setdir/rescue.ad.${MACHINE_CPU}.shl ]; then 5051.11Slukem echo $setdir/rescue.ad.${MACHINE_CPU}.shl 5061.10Sjmc fi 5071.1Sdyoung fi 5081.5Sdyoung} 5091.5Sdyoung 5101.9Slukem# arch_to_cpu mach 5111.9Slukem# 5121.11Slukem# Print the ${MACHINE_CPU} for ${MACHINE_ARCH}=mach, 5131.9Slukem# as determined by <bsd.own.mk>. 5141.9Slukem# 5151.8Slukemarch_to_cpu() 5161.8Slukem{ 5171.56Sapb MACHINE_ARCH=${1} ${MAKE} -B -f- all <<EOMAKE 5181.5Sdyoung.include <bsd.own.mk> 5191.5Sdyoungall: 5201.5Sdyoung @echo \${MACHINE_CPU} 5211.12SlukemEOMAKE 5221.1Sdyoung} 5231.46Sapb 5241.46Sapb# arch_to_endian mach 5251.46Sapb# 5261.46Sapb# Print the ${TARGET_ENDIANNESS} for ${MACHINE_ARCH}=mach, 5271.46Sapb# as determined by <bsd.endian.mk>. 5281.46Sapb# 5291.46Sapbarch_to_endian() 5301.46Sapb{ 5311.56Sapb MACHINE_ARCH=${1} ${MAKE} -B -f- all <<EOMAKE 5321.46Sapb.include <bsd.endian.mk> 5331.46Sapball: 5341.46Sapb @echo \${TARGET_ENDIANNESS} 5351.46SapbEOMAKE 5361.46Sapb} 537