sets.subr revision 1.97
11.94Suebayasi# $NetBSD: sets.subr,v 1.97 2009/12/02 15:05:55 uebayasi Exp $ 21.1Sdyoung# 31.9Slukem 41.97Suebayasiset -vx 51.97Suebayasi 61.9Slukem# 71.11Slukem# The following variables contain defaults for sets.subr functions and callers: 81.9Slukem# setsdir path to src/distrib/sets 91.9Slukem# nlists list of base sets 101.9Slukem# xlists list of x11 sets 111.92Suebayasi# extlists list of extsrc sets 121.9Slukem# obsolete controls if obsolete files are selected instead 131.76Stsutsui# module if != "no", enable MODULE sets 141.9Slukem# shlib shared library format (a.out, elf, or "") 151.9Slukem# stlib static library format (a.out, elf) 161.11Slukem# 171.11Slukem# The following <bsd.own.mk> variables are exported to the environment: 181.11Slukem# MACHINE 191.11Slukem# MACHINE_ARCH 201.11Slukem# MACHINE_CPU 211.87Sskrll# HAVE_BINUTILS 221.48Smrg# HAVE_GCC 231.52Slukem# HAVE_GDB 241.11Slukem# TOOLCHAIN_MISSING 251.11Slukem# OBJECT_FMT 261.22Slukem# as well as: 271.22Slukem# 281.95Suebayasi 291.95Suebayasi# XXX don't hardcode 301.95SuebayasiMKEXTRAVARS="\ 311.41Slukem USE_INET6 \ 321.41Slukem USE_KERBEROS \ 331.63Slukem USE_LDAP \ 341.41Slukem USE_YP \ 351.64She NETBSDSRCDIR \ 361.65She MAKEVERBOSE \ 371.22Slukem" 381.42Sapb# 391.42Sapb# The following variables refer to tools that are used when building sets: 401.42Sapb# 411.43Sapb: ${AWK:=awk} 421.42Sapb: ${CKSUM:=cksum} 431.43Sapb: ${COMM:=comm} 441.44Sapb: ${DATE:=date} 451.43Sapb: ${DB:=db} 461.43Sapb: ${EGREP:=egrep} 471.43Sapb: ${ENV_CMD:=env} # ${ENV} is special to sh(1), ksh(1), etc. 481.44Sapb: ${FGREP:=fgrep} 491.43Sapb: ${FIND:=find} 501.44Sapb: ${GREP:=grep} 511.43Sapb: ${GZIP_CMD:=gzip} # ${GZIP} is special to gzip(1) 521.44Sapb: ${HOSTNAME:=hostname} 531.42Sapb: ${HOST_SH:=sh} 541.43Sapb: ${IDENT:=ident} 551.43Sapb: ${JOIN:=join} 561.43Sapb: ${LS:=ls} 571.43Sapb: ${MAKE:=make} 581.42Sapb: ${MKTEMP:=mktemp} 591.43Sapb: ${MTREE:=mtree} 601.43Sapb: ${PASTE:=paste} 611.42Sapb: ${PAX:=pax} 621.43Sapb: ${PRINTF:=printf} 631.43Sapb: ${SED:=sed} 641.43Sapb: ${SORT:=sort} 651.44Sapb: ${STAT:=stat} 661.44Sapb: ${TSORT:=tsort} 671.43Sapb: ${UNAME:=uname} 681.43Sapb: ${WC:=wc} 691.43Sapb 701.45Sapb# 711.45Sapb# If printf is a shell builtin command, then we can 721.45Sapb# implement cheaper versions of basename and dirname 731.45Sapb# that do not involve any fork/exec overhead. 741.45Sapb# If printf is not builtin, approximate it using echo, 751.45Sapb# and hope there are no weird file names that cause 761.45Sapb# some versions of echo to do the wrong thing. 771.45Sapb# (Converting to this version of dirname speeded up the 781.45Sapb# syspkgdeps script by an order of magnitude, from 68 791.45Sapb# seconds to 6.3 seconds on one particular host.) 801.45Sapb# 811.45Sapb# Note that naive approximations for dirname 821.45Sapb# using ${foo%/*} do not do the right thing in cases 831.45Sapb# where the result should be "/" or ".". 841.45Sapb# 851.45Sapbcase "$(type printf)" in 861.45Sapb*builtin*) 871.45Sapb basename () 881.45Sapb { 891.45Sapb local bn 901.45Sapb bn="${1##*/}" 911.45Sapb bn="${bn%$2}" 921.45Sapb printf "%s\n" "$bn" 931.45Sapb } 941.45Sapb dirname () 951.45Sapb { 961.45Sapb local dn 971.45Sapb case "$1" in 981.45Sapb ?*/*) dn="${1%/*}" ;; 991.45Sapb /*) dn=/ ;; 1001.45Sapb *) dn=. ;; 1011.45Sapb esac 1021.45Sapb printf "%s\n" "$dn" 1031.45Sapb } 1041.45Sapb ;; 1051.45Sapb*) 1061.45Sapb basename () 1071.45Sapb { 1081.45Sapb local bn 1091.45Sapb bn="${1##*/}" 1101.45Sapb bn="${bn%$2}" 1111.45Sapb echo "$bn" 1121.45Sapb } 1131.45Sapb dirname () 1141.45Sapb { 1151.45Sapb local dn 1161.45Sapb case "$1" in 1171.45Sapb ?*/*) dn="${1%/*}" ;; 1181.45Sapb /*) dn=/ ;; 1191.45Sapb *) dn=. ;; 1201.45Sapb esac 1211.45Sapb echo "$dn" 1221.45Sapb } 1231.45Sapb ;; 1241.45Sapbesac 1251.45Sapb 1261.9SlukemoIFS=$IFS 1271.9SlukemIFS=" 1281.9Slukem" 1291.97Suebayasifor i in _MKVARS.yes _MKVARS.no; do 1301.97Suebayasi eval $( 1311.97Suebayasi${MAKE} -B -f- all <<EOMAKE 1321.97Suebayasi.include <bsd.own.mk> 1331.97Suebayasiall: 1341.97Suebayasi @echo "export _MKVARS_${i#*.}=\"\${$i}\"" 1351.97SuebayasiEOMAKE 1361.97Suebayasi) 1371.97Suebayasidone 1381.9Slukemfor x in $( 1391.43Sapb${MAKE} -B -f- all <<EOMAKE 1401.9Slukem.include <bsd.own.mk> 1411.33Sjmc.if (\${MKMAN} == "no" || empty(MANINSTALL:Mmaninstall)) 1421.33SjmcMKMANPAGES=no 1431.33Sjmc.else 1441.33SjmcMKMANPAGES=yes 1451.33Sjmc.endif 1461.72Smrg.if \${MKX11} != "no" 1471.72Smrg. if \${X11FLAVOUR} == "Xorg" 1481.72SmrgMKXORG:=yes 1491.72SmrgMKX11:=no 1501.72Smrg. else 1511.72SmrgMKXORG:=no 1521.72Smrg. endif 1531.72Smrg.endif 1541.9Slukemall: 1551.11Slukem.for i in MACHINE MACHINE_ARCH MACHINE_CPU \ 1561.87Sskrll HAVE_BINUTILS HAVE_GCC HAVE_GDB OBJECT_FMT TOOLCHAIN_MISSING \ 1571.95Suebayasi ${MKEXTRAVARS} \${_MKVARS.yes} \${_MKVARS.no} 1581.96Suebayasi @echo "export \$i=\"\${\$i}\"" 1591.11Slukem.endfor 1601.9Slukem 1611.12SlukemEOMAKE 1621.9Slukem); do 1631.96Suebayasi# echo 1>&2 "DEBUG: read $x" 1641.9Slukem eval $x 1651.9Slukemdone 1661.9SlukemIFS=$oIFS 1671.9Slukem 1681.34Serhsetsdir=${0%/*} 1691.9Slukemobsolete=0 1701.76Stsutsuimodule=yes 1711.91Sdyoungif [ "${MKKMOD}" = "no" ]; then 1721.91Sdyoung module=no # MODULEs are off. 1731.91Sdyoungelif [ "${MACHINE}" = "evbppc" ]; then 1741.76Stsutsui module=no # Turn off MODULEs for some ports. 1751.9Slukemfi 1761.31Sjmc# Determine lib type. Do this first so stlib also gets set. 1771.31Sjmcif [ "${OBJECT_FMT}" = "ELF" ]; then 1781.9Slukem shlib=elf 1791.9Slukemelse 1801.9Slukem shlib=aout 1811.9Slukemfi 1821.9Slukemstlib=$shlib 1831.31Sjmc# Now check for MKPIC or specials and turn off shlib if need be. 1841.31Sjmcif [ "${MKPIC}" = "no" ]; then 1851.31Sjmc shlib=no 1861.31Sjmcfi 1871.29Suweif [ "${MACHINE_ARCH}" = "m68000" ]; then 1881.9Slukem shlib=no # Turn off shlibs for some ports. 1891.9Slukemfi 1901.86Sjnemethif [ "$module" != "no" ]; then 1911.86Sjnemeth nlists="base comp etc games man misc modules tests text" 1921.86Sjnemethelse 1931.86Sjnemeth nlists="base comp etc games man misc tests text" 1941.86Sjnemethfi 1951.86Sjnemethxlists="xbase xcomp xetc xfont xserver" 1961.92Suebayasiextlists="extbase extcomp extetc" 1971.9Slukem 1981.64SheOSRELEASE=`${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh` 1991.81SrmindMODULEDIR="stand/${MACHINE}/${OSRELEASE}/modules" 2001.62SadSUBST="s#@MODULEDIR@#${MODULEDIR}#g" 2011.62SadSUBST="${SUBST};s#@OSRELEASE@#${OSRELEASE}#g" 2021.62SadSUBST="${SUBST};s#@MACHINE@#${MACHINE}#g" 2031.60Sad 2041.9Slukem# 2051.9Slukem# list_set_files setfile [...] 2061.1Sdyoung# 2071.9Slukem# Produce a packing list for setfile(s). 2081.9Slukem# In each file, a record consists of a path and a System Package name, 2091.9Slukem# separated by whitespace. E.g., 2101.9Slukem# 2111.94Suebayasi# # $NetBSD: sets.subr,v 1.97 2009/12/02 15:05:55 uebayasi Exp $ 2121.9Slukem# . base-sys-root [keyword[,...]] 2131.9Slukem# ./altroot base-sys-root 2141.9Slukem# ./bin base-sys-root 2151.9Slukem# ./bin/[ base-util-root 2161.9Slukem# ./bin/cat base-util-root 2171.9Slukem# [...] 2181.9Slukem# 2191.9Slukem# A # in the first column marks a comment. 2201.9Slukem# 2211.9Slukem# If ${obsolete} != 0, only entries with an "obsolete" keyword will 2221.52Slukem# be printed. All other keywords must be present. 2231.9Slukem# 2241.9Slukem# The third field is an optional comma separated list of keywords to 2251.9Slukem# control if a record is printed; every keyword listed must be enabled 2261.9Slukem# for the record to be printed. The following keywords are available: 2271.9Slukem# dummy dummy entry (ignored) 2281.13Slukem# obsolete file is obsolete, and only printed if 2291.13Slukem# ${obsolete} != 0 2301.13Slukem# 2311.87Sskrll# bfd obsolete, use binutils. 2321.87Sskrll# binutils ${MKBINUTILS} != no 2331.22Slukem# catpages ${MKCATPAGES} != no 2341.71Smrg# compat ${MKCOMPAT} != no 2351.22Slukem# crypto ${MKCRYPTO} != no 2361.22Slukem# crypto_idea ${MKCRYPTO_IDEA} != no 2371.22Slukem# crypto_mdc2 ${MKCRYPTO_MDC2} != no 2381.22Slukem# crypto_rc5 ${MKCRYPTO_RC5} != no 2391.22Slukem# cvs ${MKCVS} != no 2401.53Slukem# debug ${MKDEBUG} != no 2411.69Slukem# debuglib ${MKDEBUGLIB} != no 2421.23Slukem# doc ${MKDOC} != no 2431.67Slukem# dynamicroot ${MKDYNAMICROOT} != no 2441.92Suebayasi# extsrc ${MKEXTSRC} != no 2451.52Slukem# gcc ${MKGCC} != no 2461.36Smatt# gcccmds ${MKGCCCMDS} != no 2471.32Sscw# gdb ${MKGDB} != no 2481.22Slukem# hesiod ${MKHESIOD} != no 2491.68Slukem# html ${MKHTML} != no 2501.67Slukem# inet6 ${MKINET6} != no 2511.23Slukem# info ${MKINFO} != no 2521.39Speter# ipfilter ${MKIPFILTER} != no 2531.51Smrg# iscsi ${MKISCSI} != no 2541.22Slukem# kerberos ${MKKERBEROS} != no 2551.85Sdyoung# kmod ${MKKMOD} != no 2561.67Slukem# ldap ${MKLDAP} != no 2571.22Slukem# lint ${MKLINT} != no 2581.78Sagc# lvm ${MKLVM} != no 2591.22Slukem# man ${MKMAN} != no 2601.67Slukem# manpages ${MKMANPAGES} != no 2611.22Slukem# manz ${MKMANZ} != no 2621.88Stsarna# mdns ${MKMDNS} != no 2631.23Slukem# nls ${MKNLS} != no 2641.66Sdyoung# nvi ${MKNVI} != no 2651.37She# pam ${MKPAM} != no 2661.39Speter# pf ${MKPF} != no 2671.67Slukem# pic ${MKPIC} != no 2681.22Slukem# postfix ${MKPOSTFIX} != no 2691.22Slukem# profile ${MKPROFILE} != no 2701.24Slukem# share ${MKSHARE} != no 2711.22Slukem# skey ${MKSKEY} != no 2721.73Smrg# x11 ${MKX11} != no && ${X11FLAVOUR} != "Xorg" 2731.73Smrg# xorg ${MKX11} != no && ${X11FLAVOUR} == "Xorg" 2741.22Slukem# yp ${MKYP} != no 2751.89Shaad# zfs ${MKZFS} != no 2761.22Slukem# 2771.87Sskrll# binutils=<n> <n> = value of ${HAVE_BINUTILS} 2781.52Slukem# gcc=<n> <n> = value of ${HAVE_GCC} 2791.52Slukem# gdb=<n> <n> = value of ${HAVE_GDB} 2801.52Slukem# 2811.41Slukem# use_inet6 ${USE_INET6} != no 2821.41Slukem# use_kerberos ${USE_KERBEROS} != no 2831.41Slukem# use_yp ${USE_YP} != no 2841.41Slukem# 2851.22Slukem# .cat if ${MKMANZ} != "no" && ${MKCATPAGES} != "no" 2861.22Slukem# automatically append ".gz" to the filename 2871.22Slukem# 2881.22Slukem# .man if ${MKMANZ} != "no" && ${MKMAN} != "no" 2891.22Slukem# automatically append ".gz" to the filename 2901.1Sdyoung# 2911.8Slukemlist_set_files() 2921.8Slukem{ 2931.83Sapb if [ ${MAKEVERBOSE:-2} -lt 3 ]; then 2941.65She verbose=false 2951.65She else 2961.65She verbose=true 2971.65She fi 2981.1Sdyoung for setname; do 2991.65She list=`list_set_lists $setname` 3001.65She for l in $list; do 3011.65She echo $l 3021.65She if $verbose; then 3031.82Sapb echo >&2 "DEBUG: list_set_files: $l" 3041.65She fi 3051.65She done 3061.62Sad done | xargs cat | ${SED} ${SUBST} | \ 3071.43Sapb ${AWK} -v obsolete=${obsolete} ' 3081.9Slukem BEGIN { 3091.52Slukem if (obsolete) 3101.52Slukem wanted["obsolete"] = 1 3111.52Slukem 3121.97Suebayasi split("'"${MKEXTRAVARS} ${_MKVARS_yes} ${_MKVARS_no}"'", needvars) 3131.52Slukem for (vi in needvars) { 3141.52Slukem nv = needvars[vi] 3151.52Slukem kw = tolower(nv) 3161.52Slukem sub(/^mk/, "", kw) 3171.52Slukem if (ENVIRON[nv] != "no") 3181.52Slukem wanted[kw] = 1 3191.52Slukem } 3201.52Slukem 3211.52Slukem if ("'"${TOOLCHAIN_MISSING}"'" != "yes") { 3221.90Sdyoung if ("binutils" in wanted) 3231.90Sdyoung wanted["binutils=" "'"${HAVE_BINUTILS}"'"] = 1 3241.90Sdyoung if ("gcc" in wanted) 3251.90Sdyoung wanted["gcc=" "'"${HAVE_GCC}"'"] = 1 3261.90Sdyoung if ("gdb" in wanted) 3271.90Sdyoung wanted["gdb=" "'"${HAVE_GDB}"'"] = 1 3281.9Slukem } 3291.52Slukem if (("man" in wanted) && ("catpages" in wanted)) 3301.52Slukem wanted[".cat"] = 1 3311.52Slukem if (("man" in wanted) && ("manpages" in wanted)) 3321.52Slukem wanted[".man"] = 1 3331.9Slukem } 3341.9Slukem 3351.9Slukem /^#/ { 3361.9Slukem next; 3371.9Slukem } 3381.9Slukem 3391.9Slukem NF > 2 && $3 != "-" { 3401.9Slukem split($3, keywords, ",") 3411.9Slukem show = 1 3421.52Slukem haveobs = 0 3431.9Slukem for (ki in keywords) { 3441.9Slukem kw = keywords[ki] 3451.22Slukem if (("manz" in wanted) && 3461.22Slukem (kw == ".cat" || kw == ".man")) 3471.22Slukem $1 = $1 ".gz" 3481.59Sjmmv negated = match(kw, "! *") 3491.59Sjmmv if (negated > 0) { 3501.59Sjmmv kw = substr(kw, RSTART + RLENGTH) 3511.59Sjmmv if (kw in wanted) 3521.59Sjmmv show = 0 3531.59Sjmmv } else { 3541.59Sjmmv if (! (kw in wanted)) 3551.59Sjmmv show = 0 3561.59Sjmmv } 3571.52Slukem if (kw == "obsolete") 3581.52Slukem haveobs = 1 3591.9Slukem } 3601.52Slukem if (obsolete && ! haveobs) 3611.52Slukem next 3621.9Slukem if (show) 3631.9Slukem print 3641.9Slukem next 3651.9Slukem } 3661.9Slukem 3671.9Slukem { 3681.9Slukem if (! obsolete) 3691.9Slukem print 3701.9Slukem }' 3711.9Slukem 3721.1Sdyoung} 3731.1Sdyoung 3741.1Sdyoung# 3751.1Sdyoung# list_set_lists setname 3761.1Sdyoung# 3771.1Sdyoung# Print to stdout a list of files, one filename per line, which 3781.1Sdyoung# concatenate to create the packing list for setname. E.g., 3791.1Sdyoung# 3801.1Sdyoung# .../lists/base/mi 3811.1Sdyoung# .../lists/base/rescue.mi 3821.1Sdyoung# .../lists/base/md.i386 3831.9Slukem# [...] 3841.1Sdyoung# 3851.9Slukem# For a given setname $set, the following files may be selected from 3861.9Slukem# .../list/$set: 3871.9Slukem# mi 3881.92Suebayasi# mi.ext.* 3891.11Slukem# ad.${MACHINE_ARCH} 3901.11Slukem# (or) ad.${MACHINE_CPU} 3911.11Slukem# ad.${MACHINE_CPU}.shl 3921.11Slukem# md.${MACHINE}.${MACHINE_ARCH} 3931.11Slukem# (or) md.${MACHINE} 3941.9Slukem# stl.mi 3951.92Suebayasi# stl.${stlib} 3961.9Slukem# shl.mi 3971.92Suebayasi# shl.mi.ext.* 3981.92Suebayasi# shl.${shlib} 3991.92Suebayasi# shl.${shlib}.ext.* 4001.77Stsutsui# module.mi if ${module} != no 4011.77Stsutsui# module.${MACHINE} if ${module} != no 4021.77Stsutsui# module.ad.${MACHINE_ARCH} if ${module} != no 4031.77Stsutsui# (or) module.ad.${MACHINE_CPU} if ${module} != no 4041.9Slukem# rescue.shl 4051.11Slukem# rescue.${MACHINE} 4061.11Slukem# rescue.ad.${MACHINE_ARCH} 4071.11Slukem# (or) rescue.ad.${MACHINE_CPU} 4081.11Slukem# rescue.ad.${MACHINE_CPU}.shl 4091.1Sdyoung# 4101.9Slukem# Environment: 4111.1Sdyoung# shlib 4121.1Sdyoung# stlib 4131.1Sdyoung# 4141.8Slukemlist_set_lists() 4151.8Slukem{ 4161.1Sdyoung setname=$1 4171.1Sdyoung 4181.9Slukem setdir=$setsdir/lists/$setname 4191.9Slukem echo $setdir/mi 4201.92Suebayasi for _extsrc_pkg in ${EXTSRCS}; do 4211.92Suebayasi if [ -f $setdir/mi.ext.${_extsrc_pkg} ]; then 4221.92Suebayasi echo $setdir/mi.ext.${_extsrc_pkg} 4231.92Suebayasi fi 4241.92Suebayasi done 4251.11Slukem if [ "${MACHINE}" != "${MACHINE_ARCH}" ]; then 4261.11Slukem # Prefer an ad.${MACHINE_ARCH} over an ad.${MACHINE_CPU}, 4271.1Sdyoung # since the arch-specific one will be more specific than 4281.1Sdyoung # the cpu-specific one. 4291.11Slukem if [ -f $setdir/ad.${MACHINE_ARCH} ]; then 4301.11Slukem echo $setdir/ad.${MACHINE_ARCH} 4311.11Slukem elif [ -f $setdir/ad.${MACHINE_CPU} ]; then 4321.11Slukem echo $setdir/ad.${MACHINE_CPU} 4331.1Sdyoung fi 4341.1Sdyoung if [ "$shlib" != "no" -a \ 4351.11Slukem -f $setdir/ad.${MACHINE_CPU}.shl ]; then 4361.11Slukem echo $setdir/ad.${MACHINE_CPU}.shl 4371.1Sdyoung fi 4381.1Sdyoung fi 4391.11Slukem if [ -f $setdir/md.${MACHINE}.${MACHINE_ARCH} ]; then 4401.11Slukem echo $setdir/md.${MACHINE}.${MACHINE_ARCH} 4411.11Slukem elif [ -f $setdir/md.${MACHINE} ]; then 4421.11Slukem echo $setdir/md.${MACHINE} 4431.1Sdyoung fi 4441.9Slukem if [ -f $setdir/stl.mi ]; then 4451.9Slukem echo $setdir/stl.mi 4461.1Sdyoung fi 4471.9Slukem if [ -f $setdir/stl.${stlib} ]; then 4481.9Slukem echo $setdir/stl.${stlib} 4491.1Sdyoung fi 4501.1Sdyoung if [ "$shlib" != "no" ]; then 4511.9Slukem if [ -f $setdir/shl.mi ]; then 4521.9Slukem echo $setdir/shl.mi 4531.7Sdyoung fi 4541.92Suebayasi for _extsrc_pkg in ${EXTSRCS}; do 4551.92Suebayasi if [ -f $setdir/shl.mi.ext.${_extsrc_pkg} ]; then 4561.92Suebayasi echo $setdir/shl.mi.ext.${_extsrc_pkg} 4571.92Suebayasi fi 4581.92Suebayasi done 4591.9Slukem if [ -f $setdir/shl.${shlib} ]; then 4601.9Slukem echo $setdir/shl.${shlib} 4611.7Sdyoung fi 4621.92Suebayasi for _extsrc_pkg in ${EXTSRCS}; do 4631.92Suebayasi if [ -f $setdir/shl.${shlib}.ext.${_extsrc_pkg} ]; then 4641.92Suebayasi echo $setdir/shl.${shlib}.ext.${_extsrc_pkg} 4651.92Suebayasi fi 4661.92Suebayasi done 4671.1Sdyoung fi 4681.76Stsutsui if [ "$module" != "no" ]; then 4691.76Stsutsui if [ -f $setdir/module.mi ]; then 4701.76Stsutsui echo $setdir/module.mi 4711.1Sdyoung fi 4721.77Stsutsui if [ -f $setdir/module.${MACHINE} ]; then 4731.77Stsutsui echo $setdir/module.${MACHINE} 4741.77Stsutsui fi 4751.77Stsutsui if [ "${MACHINE}" != "${MACHINE_ARCH}" ]; then 4761.77Stsutsui # Prefer a module.ad.${MACHINE_ARCH} over a 4771.77Stsutsui # module.ad.${MACHINE_CPU}, since the arch- 4781.77Stsutsui # specific one will be more specific than the 4791.77Stsutsui # cpu-specific one. 4801.77Stsutsui if [ -f $setdir/module.ad.${MACHINE_ARCH} ]; then 4811.77Stsutsui echo $setdir/module.ad.${MACHINE_ARCH} 4821.77Stsutsui elif [ -f $setdir/module.ad.${MACHINE_CPU} ]; then 4831.77Stsutsui echo $setdir/module.ad.${MACHINE_CPU} 4841.77Stsutsui fi 4851.77Stsutsui fi 4861.1Sdyoung fi 4871.1Sdyoung 4881.9Slukem if [ -f $setdir/rescue.mi ]; then 4891.9Slukem echo $setdir/rescue.mi 4901.1Sdyoung fi 4911.11Slukem if [ -f $setdir/rescue.${MACHINE} ]; then 4921.11Slukem echo $setdir/rescue.${MACHINE} 4931.1Sdyoung fi 4941.11Slukem if [ "${MACHINE}" != "${MACHINE_ARCH}" ]; then 4951.11Slukem # Prefer a rescue.ad.${MACHINE_ARCH} over a 4961.11Slukem # rescue.ad.${MACHINE_CPU}, since the arch- 4971.1Sdyoung # specific one will be more specific than the 4981.1Sdyoung # cpu-specific one. 4991.11Slukem if [ -f $setdir/rescue.ad.${MACHINE_ARCH} ]; then 5001.11Slukem echo $setdir/rescue.ad.${MACHINE_ARCH} 5011.11Slukem elif [ -f $setdir/rescue.ad.${MACHINE_CPU} ]; then 5021.11Slukem echo $setdir/rescue.ad.${MACHINE_CPU} 5031.1Sdyoung fi 5041.10Sjmc if [ "$shlib" != "no" -a \ 5051.11Slukem -f $setdir/rescue.ad.${MACHINE_CPU}.shl ]; then 5061.11Slukem echo $setdir/rescue.ad.${MACHINE_CPU}.shl 5071.10Sjmc fi 5081.1Sdyoung fi 5091.5Sdyoung} 5101.5Sdyoung 5111.9Slukem# arch_to_cpu mach 5121.9Slukem# 5131.11Slukem# Print the ${MACHINE_CPU} for ${MACHINE_ARCH}=mach, 5141.9Slukem# as determined by <bsd.own.mk>. 5151.9Slukem# 5161.8Slukemarch_to_cpu() 5171.8Slukem{ 5181.56Sapb MACHINE_ARCH=${1} ${MAKE} -B -f- all <<EOMAKE 5191.5Sdyoung.include <bsd.own.mk> 5201.5Sdyoungall: 5211.5Sdyoung @echo \${MACHINE_CPU} 5221.12SlukemEOMAKE 5231.1Sdyoung} 5241.46Sapb 5251.46Sapb# arch_to_endian mach 5261.46Sapb# 5271.46Sapb# Print the ${TARGET_ENDIANNESS} for ${MACHINE_ARCH}=mach, 5281.46Sapb# as determined by <bsd.endian.mk>. 5291.46Sapb# 5301.46Sapbarch_to_endian() 5311.46Sapb{ 5321.56Sapb MACHINE_ARCH=${1} ${MAKE} -B -f- all <<EOMAKE 5331.46Sapb.include <bsd.endian.mk> 5341.46Sapball: 5351.46Sapb @echo \${TARGET_ENDIANNESS} 5361.46SapbEOMAKE 5371.46Sapb} 538