sets.subr revision 1.94
11.94Suebayasi# $NetBSD: sets.subr,v 1.94 2009/12/02 14:13:12 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.22SlukemMKVARS="\ 271.41Slukem USE_INET6 \ 281.41Slukem USE_KERBEROS \ 291.63Slukem USE_LDAP \ 301.41Slukem USE_YP \ 311.64She NETBSDSRCDIR \ 321.65She MAKEVERBOSE \ 331.22Slukem" 341.42Sapb# 351.42Sapb# The following variables refer to tools that are used when building sets: 361.42Sapb# 371.43Sapb: ${AWK:=awk} 381.42Sapb: ${CKSUM:=cksum} 391.43Sapb: ${COMM:=comm} 401.44Sapb: ${DATE:=date} 411.43Sapb: ${DB:=db} 421.43Sapb: ${EGREP:=egrep} 431.43Sapb: ${ENV_CMD:=env} # ${ENV} is special to sh(1), ksh(1), etc. 441.44Sapb: ${FGREP:=fgrep} 451.43Sapb: ${FIND:=find} 461.44Sapb: ${GREP:=grep} 471.43Sapb: ${GZIP_CMD:=gzip} # ${GZIP} is special to gzip(1) 481.44Sapb: ${HOSTNAME:=hostname} 491.42Sapb: ${HOST_SH:=sh} 501.43Sapb: ${IDENT:=ident} 511.43Sapb: ${JOIN:=join} 521.43Sapb: ${LS:=ls} 531.43Sapb: ${MAKE:=make} 541.42Sapb: ${MKTEMP:=mktemp} 551.43Sapb: ${MTREE:=mtree} 561.43Sapb: ${PASTE:=paste} 571.42Sapb: ${PAX:=pax} 581.43Sapb: ${PRINTF:=printf} 591.43Sapb: ${SED:=sed} 601.43Sapb: ${SORT:=sort} 611.44Sapb: ${STAT:=stat} 621.44Sapb: ${TSORT:=tsort} 631.43Sapb: ${UNAME:=uname} 641.43Sapb: ${WC:=wc} 651.43Sapb 661.45Sapb# 671.45Sapb# If printf is a shell builtin command, then we can 681.45Sapb# implement cheaper versions of basename and dirname 691.45Sapb# that do not involve any fork/exec overhead. 701.45Sapb# If printf is not builtin, approximate it using echo, 711.45Sapb# and hope there are no weird file names that cause 721.45Sapb# some versions of echo to do the wrong thing. 731.45Sapb# (Converting to this version of dirname speeded up the 741.45Sapb# syspkgdeps script by an order of magnitude, from 68 751.45Sapb# seconds to 6.3 seconds on one particular host.) 761.45Sapb# 771.45Sapb# Note that naive approximations for dirname 781.45Sapb# using ${foo%/*} do not do the right thing in cases 791.45Sapb# where the result should be "/" or ".". 801.45Sapb# 811.45Sapbcase "$(type printf)" in 821.45Sapb*builtin*) 831.45Sapb basename () 841.45Sapb { 851.45Sapb local bn 861.45Sapb bn="${1##*/}" 871.45Sapb bn="${bn%$2}" 881.45Sapb printf "%s\n" "$bn" 891.45Sapb } 901.45Sapb dirname () 911.45Sapb { 921.45Sapb local dn 931.45Sapb case "$1" in 941.45Sapb ?*/*) dn="${1%/*}" ;; 951.45Sapb /*) dn=/ ;; 961.45Sapb *) dn=. ;; 971.45Sapb esac 981.45Sapb printf "%s\n" "$dn" 991.45Sapb } 1001.45Sapb ;; 1011.45Sapb*) 1021.45Sapb basename () 1031.45Sapb { 1041.45Sapb local bn 1051.45Sapb bn="${1##*/}" 1061.45Sapb bn="${bn%$2}" 1071.45Sapb echo "$bn" 1081.45Sapb } 1091.45Sapb dirname () 1101.45Sapb { 1111.45Sapb local dn 1121.45Sapb case "$1" in 1131.45Sapb ?*/*) dn="${1%/*}" ;; 1141.45Sapb /*) dn=/ ;; 1151.45Sapb *) dn=. ;; 1161.45Sapb esac 1171.45Sapb echo "$dn" 1181.45Sapb } 1191.45Sapb ;; 1201.45Sapbesac 1211.45Sapb 1221.9SlukemoIFS=$IFS 1231.9SlukemIFS=" 1241.9Slukem" 1251.9Slukemfor x in $( 1261.43Sapb${MAKE} -B -f- all <<EOMAKE 1271.9Slukem.include <bsd.own.mk> 1281.33Sjmc.if (\${MKMAN} == "no" || empty(MANINSTALL:Mmaninstall)) 1291.33SjmcMKMANPAGES=no 1301.33Sjmc.else 1311.33SjmcMKMANPAGES=yes 1321.33Sjmc.endif 1331.72Smrg.if \${MKX11} != "no" 1341.72Smrg. if \${X11FLAVOUR} == "Xorg" 1351.72SmrgMKXORG:=yes 1361.72SmrgMKX11:=no 1371.72Smrg. else 1381.72SmrgMKXORG:=no 1391.72Smrg. endif 1401.72Smrg.endif 1411.9Slukemall: 1421.11Slukem.for i in MACHINE MACHINE_ARCH MACHINE_CPU \ 1431.87Sskrll HAVE_BINUTILS HAVE_GCC HAVE_GDB OBJECT_FMT TOOLCHAIN_MISSING \ 1441.94Suebayasi \${_MKVARS.yes} \${_MKVARS.no} 1451.12Slukem @echo "export \$i=\${\$i}" 1461.11Slukem.endfor 1471.9Slukem 1481.12SlukemEOMAKE 1491.9Slukem); do 1501.11Slukem# echo 1>&2 "DEBUG: read $x" 1511.9Slukem eval $x 1521.9Slukemdone 1531.9SlukemIFS=$oIFS 1541.9Slukem 1551.34Serhsetsdir=${0%/*} 1561.9Slukemobsolete=0 1571.76Stsutsuimodule=yes 1581.91Sdyoungif [ "${MKKMOD}" = "no" ]; then 1591.91Sdyoung module=no # MODULEs are off. 1601.91Sdyoungelif [ "${MACHINE}" = "evbppc" ]; then 1611.76Stsutsui module=no # Turn off MODULEs for some ports. 1621.9Slukemfi 1631.31Sjmc# Determine lib type. Do this first so stlib also gets set. 1641.31Sjmcif [ "${OBJECT_FMT}" = "ELF" ]; then 1651.9Slukem shlib=elf 1661.9Slukemelse 1671.9Slukem shlib=aout 1681.9Slukemfi 1691.9Slukemstlib=$shlib 1701.31Sjmc# Now check for MKPIC or specials and turn off shlib if need be. 1711.31Sjmcif [ "${MKPIC}" = "no" ]; then 1721.31Sjmc shlib=no 1731.31Sjmcfi 1741.29Suweif [ "${MACHINE_ARCH}" = "m68000" ]; then 1751.9Slukem shlib=no # Turn off shlibs for some ports. 1761.9Slukemfi 1771.86Sjnemethif [ "$module" != "no" ]; then 1781.86Sjnemeth nlists="base comp etc games man misc modules tests text" 1791.86Sjnemethelse 1801.86Sjnemeth nlists="base comp etc games man misc tests text" 1811.86Sjnemethfi 1821.86Sjnemethxlists="xbase xcomp xetc xfont xserver" 1831.92Suebayasiextlists="extbase extcomp extetc" 1841.9Slukem 1851.64SheOSRELEASE=`${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh` 1861.81SrmindMODULEDIR="stand/${MACHINE}/${OSRELEASE}/modules" 1871.62SadSUBST="s#@MODULEDIR@#${MODULEDIR}#g" 1881.62SadSUBST="${SUBST};s#@OSRELEASE@#${OSRELEASE}#g" 1891.62SadSUBST="${SUBST};s#@MACHINE@#${MACHINE}#g" 1901.60Sad 1911.9Slukem# 1921.9Slukem# list_set_files setfile [...] 1931.1Sdyoung# 1941.9Slukem# Produce a packing list for setfile(s). 1951.9Slukem# In each file, a record consists of a path and a System Package name, 1961.9Slukem# separated by whitespace. E.g., 1971.9Slukem# 1981.94Suebayasi# # $NetBSD: sets.subr,v 1.94 2009/12/02 14:13:12 uebayasi Exp $ 1991.9Slukem# . base-sys-root [keyword[,...]] 2001.9Slukem# ./altroot base-sys-root 2011.9Slukem# ./bin base-sys-root 2021.9Slukem# ./bin/[ base-util-root 2031.9Slukem# ./bin/cat base-util-root 2041.9Slukem# [...] 2051.9Slukem# 2061.9Slukem# A # in the first column marks a comment. 2071.9Slukem# 2081.9Slukem# If ${obsolete} != 0, only entries with an "obsolete" keyword will 2091.52Slukem# be printed. All other keywords must be present. 2101.9Slukem# 2111.9Slukem# The third field is an optional comma separated list of keywords to 2121.9Slukem# control if a record is printed; every keyword listed must be enabled 2131.9Slukem# for the record to be printed. The following keywords are available: 2141.9Slukem# dummy dummy entry (ignored) 2151.13Slukem# obsolete file is obsolete, and only printed if 2161.13Slukem# ${obsolete} != 0 2171.13Slukem# 2181.87Sskrll# bfd obsolete, use binutils. 2191.87Sskrll# binutils ${MKBINUTILS} != no 2201.22Slukem# catpages ${MKCATPAGES} != no 2211.71Smrg# compat ${MKCOMPAT} != no 2221.22Slukem# crypto ${MKCRYPTO} != no 2231.22Slukem# crypto_idea ${MKCRYPTO_IDEA} != no 2241.22Slukem# crypto_mdc2 ${MKCRYPTO_MDC2} != no 2251.22Slukem# crypto_rc5 ${MKCRYPTO_RC5} != no 2261.22Slukem# cvs ${MKCVS} != no 2271.53Slukem# debug ${MKDEBUG} != no 2281.69Slukem# debuglib ${MKDEBUGLIB} != no 2291.23Slukem# doc ${MKDOC} != no 2301.67Slukem# dynamicroot ${MKDYNAMICROOT} != no 2311.92Suebayasi# extsrc ${MKEXTSRC} != no 2321.52Slukem# gcc ${MKGCC} != no 2331.36Smatt# gcccmds ${MKGCCCMDS} != no 2341.32Sscw# gdb ${MKGDB} != no 2351.22Slukem# hesiod ${MKHESIOD} != no 2361.68Slukem# html ${MKHTML} != no 2371.67Slukem# inet6 ${MKINET6} != no 2381.23Slukem# info ${MKINFO} != no 2391.39Speter# ipfilter ${MKIPFILTER} != no 2401.51Smrg# iscsi ${MKISCSI} != no 2411.22Slukem# kerberos ${MKKERBEROS} != no 2421.85Sdyoung# kmod ${MKKMOD} != no 2431.67Slukem# ldap ${MKLDAP} != no 2441.22Slukem# lint ${MKLINT} != no 2451.78Sagc# lvm ${MKLVM} != no 2461.22Slukem# man ${MKMAN} != no 2471.67Slukem# manpages ${MKMANPAGES} != no 2481.22Slukem# manz ${MKMANZ} != no 2491.88Stsarna# mdns ${MKMDNS} != no 2501.23Slukem# nls ${MKNLS} != no 2511.66Sdyoung# nvi ${MKNVI} != no 2521.37She# pam ${MKPAM} != no 2531.39Speter# pf ${MKPF} != no 2541.67Slukem# pic ${MKPIC} != no 2551.22Slukem# postfix ${MKPOSTFIX} != no 2561.22Slukem# profile ${MKPROFILE} != no 2571.24Slukem# share ${MKSHARE} != no 2581.22Slukem# skey ${MKSKEY} != no 2591.73Smrg# x11 ${MKX11} != no && ${X11FLAVOUR} != "Xorg" 2601.73Smrg# xorg ${MKX11} != no && ${X11FLAVOUR} == "Xorg" 2611.22Slukem# yp ${MKYP} != no 2621.89Shaad# zfs ${MKZFS} != no 2631.22Slukem# 2641.87Sskrll# binutils=<n> <n> = value of ${HAVE_BINUTILS} 2651.52Slukem# gcc=<n> <n> = value of ${HAVE_GCC} 2661.52Slukem# gdb=<n> <n> = value of ${HAVE_GDB} 2671.52Slukem# 2681.41Slukem# use_inet6 ${USE_INET6} != no 2691.41Slukem# use_kerberos ${USE_KERBEROS} != no 2701.41Slukem# use_yp ${USE_YP} != no 2711.41Slukem# 2721.22Slukem# .cat if ${MKMANZ} != "no" && ${MKCATPAGES} != "no" 2731.22Slukem# automatically append ".gz" to the filename 2741.22Slukem# 2751.22Slukem# .man if ${MKMANZ} != "no" && ${MKMAN} != "no" 2761.22Slukem# automatically append ".gz" to the filename 2771.1Sdyoung# 2781.8Slukemlist_set_files() 2791.8Slukem{ 2801.83Sapb if [ ${MAKEVERBOSE:-2} -lt 3 ]; then 2811.65She verbose=false 2821.65She else 2831.65She verbose=true 2841.65She fi 2851.1Sdyoung for setname; do 2861.65She list=`list_set_lists $setname` 2871.65She for l in $list; do 2881.65She echo $l 2891.65She if $verbose; then 2901.82Sapb echo >&2 "DEBUG: list_set_files: $l" 2911.65She fi 2921.65She done 2931.62Sad done | xargs cat | ${SED} ${SUBST} | \ 2941.43Sapb ${AWK} -v obsolete=${obsolete} ' 2951.9Slukem BEGIN { 2961.52Slukem if (obsolete) 2971.52Slukem wanted["obsolete"] = 1 2981.52Slukem 2991.52Slukem split("'"${MKVARS}"'", needvars) 3001.52Slukem for (vi in needvars) { 3011.52Slukem nv = needvars[vi] 3021.52Slukem kw = tolower(nv) 3031.52Slukem sub(/^mk/, "", kw) 3041.52Slukem if (ENVIRON[nv] != "no") 3051.52Slukem wanted[kw] = 1 3061.52Slukem } 3071.52Slukem 3081.52Slukem if ("'"${TOOLCHAIN_MISSING}"'" != "yes") { 3091.90Sdyoung if ("binutils" in wanted) 3101.90Sdyoung wanted["binutils=" "'"${HAVE_BINUTILS}"'"] = 1 3111.90Sdyoung if ("gcc" in wanted) 3121.90Sdyoung wanted["gcc=" "'"${HAVE_GCC}"'"] = 1 3131.90Sdyoung if ("gdb" in wanted) 3141.90Sdyoung wanted["gdb=" "'"${HAVE_GDB}"'"] = 1 3151.9Slukem } 3161.52Slukem if (("man" in wanted) && ("catpages" in wanted)) 3171.52Slukem wanted[".cat"] = 1 3181.52Slukem if (("man" in wanted) && ("manpages" in wanted)) 3191.52Slukem wanted[".man"] = 1 3201.9Slukem } 3211.9Slukem 3221.9Slukem /^#/ { 3231.9Slukem next; 3241.9Slukem } 3251.9Slukem 3261.9Slukem NF > 2 && $3 != "-" { 3271.9Slukem split($3, keywords, ",") 3281.9Slukem show = 1 3291.52Slukem haveobs = 0 3301.9Slukem for (ki in keywords) { 3311.9Slukem kw = keywords[ki] 3321.22Slukem if (("manz" in wanted) && 3331.22Slukem (kw == ".cat" || kw == ".man")) 3341.22Slukem $1 = $1 ".gz" 3351.59Sjmmv negated = match(kw, "! *") 3361.59Sjmmv if (negated > 0) { 3371.59Sjmmv kw = substr(kw, RSTART + RLENGTH) 3381.59Sjmmv if (kw in wanted) 3391.59Sjmmv show = 0 3401.59Sjmmv } else { 3411.59Sjmmv if (! (kw in wanted)) 3421.59Sjmmv show = 0 3431.59Sjmmv } 3441.52Slukem if (kw == "obsolete") 3451.52Slukem haveobs = 1 3461.9Slukem } 3471.52Slukem if (obsolete && ! haveobs) 3481.52Slukem next 3491.9Slukem if (show) 3501.9Slukem print 3511.9Slukem next 3521.9Slukem } 3531.9Slukem 3541.9Slukem { 3551.9Slukem if (! obsolete) 3561.9Slukem print 3571.9Slukem }' 3581.9Slukem 3591.1Sdyoung} 3601.1Sdyoung 3611.1Sdyoung# 3621.1Sdyoung# list_set_lists setname 3631.1Sdyoung# 3641.1Sdyoung# Print to stdout a list of files, one filename per line, which 3651.1Sdyoung# concatenate to create the packing list for setname. E.g., 3661.1Sdyoung# 3671.1Sdyoung# .../lists/base/mi 3681.1Sdyoung# .../lists/base/rescue.mi 3691.1Sdyoung# .../lists/base/md.i386 3701.9Slukem# [...] 3711.1Sdyoung# 3721.9Slukem# For a given setname $set, the following files may be selected from 3731.9Slukem# .../list/$set: 3741.9Slukem# mi 3751.92Suebayasi# mi.ext.* 3761.11Slukem# ad.${MACHINE_ARCH} 3771.11Slukem# (or) ad.${MACHINE_CPU} 3781.11Slukem# ad.${MACHINE_CPU}.shl 3791.11Slukem# md.${MACHINE}.${MACHINE_ARCH} 3801.11Slukem# (or) md.${MACHINE} 3811.9Slukem# stl.mi 3821.92Suebayasi# stl.${stlib} 3831.9Slukem# shl.mi 3841.92Suebayasi# shl.mi.ext.* 3851.92Suebayasi# shl.${shlib} 3861.92Suebayasi# shl.${shlib}.ext.* 3871.77Stsutsui# module.mi if ${module} != no 3881.77Stsutsui# module.${MACHINE} if ${module} != no 3891.77Stsutsui# module.ad.${MACHINE_ARCH} if ${module} != no 3901.77Stsutsui# (or) module.ad.${MACHINE_CPU} if ${module} != no 3911.9Slukem# rescue.shl 3921.11Slukem# rescue.${MACHINE} 3931.11Slukem# rescue.ad.${MACHINE_ARCH} 3941.11Slukem# (or) rescue.ad.${MACHINE_CPU} 3951.11Slukem# rescue.ad.${MACHINE_CPU}.shl 3961.1Sdyoung# 3971.9Slukem# Environment: 3981.1Sdyoung# shlib 3991.1Sdyoung# stlib 4001.1Sdyoung# 4011.8Slukemlist_set_lists() 4021.8Slukem{ 4031.1Sdyoung setname=$1 4041.1Sdyoung 4051.9Slukem setdir=$setsdir/lists/$setname 4061.9Slukem echo $setdir/mi 4071.92Suebayasi for _extsrc_pkg in ${EXTSRCS}; do 4081.92Suebayasi if [ -f $setdir/mi.ext.${_extsrc_pkg} ]; then 4091.92Suebayasi echo $setdir/mi.ext.${_extsrc_pkg} 4101.92Suebayasi fi 4111.92Suebayasi done 4121.11Slukem if [ "${MACHINE}" != "${MACHINE_ARCH}" ]; then 4131.11Slukem # Prefer an ad.${MACHINE_ARCH} over an ad.${MACHINE_CPU}, 4141.1Sdyoung # since the arch-specific one will be more specific than 4151.1Sdyoung # the cpu-specific one. 4161.11Slukem if [ -f $setdir/ad.${MACHINE_ARCH} ]; then 4171.11Slukem echo $setdir/ad.${MACHINE_ARCH} 4181.11Slukem elif [ -f $setdir/ad.${MACHINE_CPU} ]; then 4191.11Slukem echo $setdir/ad.${MACHINE_CPU} 4201.1Sdyoung fi 4211.1Sdyoung if [ "$shlib" != "no" -a \ 4221.11Slukem -f $setdir/ad.${MACHINE_CPU}.shl ]; then 4231.11Slukem echo $setdir/ad.${MACHINE_CPU}.shl 4241.1Sdyoung fi 4251.1Sdyoung fi 4261.11Slukem if [ -f $setdir/md.${MACHINE}.${MACHINE_ARCH} ]; then 4271.11Slukem echo $setdir/md.${MACHINE}.${MACHINE_ARCH} 4281.11Slukem elif [ -f $setdir/md.${MACHINE} ]; then 4291.11Slukem echo $setdir/md.${MACHINE} 4301.1Sdyoung fi 4311.9Slukem if [ -f $setdir/stl.mi ]; then 4321.9Slukem echo $setdir/stl.mi 4331.1Sdyoung fi 4341.9Slukem if [ -f $setdir/stl.${stlib} ]; then 4351.9Slukem echo $setdir/stl.${stlib} 4361.1Sdyoung fi 4371.1Sdyoung if [ "$shlib" != "no" ]; then 4381.9Slukem if [ -f $setdir/shl.mi ]; then 4391.9Slukem echo $setdir/shl.mi 4401.7Sdyoung fi 4411.92Suebayasi for _extsrc_pkg in ${EXTSRCS}; do 4421.92Suebayasi if [ -f $setdir/shl.mi.ext.${_extsrc_pkg} ]; then 4431.92Suebayasi echo $setdir/shl.mi.ext.${_extsrc_pkg} 4441.92Suebayasi fi 4451.92Suebayasi done 4461.9Slukem if [ -f $setdir/shl.${shlib} ]; then 4471.9Slukem echo $setdir/shl.${shlib} 4481.7Sdyoung fi 4491.92Suebayasi for _extsrc_pkg in ${EXTSRCS}; do 4501.92Suebayasi if [ -f $setdir/shl.${shlib}.ext.${_extsrc_pkg} ]; then 4511.92Suebayasi echo $setdir/shl.${shlib}.ext.${_extsrc_pkg} 4521.92Suebayasi fi 4531.92Suebayasi done 4541.1Sdyoung fi 4551.76Stsutsui if [ "$module" != "no" ]; then 4561.76Stsutsui if [ -f $setdir/module.mi ]; then 4571.76Stsutsui echo $setdir/module.mi 4581.1Sdyoung fi 4591.77Stsutsui if [ -f $setdir/module.${MACHINE} ]; then 4601.77Stsutsui echo $setdir/module.${MACHINE} 4611.77Stsutsui fi 4621.77Stsutsui if [ "${MACHINE}" != "${MACHINE_ARCH}" ]; then 4631.77Stsutsui # Prefer a module.ad.${MACHINE_ARCH} over a 4641.77Stsutsui # module.ad.${MACHINE_CPU}, since the arch- 4651.77Stsutsui # specific one will be more specific than the 4661.77Stsutsui # cpu-specific one. 4671.77Stsutsui if [ -f $setdir/module.ad.${MACHINE_ARCH} ]; then 4681.77Stsutsui echo $setdir/module.ad.${MACHINE_ARCH} 4691.77Stsutsui elif [ -f $setdir/module.ad.${MACHINE_CPU} ]; then 4701.77Stsutsui echo $setdir/module.ad.${MACHINE_CPU} 4711.77Stsutsui fi 4721.77Stsutsui fi 4731.1Sdyoung fi 4741.1Sdyoung 4751.9Slukem if [ -f $setdir/rescue.mi ]; then 4761.9Slukem echo $setdir/rescue.mi 4771.1Sdyoung fi 4781.11Slukem if [ -f $setdir/rescue.${MACHINE} ]; then 4791.11Slukem echo $setdir/rescue.${MACHINE} 4801.1Sdyoung fi 4811.11Slukem if [ "${MACHINE}" != "${MACHINE_ARCH}" ]; then 4821.11Slukem # Prefer a rescue.ad.${MACHINE_ARCH} over a 4831.11Slukem # rescue.ad.${MACHINE_CPU}, since the arch- 4841.1Sdyoung # specific one will be more specific than the 4851.1Sdyoung # cpu-specific one. 4861.11Slukem if [ -f $setdir/rescue.ad.${MACHINE_ARCH} ]; then 4871.11Slukem echo $setdir/rescue.ad.${MACHINE_ARCH} 4881.11Slukem elif [ -f $setdir/rescue.ad.${MACHINE_CPU} ]; then 4891.11Slukem echo $setdir/rescue.ad.${MACHINE_CPU} 4901.1Sdyoung fi 4911.10Sjmc if [ "$shlib" != "no" -a \ 4921.11Slukem -f $setdir/rescue.ad.${MACHINE_CPU}.shl ]; then 4931.11Slukem echo $setdir/rescue.ad.${MACHINE_CPU}.shl 4941.10Sjmc fi 4951.1Sdyoung fi 4961.5Sdyoung} 4971.5Sdyoung 4981.9Slukem# arch_to_cpu mach 4991.9Slukem# 5001.11Slukem# Print the ${MACHINE_CPU} for ${MACHINE_ARCH}=mach, 5011.9Slukem# as determined by <bsd.own.mk>. 5021.9Slukem# 5031.8Slukemarch_to_cpu() 5041.8Slukem{ 5051.56Sapb MACHINE_ARCH=${1} ${MAKE} -B -f- all <<EOMAKE 5061.5Sdyoung.include <bsd.own.mk> 5071.5Sdyoungall: 5081.5Sdyoung @echo \${MACHINE_CPU} 5091.12SlukemEOMAKE 5101.1Sdyoung} 5111.46Sapb 5121.46Sapb# arch_to_endian mach 5131.46Sapb# 5141.46Sapb# Print the ${TARGET_ENDIANNESS} for ${MACHINE_ARCH}=mach, 5151.46Sapb# as determined by <bsd.endian.mk>. 5161.46Sapb# 5171.46Sapbarch_to_endian() 5181.46Sapb{ 5191.56Sapb MACHINE_ARCH=${1} ${MAKE} -B -f- all <<EOMAKE 5201.46Sapb.include <bsd.endian.mk> 5211.46Sapball: 5221.46Sapb @echo \${TARGET_ENDIANNESS} 5231.46SapbEOMAKE 5241.46Sapb} 525