sets.subr revision 1.112
11.110Suebayasi# $NetBSD: sets.subr,v 1.112 2009/12/11 13:10:47 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.42Sapb# 281.42Sapb# The following variables refer to tools that are used when building sets: 291.42Sapb# 301.43Sapb: ${AWK:=awk} 311.42Sapb: ${CKSUM:=cksum} 321.43Sapb: ${COMM:=comm} 331.44Sapb: ${DATE:=date} 341.43Sapb: ${DB:=db} 351.43Sapb: ${EGREP:=egrep} 361.43Sapb: ${ENV_CMD:=env} # ${ENV} is special to sh(1), ksh(1), etc. 371.44Sapb: ${FGREP:=fgrep} 381.43Sapb: ${FIND:=find} 391.44Sapb: ${GREP:=grep} 401.43Sapb: ${GZIP_CMD:=gzip} # ${GZIP} is special to gzip(1) 411.99Sapb: ${HOSTNAME_CMD:=hostname} # ${HOSTNAME} is special to bash(1) 421.42Sapb: ${HOST_SH:=sh} 431.43Sapb: ${IDENT:=ident} 441.43Sapb: ${JOIN:=join} 451.43Sapb: ${LS:=ls} 461.43Sapb: ${MAKE:=make} 471.42Sapb: ${MKTEMP:=mktemp} 481.43Sapb: ${MTREE:=mtree} 491.43Sapb: ${PASTE:=paste} 501.42Sapb: ${PAX:=pax} 511.43Sapb: ${PRINTF:=printf} 521.43Sapb: ${SED:=sed} 531.43Sapb: ${SORT:=sort} 541.44Sapb: ${STAT:=stat} 551.44Sapb: ${TSORT:=tsort} 561.43Sapb: ${UNAME:=uname} 571.43Sapb: ${WC:=wc} 581.43Sapb 591.45Sapb# 601.45Sapb# If printf is a shell builtin command, then we can 611.45Sapb# implement cheaper versions of basename and dirname 621.45Sapb# that do not involve any fork/exec overhead. 631.45Sapb# If printf is not builtin, approximate it using echo, 641.45Sapb# and hope there are no weird file names that cause 651.45Sapb# some versions of echo to do the wrong thing. 661.45Sapb# (Converting to this version of dirname speeded up the 671.45Sapb# syspkgdeps script by an order of magnitude, from 68 681.45Sapb# seconds to 6.3 seconds on one particular host.) 691.45Sapb# 701.45Sapb# Note that naive approximations for dirname 711.45Sapb# using ${foo%/*} do not do the right thing in cases 721.45Sapb# where the result should be "/" or ".". 731.45Sapb# 741.45Sapbcase "$(type printf)" in 751.45Sapb*builtin*) 761.45Sapb basename () 771.45Sapb { 781.45Sapb local bn 791.45Sapb bn="${1##*/}" 801.45Sapb bn="${bn%$2}" 811.45Sapb printf "%s\n" "$bn" 821.45Sapb } 831.45Sapb dirname () 841.45Sapb { 851.45Sapb local dn 861.45Sapb case "$1" in 871.45Sapb ?*/*) dn="${1%/*}" ;; 881.45Sapb /*) dn=/ ;; 891.45Sapb *) dn=. ;; 901.45Sapb esac 911.45Sapb printf "%s\n" "$dn" 921.45Sapb } 931.45Sapb ;; 941.45Sapb*) 951.45Sapb basename () 961.45Sapb { 971.45Sapb local bn 981.45Sapb bn="${1##*/}" 991.45Sapb bn="${bn%$2}" 1001.45Sapb echo "$bn" 1011.45Sapb } 1021.45Sapb dirname () 1031.45Sapb { 1041.45Sapb local dn 1051.45Sapb case "$1" in 1061.45Sapb ?*/*) dn="${1%/*}" ;; 1071.45Sapb /*) dn=/ ;; 1081.45Sapb *) dn=. ;; 1091.45Sapb esac 1101.45Sapb echo "$dn" 1111.45Sapb } 1121.45Sapb ;; 1131.45Sapbesac 1141.45Sapb 1151.108Suebayasi##### 1161.108Suebayasi 1171.9SlukemoIFS=$IFS 1181.9SlukemIFS=" 1191.9Slukem" 1201.100Suebayasi 1211.109Shefor x in $( ${MAKE} -B -f ${rundir}/mkvars.mk mkvars ); do 1221.108Suebayasi eval export $x 1231.9Slukemdone 1241.100Suebayasi 1251.9SlukemIFS=$oIFS 1261.9Slukem 1271.109SheMKVARS="$( ${MAKE} -B -f ${rundir}/mkvars.mk mkvars | sed -e 's,=.*,,' | xargs )" 1281.100Suebayasi 1291.105Suebayasiif [ "$SETS_SUBR_DEBUG" = "dumpmkvars" ]; then 1301.105Suebayasi for v in $MKVARS; do 1311.105Suebayasi eval echo $v=\$$v 1321.105Suebayasi done 1331.105Suebayasi exit 0 1341.105Suebayasifi 1351.105Suebayasi 1361.105Suebayasi##### 1371.105Suebayasi 1381.34Serhsetsdir=${0%/*} 1391.9Slukemobsolete=0 1401.76Stsutsuimodule=yes 1411.91Sdyoungif [ "${MKKMOD}" = "no" ]; then 1421.91Sdyoung module=no # MODULEs are off. 1431.91Sdyoungelif [ "${MACHINE}" = "evbppc" ]; then 1441.76Stsutsui module=no # Turn off MODULEs for some ports. 1451.9Slukemfi 1461.31Sjmc# Determine lib type. Do this first so stlib also gets set. 1471.31Sjmcif [ "${OBJECT_FMT}" = "ELF" ]; then 1481.9Slukem shlib=elf 1491.9Slukemelse 1501.9Slukem shlib=aout 1511.9Slukemfi 1521.9Slukemstlib=$shlib 1531.31Sjmc# Now check for MKPIC or specials and turn off shlib if need be. 1541.31Sjmcif [ "${MKPIC}" = "no" ]; then 1551.31Sjmc shlib=no 1561.31Sjmcfi 1571.29Suweif [ "${MACHINE_ARCH}" = "m68000" ]; then 1581.9Slukem shlib=no # Turn off shlibs for some ports. 1591.9Slukemfi 1601.86Sjnemethif [ "$module" != "no" ]; then 1611.86Sjnemeth nlists="base comp etc games man misc modules tests text" 1621.86Sjnemethelse 1631.86Sjnemeth nlists="base comp etc games man misc tests text" 1641.86Sjnemethfi 1651.86Sjnemethxlists="xbase xcomp xetc xfont xserver" 1661.92Suebayasiextlists="extbase extcomp extetc" 1671.9Slukem 1681.64SheOSRELEASE=`${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh` 1691.81SrmindMODULEDIR="stand/${MACHINE}/${OSRELEASE}/modules" 1701.62SadSUBST="s#@MODULEDIR@#${MODULEDIR}#g" 1711.62SadSUBST="${SUBST};s#@OSRELEASE@#${OSRELEASE}#g" 1721.62SadSUBST="${SUBST};s#@MACHINE@#${MACHINE}#g" 1731.60Sad 1741.9Slukem# 1751.9Slukem# list_set_files setfile [...] 1761.1Sdyoung# 1771.9Slukem# Produce a packing list for setfile(s). 1781.9Slukem# In each file, a record consists of a path and a System Package name, 1791.9Slukem# separated by whitespace. E.g., 1801.9Slukem# 1811.110Suebayasi# # $NetBSD: sets.subr,v 1.112 2009/12/11 13:10:47 uebayasi Exp $ 1821.9Slukem# . base-sys-root [keyword[,...]] 1831.9Slukem# ./altroot base-sys-root 1841.9Slukem# ./bin base-sys-root 1851.9Slukem# ./bin/[ base-util-root 1861.9Slukem# ./bin/cat base-util-root 1871.9Slukem# [...] 1881.9Slukem# 1891.9Slukem# A # in the first column marks a comment. 1901.9Slukem# 1911.9Slukem# If ${obsolete} != 0, only entries with an "obsolete" keyword will 1921.52Slukem# be printed. All other keywords must be present. 1931.9Slukem# 1941.9Slukem# The third field is an optional comma separated list of keywords to 1951.9Slukem# control if a record is printed; every keyword listed must be enabled 1961.9Slukem# for the record to be printed. The following keywords are available: 1971.9Slukem# dummy dummy entry (ignored) 1981.13Slukem# obsolete file is obsolete, and only printed if 1991.13Slukem# ${obsolete} != 0 2001.13Slukem# 2011.87Sskrll# bfd obsolete, use binutils. 2021.87Sskrll# binutils ${MKBINUTILS} != no 2031.22Slukem# catpages ${MKCATPAGES} != no 2041.71Smrg# compat ${MKCOMPAT} != no 2051.22Slukem# crypto ${MKCRYPTO} != no 2061.22Slukem# crypto_idea ${MKCRYPTO_IDEA} != no 2071.22Slukem# crypto_mdc2 ${MKCRYPTO_MDC2} != no 2081.22Slukem# crypto_rc5 ${MKCRYPTO_RC5} != no 2091.22Slukem# cvs ${MKCVS} != no 2101.53Slukem# debug ${MKDEBUG} != no 2111.69Slukem# debuglib ${MKDEBUGLIB} != no 2121.23Slukem# doc ${MKDOC} != no 2131.67Slukem# dynamicroot ${MKDYNAMICROOT} != no 2141.92Suebayasi# extsrc ${MKEXTSRC} != no 2151.52Slukem# gcc ${MKGCC} != no 2161.36Smatt# gcccmds ${MKGCCCMDS} != no 2171.32Sscw# gdb ${MKGDB} != no 2181.22Slukem# hesiod ${MKHESIOD} != no 2191.68Slukem# html ${MKHTML} != no 2201.67Slukem# inet6 ${MKINET6} != no 2211.23Slukem# info ${MKINFO} != no 2221.39Speter# ipfilter ${MKIPFILTER} != no 2231.51Smrg# iscsi ${MKISCSI} != no 2241.22Slukem# kerberos ${MKKERBEROS} != no 2251.85Sdyoung# kmod ${MKKMOD} != no 2261.67Slukem# ldap ${MKLDAP} != no 2271.22Slukem# lint ${MKLINT} != no 2281.78Sagc# lvm ${MKLVM} != no 2291.22Slukem# man ${MKMAN} != no 2301.67Slukem# manpages ${MKMANPAGES} != no 2311.22Slukem# manz ${MKMANZ} != no 2321.88Stsarna# mdns ${MKMDNS} != no 2331.23Slukem# nls ${MKNLS} != no 2341.66Sdyoung# nvi ${MKNVI} != no 2351.37She# pam ${MKPAM} != no 2361.39Speter# pf ${MKPF} != no 2371.67Slukem# pic ${MKPIC} != no 2381.22Slukem# postfix ${MKPOSTFIX} != no 2391.22Slukem# profile ${MKPROFILE} != no 2401.24Slukem# share ${MKSHARE} != no 2411.22Slukem# skey ${MKSKEY} != no 2421.73Smrg# x11 ${MKX11} != no && ${X11FLAVOUR} != "Xorg" 2431.73Smrg# xorg ${MKX11} != no && ${X11FLAVOUR} == "Xorg" 2441.22Slukem# yp ${MKYP} != no 2451.89Shaad# zfs ${MKZFS} != no 2461.22Slukem# 2471.87Sskrll# binutils=<n> <n> = value of ${HAVE_BINUTILS} 2481.52Slukem# gcc=<n> <n> = value of ${HAVE_GCC} 2491.52Slukem# gdb=<n> <n> = value of ${HAVE_GDB} 2501.52Slukem# 2511.41Slukem# use_inet6 ${USE_INET6} != no 2521.41Slukem# use_kerberos ${USE_KERBEROS} != no 2531.41Slukem# use_yp ${USE_YP} != no 2541.41Slukem# 2551.22Slukem# .cat if ${MKMANZ} != "no" && ${MKCATPAGES} != "no" 2561.22Slukem# automatically append ".gz" to the filename 2571.22Slukem# 2581.22Slukem# .man if ${MKMANZ} != "no" && ${MKMAN} != "no" 2591.22Slukem# automatically append ".gz" to the filename 2601.1Sdyoung# 2611.8Slukemlist_set_files() 2621.8Slukem{ 2631.83Sapb if [ ${MAKEVERBOSE:-2} -lt 3 ]; then 2641.65She verbose=false 2651.65She else 2661.65She verbose=true 2671.65She fi 2681.1Sdyoung for setname; do 2691.65She list=`list_set_lists $setname` 2701.65She for l in $list; do 2711.65She echo $l 2721.65She if $verbose; then 2731.82Sapb echo >&2 "DEBUG: list_set_files: $l" 2741.65She fi 2751.65She done 2761.62Sad done | xargs cat | ${SED} ${SUBST} | \ 2771.43Sapb ${AWK} -v obsolete=${obsolete} ' 2781.9Slukem BEGIN { 2791.52Slukem if (obsolete) 2801.52Slukem wanted["obsolete"] = 1 2811.52Slukem 2821.100Suebayasi split("'"${MKVARS}"'", needvars) 2831.52Slukem for (vi in needvars) { 2841.52Slukem nv = needvars[vi] 2851.52Slukem kw = tolower(nv) 2861.52Slukem sub(/^mk/, "", kw) 2871.52Slukem if (ENVIRON[nv] != "no") 2881.52Slukem wanted[kw] = 1 2891.52Slukem } 2901.52Slukem 2911.52Slukem if ("'"${TOOLCHAIN_MISSING}"'" != "yes") { 2921.90Sdyoung if ("binutils" in wanted) 2931.90Sdyoung wanted["binutils=" "'"${HAVE_BINUTILS}"'"] = 1 2941.90Sdyoung if ("gcc" in wanted) 2951.90Sdyoung wanted["gcc=" "'"${HAVE_GCC}"'"] = 1 2961.90Sdyoung if ("gdb" in wanted) 2971.90Sdyoung wanted["gdb=" "'"${HAVE_GDB}"'"] = 1 2981.9Slukem } 2991.52Slukem if (("man" in wanted) && ("catpages" in wanted)) 3001.52Slukem wanted[".cat"] = 1 3011.52Slukem if (("man" in wanted) && ("manpages" in wanted)) 3021.52Slukem wanted[".man"] = 1 3031.9Slukem } 3041.9Slukem 3051.9Slukem /^#/ { 3061.9Slukem next; 3071.9Slukem } 3081.9Slukem 3091.9Slukem NF > 2 && $3 != "-" { 3101.9Slukem split($3, keywords, ",") 3111.9Slukem show = 1 3121.52Slukem haveobs = 0 3131.9Slukem for (ki in keywords) { 3141.9Slukem kw = keywords[ki] 3151.22Slukem if (("manz" in wanted) && 3161.22Slukem (kw == ".cat" || kw == ".man")) 3171.22Slukem $1 = $1 ".gz" 3181.59Sjmmv negated = match(kw, "! *") 3191.59Sjmmv if (negated > 0) { 3201.59Sjmmv kw = substr(kw, RSTART + RLENGTH) 3211.59Sjmmv if (kw in wanted) 3221.59Sjmmv show = 0 3231.59Sjmmv } else { 3241.59Sjmmv if (! (kw in wanted)) 3251.59Sjmmv show = 0 3261.59Sjmmv } 3271.52Slukem if (kw == "obsolete") 3281.52Slukem haveobs = 1 3291.9Slukem } 3301.52Slukem if (obsolete && ! haveobs) 3311.52Slukem next 3321.9Slukem if (show) 3331.9Slukem print 3341.9Slukem next 3351.9Slukem } 3361.9Slukem 3371.9Slukem { 3381.9Slukem if (! obsolete) 3391.9Slukem print 3401.9Slukem }' 3411.9Slukem 3421.1Sdyoung} 3431.1Sdyoung 3441.1Sdyoung# 3451.1Sdyoung# list_set_lists setname 3461.1Sdyoung# 3471.1Sdyoung# Print to stdout a list of files, one filename per line, which 3481.1Sdyoung# concatenate to create the packing list for setname. E.g., 3491.1Sdyoung# 3501.1Sdyoung# .../lists/base/mi 3511.1Sdyoung# .../lists/base/rescue.mi 3521.1Sdyoung# .../lists/base/md.i386 3531.9Slukem# [...] 3541.1Sdyoung# 3551.9Slukem# For a given setname $set, the following files may be selected from 3561.9Slukem# .../list/$set: 3571.9Slukem# mi 3581.92Suebayasi# mi.ext.* 3591.11Slukem# ad.${MACHINE_ARCH} 3601.11Slukem# (or) ad.${MACHINE_CPU} 3611.11Slukem# ad.${MACHINE_CPU}.shl 3621.11Slukem# md.${MACHINE}.${MACHINE_ARCH} 3631.11Slukem# (or) md.${MACHINE} 3641.9Slukem# stl.mi 3651.92Suebayasi# stl.${stlib} 3661.9Slukem# shl.mi 3671.92Suebayasi# shl.mi.ext.* 3681.92Suebayasi# shl.${shlib} 3691.92Suebayasi# shl.${shlib}.ext.* 3701.77Stsutsui# module.mi if ${module} != no 3711.77Stsutsui# module.${MACHINE} if ${module} != no 3721.77Stsutsui# module.ad.${MACHINE_ARCH} if ${module} != no 3731.77Stsutsui# (or) module.ad.${MACHINE_CPU} if ${module} != no 3741.9Slukem# rescue.shl 3751.11Slukem# rescue.${MACHINE} 3761.11Slukem# rescue.ad.${MACHINE_ARCH} 3771.11Slukem# (or) rescue.ad.${MACHINE_CPU} 3781.11Slukem# rescue.ad.${MACHINE_CPU}.shl 3791.1Sdyoung# 3801.9Slukem# Environment: 3811.1Sdyoung# shlib 3821.1Sdyoung# stlib 3831.1Sdyoung# 3841.8Slukemlist_set_lists() 3851.8Slukem{ 3861.1Sdyoung setname=$1 3871.1Sdyoung 3881.111Suebayasi list_set_lists_mi $setname 3891.111Suebayasi if [ "${MACHINE}" != "${MACHINE_ARCH}" ]; then 3901.111Suebayasi list_set_lists_ad $setname 3911.111Suebayasi fi 3921.111Suebayasi list_set_lists_md $setname 3931.111Suebayasi list_set_lists_stl $setname 3941.111Suebayasi if [ "$shlib" != "no" ]; then 3951.111Suebayasi list_set_lists_shl $setname 3961.111Suebayasi fi 3971.111Suebayasi if [ "$module" != "no" ]; then 3981.111Suebayasi list_set_lists_module $setname 3991.111Suebayasi fi 4001.111Suebayasi list_set_lists_rescue $setname 4011.111Suebayasi if [ "${MACHINE}" != "${MACHINE_ARCH}" ]; then 4021.111Suebayasi list_set_lists_rescue_ad $setname 4031.111Suebayasi fi 4041.111Suebayasi} 4051.110Suebayasi 4061.111Suebayasilist_set_lists_mi() 4071.111Suebayasi{ 4081.111Suebayasi setdir=$setsdir/lists/$1 4091.9Slukem echo $setdir/mi 4101.111Suebayasi} 4111.110Suebayasi 4121.111Suebayasilist_set_lists_ad() 4131.111Suebayasi{ 4141.111Suebayasi setdir=$setsdir/lists/$1 4151.112Suebayasi # Prefer an ad.${MACHINE_ARCH} over an ad.${MACHINE_CPU}, 4161.112Suebayasi # since the arch-specific one will be more specific than 4171.112Suebayasi # the cpu-specific one. 4181.112Suebayasi echo_if_exist $setdir/ad.${MACHINE_ARCH} || \ 4191.112Suebayasi echo_if_exist $setdir/ad.${MACHINE_CPU} 4201.112Suebayasi if [ "$shlib" != "no" ]; then 4211.112Suebayasi echo_if_exist $setdir/ad.${MACHINE_CPU}.shl 4221.112Suebayasi fi 4231.111Suebayasi} 4241.110Suebayasi 4251.111Suebayasilist_set_lists_md() 4261.111Suebayasi{ 4271.111Suebayasi setdir=$setsdir/lists/$1 4281.110Suebayasi echo_if_exist $setdir/md.${MACHINE}.${MACHINE_ARCH} || \ 4291.110Suebayasi echo_if_exist $setdir/md.${MACHINE} 4301.111Suebayasi} 4311.110Suebayasi 4321.111Suebayasilist_set_lists_stl() 4331.111Suebayasi{ 4341.111Suebayasi setdir=$setsdir/lists/$1 4351.110Suebayasi echo_if_exist $setdir/stl.mi 4361.110Suebayasi echo_if_exist $setdir/stl.${stlib} 4371.111Suebayasi} 4381.110Suebayasi 4391.111Suebayasilist_set_lists_shl() 4401.111Suebayasi{ 4411.111Suebayasi setdir=$setsdir/lists/$1 4421.112Suebayasi echo_if_exist $setdir/shl.mi 4431.112Suebayasi echo_if_exist $setdir/shl.${shlib} 4441.111Suebayasi} 4451.110Suebayasi 4461.111Suebayasilist_set_lists_module() 4471.111Suebayasi{ 4481.111Suebayasi setdir=$setsdir/lists/$1 4491.112Suebayasi echo_if_exist $setdir/module.mi 4501.112Suebayasi echo_if_exist $setdir/module.${MACHINE} 4511.112Suebayasi if [ "${MACHINE}" != "${MACHINE_ARCH}" ]; then 4521.112Suebayasi # Prefer a module.ad.${MACHINE_ARCH} over a 4531.112Suebayasi # module.ad.${MACHINE_CPU}, since the arch- 4541.112Suebayasi # specific one will be more specific than the 4551.112Suebayasi # cpu-specific one. 4561.112Suebayasi echo_if_exist $setdir/module.ad.${MACHINE_ARCH} || \ 4571.112Suebayasi echo_if_exist $setdir/module.ad.${MACHINE_CPU} 4581.112Suebayasi fi 4591.111Suebayasi} 4601.1Sdyoung 4611.111Suebayasilist_set_lists_rescue() 4621.111Suebayasi{ 4631.111Suebayasi setdir=$setsdir/lists/$1 4641.110Suebayasi echo_if_exist $setdir/rescue.mi 4651.110Suebayasi echo_if_exist $setdir/rescue.${MACHINE} 4661.111Suebayasi} 4671.111Suebayasi 4681.111Suebayasilist_set_lists_rescue_ad() 4691.111Suebayasi{ 4701.111Suebayasi setdir=$setsdir/lists/$1 4711.112Suebayasi # Prefer a rescue.ad.${MACHINE_ARCH} over a 4721.112Suebayasi # rescue.ad.${MACHINE_CPU}, since the arch- 4731.112Suebayasi # specific one will be more specific than the 4741.112Suebayasi # cpu-specific one. 4751.112Suebayasi echo_if_exist $setdir/rescue.ad.${MACHINE_ARCH} || \ 4761.112Suebayasi echo_if_exist $setdir/rescue.ad.${MACHINE_CPU} 4771.112Suebayasi if [ "$shlib" != "no" ]; then 4781.112Suebayasi echo_if_exist $setdir/rescue.ad.${MACHINE_CPU}.shl 4791.112Suebayasi fi 4801.5Sdyoung} 4811.5Sdyoung 4821.110Suebayasiecho_if_exist() 4831.110Suebayasi{ 4841.110Suebayasi [ -f $1 ] && echo $1 4851.110Suebayasi return $? 4861.110Suebayasi} 4871.110Suebayasi 4881.110Suebayasiecho_if_exist_foreach() 4891.110Suebayasi{ 4901.110Suebayasi local _list=$1; shift 4911.110Suebayasi for _suffix in $@; do 4921.110Suebayasi echo_if_exist ${_list}.${_suffix} 4931.110Suebayasi done 4941.110Suebayasi} 4951.110Suebayasi 4961.9Slukem# arch_to_cpu mach 4971.9Slukem# 4981.11Slukem# Print the ${MACHINE_CPU} for ${MACHINE_ARCH}=mach, 4991.9Slukem# as determined by <bsd.own.mk>. 5001.9Slukem# 5011.8Slukemarch_to_cpu() 5021.8Slukem{ 5031.56Sapb MACHINE_ARCH=${1} ${MAKE} -B -f- all <<EOMAKE 5041.5Sdyoung.include <bsd.own.mk> 5051.5Sdyoungall: 5061.5Sdyoung @echo \${MACHINE_CPU} 5071.12SlukemEOMAKE 5081.1Sdyoung} 5091.46Sapb 5101.46Sapb# arch_to_endian mach 5111.46Sapb# 5121.46Sapb# Print the ${TARGET_ENDIANNESS} for ${MACHINE_ARCH}=mach, 5131.46Sapb# as determined by <bsd.endian.mk>. 5141.46Sapb# 5151.46Sapbarch_to_endian() 5161.46Sapb{ 5171.56Sapb MACHINE_ARCH=${1} ${MAKE} -B -f- all <<EOMAKE 5181.46Sapb.include <bsd.endian.mk> 5191.46Sapball: 5201.46Sapb @echo \${TARGET_ENDIANNESS} 5211.46SapbEOMAKE 5221.46Sapb} 523