sets.subr revision 1.87
11.87Sskrll# $NetBSD: sets.subr,v 1.87 2009/09/08 07:08:00 skrll 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.23Slukem MKNLS \ 571.66Sdyoung MKNVI \ 581.37She MKPAM \ 591.39Speter MKPF \ 601.30Smatt MKPIC \ 611.22Slukem MKPOSTFIX \ 621.22Slukem MKPROFILE \ 631.24Slukem MKSHARE \ 641.22Slukem MKSKEY \ 651.40Stron MKX11 \ 661.84Smrg MKX11FONTS \ 671.68Slukem MKXORG \ 681.22Slukem MKYP \ 691.41Slukem USE_INET6 \ 701.41Slukem USE_KERBEROS \ 711.63Slukem USE_LDAP \ 721.41Slukem USE_YP \ 731.64She NETBSDSRCDIR \ 741.65She MAKEVERBOSE \ 751.22Slukem" 761.42Sapb# 771.42Sapb# The following variables refer to tools that are used when building sets: 781.42Sapb# 791.43Sapb: ${AWK:=awk} 801.42Sapb: ${CKSUM:=cksum} 811.43Sapb: ${COMM:=comm} 821.44Sapb: ${DATE:=date} 831.43Sapb: ${DB:=db} 841.43Sapb: ${EGREP:=egrep} 851.43Sapb: ${ENV_CMD:=env} # ${ENV} is special to sh(1), ksh(1), etc. 861.44Sapb: ${FGREP:=fgrep} 871.43Sapb: ${FIND:=find} 881.44Sapb: ${GREP:=grep} 891.43Sapb: ${GZIP_CMD:=gzip} # ${GZIP} is special to gzip(1) 901.44Sapb: ${HOSTNAME:=hostname} 911.42Sapb: ${HOST_SH:=sh} 921.43Sapb: ${IDENT:=ident} 931.43Sapb: ${JOIN:=join} 941.43Sapb: ${LS:=ls} 951.43Sapb: ${MAKE:=make} 961.42Sapb: ${MKTEMP:=mktemp} 971.43Sapb: ${MTREE:=mtree} 981.43Sapb: ${PASTE:=paste} 991.42Sapb: ${PAX:=pax} 1001.43Sapb: ${PKG_CREATE:=pkg_create} 1011.43Sapb: ${PRINTF:=printf} 1021.43Sapb: ${SED:=sed} 1031.43Sapb: ${SORT:=sort} 1041.44Sapb: ${STAT:=stat} 1051.44Sapb: ${TSORT:=tsort} 1061.43Sapb: ${UNAME:=uname} 1071.43Sapb: ${WC:=wc} 1081.43Sapb 1091.45Sapb# 1101.45Sapb# If printf is a shell builtin command, then we can 1111.45Sapb# implement cheaper versions of basename and dirname 1121.45Sapb# that do not involve any fork/exec overhead. 1131.45Sapb# If printf is not builtin, approximate it using echo, 1141.45Sapb# and hope there are no weird file names that cause 1151.45Sapb# some versions of echo to do the wrong thing. 1161.45Sapb# (Converting to this version of dirname speeded up the 1171.45Sapb# syspkgdeps script by an order of magnitude, from 68 1181.45Sapb# seconds to 6.3 seconds on one particular host.) 1191.45Sapb# 1201.45Sapb# Note that naive approximations for dirname 1211.45Sapb# using ${foo%/*} do not do the right thing in cases 1221.45Sapb# where the result should be "/" or ".". 1231.45Sapb# 1241.45Sapbcase "$(type printf)" in 1251.45Sapb*builtin*) 1261.45Sapb basename () 1271.45Sapb { 1281.45Sapb local bn 1291.45Sapb bn="${1##*/}" 1301.45Sapb bn="${bn%$2}" 1311.45Sapb printf "%s\n" "$bn" 1321.45Sapb } 1331.45Sapb dirname () 1341.45Sapb { 1351.45Sapb local dn 1361.45Sapb case "$1" in 1371.45Sapb ?*/*) dn="${1%/*}" ;; 1381.45Sapb /*) dn=/ ;; 1391.45Sapb *) dn=. ;; 1401.45Sapb esac 1411.45Sapb printf "%s\n" "$dn" 1421.45Sapb } 1431.45Sapb ;; 1441.45Sapb*) 1451.45Sapb basename () 1461.45Sapb { 1471.45Sapb local bn 1481.45Sapb bn="${1##*/}" 1491.45Sapb bn="${bn%$2}" 1501.45Sapb echo "$bn" 1511.45Sapb } 1521.45Sapb dirname () 1531.45Sapb { 1541.45Sapb local dn 1551.45Sapb case "$1" in 1561.45Sapb ?*/*) dn="${1%/*}" ;; 1571.45Sapb /*) dn=/ ;; 1581.45Sapb *) dn=. ;; 1591.45Sapb esac 1601.45Sapb echo "$dn" 1611.45Sapb } 1621.45Sapb ;; 1631.45Sapbesac 1641.45Sapb 1651.9SlukemoIFS=$IFS 1661.9SlukemIFS=" 1671.9Slukem" 1681.9Slukemfor x in $( 1691.43Sapb${MAKE} -B -f- all <<EOMAKE 1701.9Slukem.include <bsd.own.mk> 1711.33Sjmc.if (\${MKMAN} == "no" || empty(MANINSTALL:Mmaninstall)) 1721.33SjmcMKMANPAGES=no 1731.33Sjmc.else 1741.33SjmcMKMANPAGES=yes 1751.33Sjmc.endif 1761.72Smrg.if \${MKX11} != "no" 1771.72Smrg. if \${X11FLAVOUR} == "Xorg" 1781.72SmrgMKXORG:=yes 1791.72SmrgMKX11:=no 1801.72Smrg. else 1811.72SmrgMKXORG:=no 1821.72Smrg. endif 1831.72Smrg.endif 1841.9Slukemall: 1851.11Slukem.for i in MACHINE MACHINE_ARCH MACHINE_CPU \ 1861.87Sskrll HAVE_BINUTILS HAVE_GCC HAVE_GDB OBJECT_FMT TOOLCHAIN_MISSING \ 1871.12Slukem ${MKVARS} 1881.12Slukem @echo "export \$i=\${\$i}" 1891.11Slukem.endfor 1901.9Slukem 1911.12SlukemEOMAKE 1921.9Slukem); do 1931.11Slukem# echo 1>&2 "DEBUG: read $x" 1941.9Slukem eval $x 1951.9Slukemdone 1961.9SlukemIFS=$oIFS 1971.9Slukem 1981.34Serhsetsdir=${0%/*} 1991.9Slukemobsolete=0 2001.76Stsutsuimodule=yes 2011.11Slukemif [ "${MACHINE}" = "evbppc" ]; then 2021.76Stsutsui module=no # Turn off MODULEs for some ports. 2031.9Slukemfi 2041.31Sjmc# Determine lib type. Do this first so stlib also gets set. 2051.31Sjmcif [ "${OBJECT_FMT}" = "ELF" ]; then 2061.9Slukem shlib=elf 2071.9Slukemelse 2081.9Slukem shlib=aout 2091.9Slukemfi 2101.9Slukemstlib=$shlib 2111.31Sjmc# Now check for MKPIC or specials and turn off shlib if need be. 2121.31Sjmcif [ "${MKPIC}" = "no" ]; then 2131.31Sjmc shlib=no 2141.31Sjmcfi 2151.29Suweif [ "${MACHINE_ARCH}" = "m68000" ]; then 2161.9Slukem shlib=no # Turn off shlibs for some ports. 2171.9Slukemfi 2181.86Sjnemethif [ "$module" != "no" ]; then 2191.86Sjnemeth nlists="base comp etc games man misc modules tests text" 2201.86Sjnemethelse 2211.86Sjnemeth nlists="base comp etc games man misc tests text" 2221.86Sjnemethfi 2231.86Sjnemethxlists="xbase xcomp xetc xfont xserver" 2241.9Slukem 2251.64SheOSRELEASE=`${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh` 2261.81SrmindMODULEDIR="stand/${MACHINE}/${OSRELEASE}/modules" 2271.62SadSUBST="s#@MODULEDIR@#${MODULEDIR}#g" 2281.62SadSUBST="${SUBST};s#@OSRELEASE@#${OSRELEASE}#g" 2291.62SadSUBST="${SUBST};s#@MACHINE@#${MACHINE}#g" 2301.60Sad 2311.9Slukem# 2321.9Slukem# list_set_files setfile [...] 2331.1Sdyoung# 2341.9Slukem# Produce a packing list for setfile(s). 2351.9Slukem# In each file, a record consists of a path and a System Package name, 2361.9Slukem# separated by whitespace. E.g., 2371.9Slukem# 2381.87Sskrll# # $NetBSD: sets.subr,v 1.87 2009/09/08 07:08:00 skrll Exp $ 2391.9Slukem# . base-sys-root [keyword[,...]] 2401.9Slukem# ./altroot base-sys-root 2411.9Slukem# ./bin base-sys-root 2421.9Slukem# ./bin/[ base-util-root 2431.9Slukem# ./bin/cat base-util-root 2441.9Slukem# [...] 2451.9Slukem# 2461.9Slukem# A # in the first column marks a comment. 2471.9Slukem# 2481.9Slukem# If ${obsolete} != 0, only entries with an "obsolete" keyword will 2491.52Slukem# be printed. All other keywords must be present. 2501.9Slukem# 2511.9Slukem# The third field is an optional comma separated list of keywords to 2521.9Slukem# control if a record is printed; every keyword listed must be enabled 2531.9Slukem# for the record to be printed. The following keywords are available: 2541.9Slukem# dummy dummy entry (ignored) 2551.13Slukem# obsolete file is obsolete, and only printed if 2561.13Slukem# ${obsolete} != 0 2571.13Slukem# 2581.87Sskrll# bfd obsolete, use binutils. 2591.87Sskrll# binutils ${MKBINUTILS} != no 2601.22Slukem# catpages ${MKCATPAGES} != no 2611.71Smrg# compat ${MKCOMPAT} != no 2621.22Slukem# crypto ${MKCRYPTO} != no 2631.22Slukem# crypto_idea ${MKCRYPTO_IDEA} != no 2641.22Slukem# crypto_mdc2 ${MKCRYPTO_MDC2} != no 2651.22Slukem# crypto_rc5 ${MKCRYPTO_RC5} != no 2661.22Slukem# cvs ${MKCVS} != no 2671.53Slukem# debug ${MKDEBUG} != no 2681.69Slukem# debuglib ${MKDEBUGLIB} != no 2691.23Slukem# doc ${MKDOC} != no 2701.67Slukem# dynamicroot ${MKDYNAMICROOT} != no 2711.52Slukem# gcc ${MKGCC} != no 2721.36Smatt# gcccmds ${MKGCCCMDS} != no 2731.32Sscw# gdb ${MKGDB} != no 2741.22Slukem# hesiod ${MKHESIOD} != no 2751.68Slukem# html ${MKHTML} != no 2761.67Slukem# inet6 ${MKINET6} != no 2771.23Slukem# info ${MKINFO} != no 2781.39Speter# ipfilter ${MKIPFILTER} != no 2791.51Smrg# iscsi ${MKISCSI} != no 2801.22Slukem# kerberos ${MKKERBEROS} != no 2811.85Sdyoung# kmod ${MKKMOD} != no 2821.67Slukem# ldap ${MKLDAP} != no 2831.22Slukem# lint ${MKLINT} != no 2841.78Sagc# lvm ${MKLVM} != no 2851.22Slukem# man ${MKMAN} != no 2861.67Slukem# manpages ${MKMANPAGES} != no 2871.22Slukem# manz ${MKMANZ} != no 2881.23Slukem# nls ${MKNLS} != no 2891.66Sdyoung# nvi ${MKNVI} != no 2901.37She# pam ${MKPAM} != no 2911.39Speter# pf ${MKPF} != no 2921.67Slukem# pic ${MKPIC} != no 2931.22Slukem# postfix ${MKPOSTFIX} != no 2941.22Slukem# profile ${MKPROFILE} != no 2951.24Slukem# share ${MKSHARE} != no 2961.22Slukem# skey ${MKSKEY} != no 2971.73Smrg# x11 ${MKX11} != no && ${X11FLAVOUR} != "Xorg" 2981.73Smrg# xorg ${MKX11} != no && ${X11FLAVOUR} == "Xorg" 2991.22Slukem# yp ${MKYP} != no 3001.22Slukem# 3011.87Sskrll# binutils=<n> <n> = value of ${HAVE_BINUTILS} 3021.52Slukem# gcc=<n> <n> = value of ${HAVE_GCC} 3031.52Slukem# gdb=<n> <n> = value of ${HAVE_GDB} 3041.52Slukem# 3051.41Slukem# use_inet6 ${USE_INET6} != no 3061.41Slukem# use_kerberos ${USE_KERBEROS} != no 3071.41Slukem# use_yp ${USE_YP} != no 3081.41Slukem# 3091.22Slukem# .cat if ${MKMANZ} != "no" && ${MKCATPAGES} != "no" 3101.22Slukem# automatically append ".gz" to the filename 3111.22Slukem# 3121.22Slukem# .man if ${MKMANZ} != "no" && ${MKMAN} != "no" 3131.22Slukem# automatically append ".gz" to the filename 3141.1Sdyoung# 3151.8Slukemlist_set_files() 3161.8Slukem{ 3171.83Sapb if [ ${MAKEVERBOSE:-2} -lt 3 ]; then 3181.65She verbose=false 3191.65She else 3201.65She verbose=true 3211.65She fi 3221.1Sdyoung for setname; do 3231.65She list=`list_set_lists $setname` 3241.65She for l in $list; do 3251.65She echo $l 3261.65She if $verbose; then 3271.82Sapb echo >&2 "DEBUG: list_set_files: $l" 3281.65She fi 3291.65She done 3301.62Sad done | xargs cat | ${SED} ${SUBST} | \ 3311.43Sapb ${AWK} -v obsolete=${obsolete} ' 3321.9Slukem BEGIN { 3331.52Slukem if (obsolete) 3341.52Slukem wanted["obsolete"] = 1 3351.52Slukem 3361.52Slukem split("'"${MKVARS}"'", needvars) 3371.52Slukem for (vi in needvars) { 3381.52Slukem nv = needvars[vi] 3391.52Slukem kw = tolower(nv) 3401.52Slukem sub(/^mk/, "", kw) 3411.52Slukem if (ENVIRON[nv] != "no") 3421.52Slukem wanted[kw] = 1 3431.52Slukem } 3441.52Slukem 3451.52Slukem if ("'"${TOOLCHAIN_MISSING}"'" != "yes") { 3461.87Sskrll wanted["binutils=" "'"${HAVE_BINUTILS}"'"] = 1 3471.52Slukem wanted["gcc=" "'"${HAVE_GCC}"'"] = 1 3481.52Slukem wanted["gdb=" "'"${HAVE_GDB}"'"] = 1 3491.9Slukem } 3501.52Slukem if (("man" in wanted) && ("catpages" in wanted)) 3511.52Slukem wanted[".cat"] = 1 3521.52Slukem if (("man" in wanted) && ("manpages" in wanted)) 3531.52Slukem wanted[".man"] = 1 3541.9Slukem } 3551.9Slukem 3561.9Slukem /^#/ { 3571.9Slukem next; 3581.9Slukem } 3591.9Slukem 3601.9Slukem NF > 2 && $3 != "-" { 3611.9Slukem split($3, keywords, ",") 3621.9Slukem show = 1 3631.52Slukem haveobs = 0 3641.9Slukem for (ki in keywords) { 3651.9Slukem kw = keywords[ki] 3661.22Slukem if (("manz" in wanted) && 3671.22Slukem (kw == ".cat" || kw == ".man")) 3681.22Slukem $1 = $1 ".gz" 3691.59Sjmmv negated = match(kw, "! *") 3701.59Sjmmv if (negated > 0) { 3711.59Sjmmv kw = substr(kw, RSTART + RLENGTH) 3721.59Sjmmv if (kw in wanted) 3731.59Sjmmv show = 0 3741.59Sjmmv } else { 3751.59Sjmmv if (! (kw in wanted)) 3761.59Sjmmv show = 0 3771.59Sjmmv } 3781.52Slukem if (kw == "obsolete") 3791.52Slukem haveobs = 1 3801.9Slukem } 3811.52Slukem if (obsolete && ! haveobs) 3821.52Slukem next 3831.9Slukem if (show) 3841.9Slukem print 3851.9Slukem next 3861.9Slukem } 3871.9Slukem 3881.9Slukem { 3891.9Slukem if (! obsolete) 3901.9Slukem print 3911.9Slukem }' 3921.9Slukem 3931.1Sdyoung} 3941.1Sdyoung 3951.1Sdyoung# 3961.1Sdyoung# list_set_lists setname 3971.1Sdyoung# 3981.1Sdyoung# Print to stdout a list of files, one filename per line, which 3991.1Sdyoung# concatenate to create the packing list for setname. E.g., 4001.1Sdyoung# 4011.1Sdyoung# .../lists/base/mi 4021.1Sdyoung# .../lists/base/rescue.mi 4031.1Sdyoung# .../lists/base/md.i386 4041.9Slukem# [...] 4051.1Sdyoung# 4061.9Slukem# For a given setname $set, the following files may be selected from 4071.9Slukem# .../list/$set: 4081.9Slukem# mi 4091.11Slukem# ad.${MACHINE_ARCH} 4101.11Slukem# (or) ad.${MACHINE_CPU} 4111.11Slukem# ad.${MACHINE_CPU}.shl 4121.11Slukem# md.${MACHINE}.${MACHINE_ARCH} 4131.11Slukem# (or) md.${MACHINE} 4141.9Slukem# stl.mi 4151.9Slukem# stl.stlib 4161.9Slukem# shl.mi 4171.9Slukem# shl.shlib 4181.77Stsutsui# module.mi if ${module} != no 4191.77Stsutsui# module.${MACHINE} if ${module} != no 4201.77Stsutsui# module.ad.${MACHINE_ARCH} if ${module} != no 4211.77Stsutsui# (or) module.ad.${MACHINE_CPU} if ${module} != no 4221.9Slukem# rescue.shl 4231.11Slukem# rescue.${MACHINE} 4241.11Slukem# rescue.ad.${MACHINE_ARCH} 4251.11Slukem# (or) rescue.ad.${MACHINE_CPU} 4261.11Slukem# rescue.ad.${MACHINE_CPU}.shl 4271.1Sdyoung# 4281.9Slukem# Environment: 4291.1Sdyoung# shlib 4301.1Sdyoung# stlib 4311.1Sdyoung# 4321.8Slukemlist_set_lists() 4331.8Slukem{ 4341.1Sdyoung setname=$1 4351.1Sdyoung 4361.9Slukem setdir=$setsdir/lists/$setname 4371.9Slukem echo $setdir/mi 4381.11Slukem if [ "${MACHINE}" != "${MACHINE_ARCH}" ]; then 4391.11Slukem # Prefer an ad.${MACHINE_ARCH} over an ad.${MACHINE_CPU}, 4401.1Sdyoung # since the arch-specific one will be more specific than 4411.1Sdyoung # the cpu-specific one. 4421.11Slukem if [ -f $setdir/ad.${MACHINE_ARCH} ]; then 4431.11Slukem echo $setdir/ad.${MACHINE_ARCH} 4441.11Slukem elif [ -f $setdir/ad.${MACHINE_CPU} ]; then 4451.11Slukem echo $setdir/ad.${MACHINE_CPU} 4461.1Sdyoung fi 4471.1Sdyoung if [ "$shlib" != "no" -a \ 4481.11Slukem -f $setdir/ad.${MACHINE_CPU}.shl ]; then 4491.11Slukem echo $setdir/ad.${MACHINE_CPU}.shl 4501.1Sdyoung fi 4511.1Sdyoung fi 4521.11Slukem if [ -f $setdir/md.${MACHINE}.${MACHINE_ARCH} ]; then 4531.11Slukem echo $setdir/md.${MACHINE}.${MACHINE_ARCH} 4541.11Slukem elif [ -f $setdir/md.${MACHINE} ]; then 4551.11Slukem echo $setdir/md.${MACHINE} 4561.1Sdyoung fi 4571.9Slukem if [ -f $setdir/stl.mi ]; then 4581.9Slukem echo $setdir/stl.mi 4591.1Sdyoung fi 4601.9Slukem if [ -f $setdir/stl.${stlib} ]; then 4611.9Slukem echo $setdir/stl.${stlib} 4621.1Sdyoung fi 4631.1Sdyoung if [ "$shlib" != "no" ]; then 4641.9Slukem if [ -f $setdir/shl.mi ]; then 4651.9Slukem echo $setdir/shl.mi 4661.7Sdyoung fi 4671.9Slukem if [ -f $setdir/shl.${shlib} ]; then 4681.9Slukem echo $setdir/shl.${shlib} 4691.7Sdyoung fi 4701.1Sdyoung fi 4711.76Stsutsui if [ "$module" != "no" ]; then 4721.76Stsutsui if [ -f $setdir/module.mi ]; then 4731.76Stsutsui echo $setdir/module.mi 4741.1Sdyoung fi 4751.77Stsutsui if [ -f $setdir/module.${MACHINE} ]; then 4761.77Stsutsui echo $setdir/module.${MACHINE} 4771.77Stsutsui fi 4781.77Stsutsui if [ "${MACHINE}" != "${MACHINE_ARCH}" ]; then 4791.77Stsutsui # Prefer a module.ad.${MACHINE_ARCH} over a 4801.77Stsutsui # module.ad.${MACHINE_CPU}, since the arch- 4811.77Stsutsui # specific one will be more specific than the 4821.77Stsutsui # cpu-specific one. 4831.77Stsutsui if [ -f $setdir/module.ad.${MACHINE_ARCH} ]; then 4841.77Stsutsui echo $setdir/module.ad.${MACHINE_ARCH} 4851.77Stsutsui elif [ -f $setdir/module.ad.${MACHINE_CPU} ]; then 4861.77Stsutsui echo $setdir/module.ad.${MACHINE_CPU} 4871.77Stsutsui fi 4881.77Stsutsui fi 4891.1Sdyoung fi 4901.1Sdyoung 4911.9Slukem if [ -f $setdir/rescue.mi ]; then 4921.9Slukem echo $setdir/rescue.mi 4931.1Sdyoung fi 4941.11Slukem if [ -f $setdir/rescue.${MACHINE} ]; then 4951.11Slukem echo $setdir/rescue.${MACHINE} 4961.1Sdyoung fi 4971.11Slukem if [ "${MACHINE}" != "${MACHINE_ARCH}" ]; then 4981.11Slukem # Prefer a rescue.ad.${MACHINE_ARCH} over a 4991.11Slukem # rescue.ad.${MACHINE_CPU}, since the arch- 5001.1Sdyoung # specific one will be more specific than the 5011.1Sdyoung # cpu-specific one. 5021.11Slukem if [ -f $setdir/rescue.ad.${MACHINE_ARCH} ]; then 5031.11Slukem echo $setdir/rescue.ad.${MACHINE_ARCH} 5041.11Slukem elif [ -f $setdir/rescue.ad.${MACHINE_CPU} ]; then 5051.11Slukem echo $setdir/rescue.ad.${MACHINE_CPU} 5061.1Sdyoung fi 5071.10Sjmc if [ "$shlib" != "no" -a \ 5081.11Slukem -f $setdir/rescue.ad.${MACHINE_CPU}.shl ]; then 5091.11Slukem echo $setdir/rescue.ad.${MACHINE_CPU}.shl 5101.10Sjmc fi 5111.1Sdyoung fi 5121.5Sdyoung} 5131.5Sdyoung 5141.9Slukem# arch_to_cpu mach 5151.9Slukem# 5161.11Slukem# Print the ${MACHINE_CPU} for ${MACHINE_ARCH}=mach, 5171.9Slukem# as determined by <bsd.own.mk>. 5181.9Slukem# 5191.8Slukemarch_to_cpu() 5201.8Slukem{ 5211.56Sapb MACHINE_ARCH=${1} ${MAKE} -B -f- all <<EOMAKE 5221.5Sdyoung.include <bsd.own.mk> 5231.5Sdyoungall: 5241.5Sdyoung @echo \${MACHINE_CPU} 5251.12SlukemEOMAKE 5261.1Sdyoung} 5271.46Sapb 5281.46Sapb# arch_to_endian mach 5291.46Sapb# 5301.46Sapb# Print the ${TARGET_ENDIANNESS} for ${MACHINE_ARCH}=mach, 5311.46Sapb# as determined by <bsd.endian.mk>. 5321.46Sapb# 5331.46Sapbarch_to_endian() 5341.46Sapb{ 5351.56Sapb MACHINE_ARCH=${1} ${MAKE} -B -f- all <<EOMAKE 5361.46Sapb.include <bsd.endian.mk> 5371.46Sapball: 5381.46Sapb @echo \${TARGET_ENDIANNESS} 5391.46SapbEOMAKE 5401.46Sapb} 541