sets.subr revision 1.133
11.133Sjmcneill# $NetBSD: sets.subr,v 1.133 2011/10/22 00:05:17 jmcneill 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.126She# HAS_SSP 231.11Slukem# TOOLCHAIN_MISSING 241.11Slukem# OBJECT_FMT 251.22Slukem# as well as: 261.22Slukem# 271.95Suebayasi 281.42Sapb# 291.42Sapb# The following variables refer to tools that are used when building sets: 301.42Sapb# 311.43Sapb: ${AWK:=awk} 321.42Sapb: ${CKSUM:=cksum} 331.43Sapb: ${COMM:=comm} 341.44Sapb: ${DATE:=date} 351.43Sapb: ${DB:=db} 361.43Sapb: ${EGREP:=egrep} 371.43Sapb: ${ENV_CMD:=env} # ${ENV} is special to sh(1), ksh(1), etc. 381.44Sapb: ${FGREP:=fgrep} 391.43Sapb: ${FIND:=find} 401.44Sapb: ${GREP:=grep} 411.43Sapb: ${GZIP_CMD:=gzip} # ${GZIP} is special to gzip(1) 421.99Sapb: ${HOSTNAME_CMD:=hostname} # ${HOSTNAME} is special to bash(1) 431.42Sapb: ${HOST_SH:=sh} 441.43Sapb: ${IDENT:=ident} 451.43Sapb: ${JOIN:=join} 461.43Sapb: ${LS:=ls} 471.43Sapb: ${MAKE:=make} 481.42Sapb: ${MKTEMP:=mktemp} 491.43Sapb: ${MTREE:=mtree} 501.43Sapb: ${PASTE:=paste} 511.42Sapb: ${PAX:=pax} 521.43Sapb: ${PRINTF:=printf} 531.43Sapb: ${SED:=sed} 541.43Sapb: ${SORT:=sort} 551.44Sapb: ${STAT:=stat} 561.44Sapb: ${TSORT:=tsort} 571.43Sapb: ${UNAME:=uname} 581.43Sapb: ${WC:=wc} 591.118Suebayasi: ${XARGS:=xargs} 601.43Sapb 611.45Sapb# 621.45Sapb# If printf is a shell builtin command, then we can 631.45Sapb# implement cheaper versions of basename and dirname 641.45Sapb# that do not involve any fork/exec overhead. 651.45Sapb# If printf is not builtin, approximate it using echo, 661.45Sapb# and hope there are no weird file names that cause 671.45Sapb# some versions of echo to do the wrong thing. 681.45Sapb# (Converting to this version of dirname speeded up the 691.45Sapb# syspkgdeps script by an order of magnitude, from 68 701.45Sapb# seconds to 6.3 seconds on one particular host.) 711.45Sapb# 721.45Sapb# Note that naive approximations for dirname 731.45Sapb# using ${foo%/*} do not do the right thing in cases 741.45Sapb# where the result should be "/" or ".". 751.45Sapb# 761.45Sapbcase "$(type printf)" in 771.45Sapb*builtin*) 781.45Sapb basename () 791.45Sapb { 801.45Sapb local bn 811.45Sapb bn="${1##*/}" 821.45Sapb bn="${bn%$2}" 831.45Sapb printf "%s\n" "$bn" 841.45Sapb } 851.45Sapb dirname () 861.45Sapb { 871.45Sapb local dn 881.45Sapb case "$1" in 891.45Sapb ?*/*) dn="${1%/*}" ;; 901.45Sapb /*) dn=/ ;; 911.45Sapb *) dn=. ;; 921.45Sapb esac 931.45Sapb printf "%s\n" "$dn" 941.45Sapb } 951.45Sapb ;; 961.45Sapb*) 971.45Sapb basename () 981.45Sapb { 991.45Sapb local bn 1001.45Sapb bn="${1##*/}" 1011.45Sapb bn="${bn%$2}" 1021.45Sapb echo "$bn" 1031.45Sapb } 1041.45Sapb dirname () 1051.45Sapb { 1061.45Sapb local dn 1071.45Sapb case "$1" in 1081.45Sapb ?*/*) dn="${1%/*}" ;; 1091.45Sapb /*) dn=/ ;; 1101.45Sapb *) dn=. ;; 1111.45Sapb esac 1121.45Sapb echo "$dn" 1131.45Sapb } 1141.45Sapb ;; 1151.45Sapbesac 1161.45Sapb 1171.108Suebayasi##### 1181.108Suebayasi 1191.9SlukemoIFS=$IFS 1201.9SlukemIFS=" 1211.9Slukem" 1221.100Suebayasi 1231.109Shefor x in $( ${MAKE} -B -f ${rundir}/mkvars.mk mkvars ); do 1241.108Suebayasi eval export $x 1251.9Slukemdone 1261.100Suebayasi 1271.9SlukemIFS=$oIFS 1281.9Slukem 1291.118SuebayasiMKVARS="$( ${MAKE} -B -f ${rundir}/mkvars.mk mkvars | ${SED} -e 's,=.*,,' | ${XARGS} )" 1301.100Suebayasi 1311.105Suebayasi##### 1321.105Suebayasi 1331.117Suebayasisetsdir=${rundir} 1341.9Slukemobsolete=0 1351.91Sdyoungif [ "${MKKMOD}" = "no" ]; then 1361.91Sdyoung module=no # MODULEs are off. 1371.125Snjoly modset="" 1381.125Snjolyelse 1391.125Snjoly module=yes 1401.125Snjoly modset="modules" 1411.125Snjolyfi 1421.125Snjolyif [ "${MKATF}" = "no" ]; then 1431.125Snjoly testset="" 1441.125Snjolyelse 1451.125Snjoly testset="tests" 1461.9Slukemfi 1471.31Sjmc# Determine lib type. Do this first so stlib also gets set. 1481.31Sjmcif [ "${OBJECT_FMT}" = "ELF" ]; then 1491.9Slukem shlib=elf 1501.9Slukemelse 1511.9Slukem shlib=aout 1521.9Slukemfi 1531.9Slukemstlib=$shlib 1541.31Sjmc# Now check for MKPIC or specials and turn off shlib if need be. 1551.31Sjmcif [ "${MKPIC}" = "no" ]; then 1561.31Sjmc shlib=no 1571.31Sjmcfi 1581.125Snjolynlists="base comp etc games man misc $modset $testset text" 1591.86Sjnemethxlists="xbase xcomp xetc xfont xserver" 1601.92Suebayasiextlists="extbase extcomp extetc" 1611.9Slukem 1621.133SjmcneillOSRELEASE=`${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh -n` 1631.133Sjmcneill# for release branches, use X.Y version, for -current use X.Y.Z 1641.133Sjmcneillif [ ! "${OSRELEASE%.99}" = "${OSRELEASE}" ]; then 1651.133Sjmcneill OSRELEASE=`${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh` 1661.133Sjmcneillfi 1671.81SrmindMODULEDIR="stand/${MACHINE}/${OSRELEASE}/modules" 1681.62SadSUBST="s#@MODULEDIR@#${MODULEDIR}#g" 1691.62SadSUBST="${SUBST};s#@OSRELEASE@#${OSRELEASE}#g" 1701.62SadSUBST="${SUBST};s#@MACHINE@#${MACHINE}#g" 1711.60Sad 1721.9Slukem# 1731.9Slukem# list_set_files setfile [...] 1741.1Sdyoung# 1751.9Slukem# Produce a packing list for setfile(s). 1761.9Slukem# In each file, a record consists of a path and a System Package name, 1771.9Slukem# separated by whitespace. E.g., 1781.9Slukem# 1791.133Sjmcneill# # $NetBSD: sets.subr,v 1.133 2011/10/22 00:05:17 jmcneill Exp $ 1801.9Slukem# . base-sys-root [keyword[,...]] 1811.9Slukem# ./altroot base-sys-root 1821.9Slukem# ./bin base-sys-root 1831.9Slukem# ./bin/[ base-util-root 1841.9Slukem# ./bin/cat base-util-root 1851.9Slukem# [...] 1861.9Slukem# 1871.9Slukem# A # in the first column marks a comment. 1881.9Slukem# 1891.9Slukem# If ${obsolete} != 0, only entries with an "obsolete" keyword will 1901.52Slukem# be printed. All other keywords must be present. 1911.9Slukem# 1921.9Slukem# The third field is an optional comma separated list of keywords to 1931.9Slukem# control if a record is printed; every keyword listed must be enabled 1941.9Slukem# for the record to be printed. The following keywords are available: 1951.9Slukem# dummy dummy entry (ignored) 1961.13Slukem# obsolete file is obsolete, and only printed if 1971.13Slukem# ${obsolete} != 0 1981.13Slukem# 1991.125Snjoly# atf ${MKATF} != no 2001.87Sskrll# bfd obsolete, use binutils. 2011.87Sskrll# binutils ${MKBINUTILS} != no 2021.129Sjoerg# bsdgrep ${MKBSDGREP} != 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.121Sdarran# dtrace ${MKDTRACE} != no 2141.67Slukem# dynamicroot ${MKDYNAMICROOT} != no 2151.92Suebayasi# extsrc ${MKEXTSRC} != no 2161.52Slukem# gcc ${MKGCC} != no 2171.36Smatt# gcccmds ${MKGCCCMDS} != no 2181.32Sscw# gdb ${MKGDB} != no 2191.22Slukem# hesiod ${MKHESIOD} != no 2201.68Slukem# html ${MKHTML} != no 2211.67Slukem# inet6 ${MKINET6} != no 2221.23Slukem# info ${MKINFO} != no 2231.39Speter# ipfilter ${MKIPFILTER} != no 2241.51Smrg# iscsi ${MKISCSI} != no 2251.22Slukem# kerberos ${MKKERBEROS} != no 2261.85Sdyoung# kmod ${MKKMOD} != no 2271.67Slukem# ldap ${MKLDAP} != no 2281.22Slukem# lint ${MKLINT} != no 2291.128Sjoerg# llvm ${MKLLVM} != no 2301.78Sagc# lvm ${MKLVM} != no 2311.22Slukem# man ${MKMAN} != no 2321.67Slukem# manpages ${MKMANPAGES} != no 2331.22Slukem# manz ${MKMANZ} != no 2341.88Stsarna# mdns ${MKMDNS} != no 2351.23Slukem# nls ${MKNLS} != no 2361.66Sdyoung# nvi ${MKNVI} != no 2371.37She# pam ${MKPAM} != no 2381.120Splunky# pcc ${MKPCC} != no 2391.39Speter# pf ${MKPF} != no 2401.67Slukem# pic ${MKPIC} != no 2411.22Slukem# postfix ${MKPOSTFIX} != no 2421.22Slukem# profile ${MKPROFILE} != no 2431.131Shaad# perfuse ${MKPERFUSE} != no 2441.24Slukem# share ${MKSHARE} != no 2451.22Slukem# skey ${MKSKEY} != no 2461.122Stron# solaris ${MKDTRACE} != no or ${MKZFS} != no 2471.126She# ssp ${HAS_SSP} != no 2481.73Smrg# x11 ${MKX11} != no && ${X11FLAVOUR} != "Xorg" 2491.73Smrg# xorg ${MKX11} != no && ${X11FLAVOUR} == "Xorg" 2501.22Slukem# yp ${MKYP} != no 2511.89Shaad# zfs ${MKZFS} != no 2521.22Slukem# 2531.87Sskrll# binutils=<n> <n> = value of ${HAVE_BINUTILS} 2541.52Slukem# gcc=<n> <n> = value of ${HAVE_GCC} 2551.52Slukem# gdb=<n> <n> = value of ${HAVE_GDB} 2561.52Slukem# 2571.41Slukem# use_inet6 ${USE_INET6} != no 2581.41Slukem# use_kerberos ${USE_KERBEROS} != no 2591.41Slukem# use_yp ${USE_YP} != no 2601.41Slukem# 2611.22Slukem# .cat if ${MKMANZ} != "no" && ${MKCATPAGES} != "no" 2621.22Slukem# automatically append ".gz" to the filename 2631.22Slukem# 2641.22Slukem# .man if ${MKMANZ} != "no" && ${MKMAN} != "no" 2651.22Slukem# automatically append ".gz" to the filename 2661.1Sdyoung# 2671.8Slukemlist_set_files() 2681.8Slukem{ 2691.83Sapb if [ ${MAKEVERBOSE:-2} -lt 3 ]; then 2701.65She verbose=false 2711.65She else 2721.65She verbose=true 2731.65She fi 2741.116Suebayasi print_set_lists "$@" | \ 2751.43Sapb ${AWK} -v obsolete=${obsolete} ' 2761.9Slukem BEGIN { 2771.52Slukem if (obsolete) 2781.52Slukem wanted["obsolete"] = 1 2791.52Slukem 2801.100Suebayasi split("'"${MKVARS}"'", needvars) 2811.52Slukem for (vi in needvars) { 2821.52Slukem nv = needvars[vi] 2831.52Slukem kw = tolower(nv) 2841.52Slukem sub(/^mk/, "", kw) 2851.126She sub(/^has_/, "", kw) 2861.52Slukem if (ENVIRON[nv] != "no") 2871.52Slukem wanted[kw] = 1 2881.52Slukem } 2891.52Slukem 2901.52Slukem if ("'"${TOOLCHAIN_MISSING}"'" != "yes") { 2911.90Sdyoung if ("binutils" in wanted) 2921.90Sdyoung wanted["binutils=" "'"${HAVE_BINUTILS}"'"] = 1 2931.90Sdyoung if ("gcc" in wanted) 2941.90Sdyoung wanted["gcc=" "'"${HAVE_GCC}"'"] = 1 2951.90Sdyoung if ("gdb" in wanted) 2961.90Sdyoung wanted["gdb=" "'"${HAVE_GDB}"'"] = 1 2971.9Slukem } 2981.52Slukem if (("man" in wanted) && ("catpages" in wanted)) 2991.52Slukem wanted[".cat"] = 1 3001.52Slukem if (("man" in wanted) && ("manpages" in wanted)) 3011.52Slukem wanted[".man"] = 1 3021.9Slukem } 3031.9Slukem 3041.9Slukem /^#/ { 3051.9Slukem next; 3061.9Slukem } 3071.9Slukem 3081.127Smatt /^-/ { 3091.127Smatt notwanted[substr($1, 2)] = 1; 3101.127Smatt delete list [substr($1, 2)]; 3111.127Smatt next; 3121.127Smatt } 3131.127Smatt 3141.127Smatt 3151.9Slukem NF > 2 && $3 != "-" { 3161.127Smatt if (notwanted[$1] != "") 3171.127Smatt next; 3181.9Slukem split($3, keywords, ",") 3191.9Slukem show = 1 3201.52Slukem haveobs = 0 3211.9Slukem for (ki in keywords) { 3221.9Slukem kw = keywords[ki] 3231.22Slukem if (("manz" in wanted) && 3241.22Slukem (kw == ".cat" || kw == ".man")) 3251.22Slukem $1 = $1 ".gz" 3261.59Sjmmv negated = match(kw, "! *") 3271.59Sjmmv if (negated > 0) { 3281.59Sjmmv kw = substr(kw, RSTART + RLENGTH) 3291.59Sjmmv if (kw in wanted) 3301.59Sjmmv show = 0 3311.59Sjmmv } else { 3321.59Sjmmv if (! (kw in wanted)) 3331.59Sjmmv show = 0 3341.59Sjmmv } 3351.52Slukem if (kw == "obsolete") 3361.52Slukem haveobs = 1 3371.9Slukem } 3381.52Slukem if (obsolete && ! haveobs) 3391.52Slukem next 3401.9Slukem if (show) 3411.127Smatt list[$1] = $0 3421.9Slukem next 3431.9Slukem } 3441.9Slukem 3451.9Slukem { 3461.127Smatt if (notwanted[$1] != "") 3471.127Smatt next; 3481.9Slukem if (! obsolete) 3491.127Smatt list[$1] = $0 3501.127Smatt } 3511.127Smatt 3521.127Smatt END { 3531.127Smatt for (i in list) { 3541.127Smatt print list[i] 3551.127Smatt } 3561.9Slukem }' 3571.9Slukem 3581.1Sdyoung} 3591.1Sdyoung 3601.1Sdyoung# 3611.1Sdyoung# list_set_lists setname 3621.1Sdyoung# 3631.1Sdyoung# Print to stdout a list of files, one filename per line, which 3641.1Sdyoung# concatenate to create the packing list for setname. E.g., 3651.1Sdyoung# 3661.1Sdyoung# .../lists/base/mi 3671.1Sdyoung# .../lists/base/rescue.mi 3681.1Sdyoung# .../lists/base/md.i386 3691.9Slukem# [...] 3701.1Sdyoung# 3711.9Slukem# For a given setname $set, the following files may be selected from 3721.9Slukem# .../list/$set: 3731.9Slukem# mi 3741.92Suebayasi# mi.ext.* 3751.11Slukem# ad.${MACHINE_ARCH} 3761.11Slukem# (or) ad.${MACHINE_CPU} 3771.11Slukem# ad.${MACHINE_CPU}.shl 3781.11Slukem# md.${MACHINE}.${MACHINE_ARCH} 3791.11Slukem# (or) md.${MACHINE} 3801.9Slukem# stl.mi 3811.92Suebayasi# stl.${stlib} 3821.9Slukem# shl.mi 3831.92Suebayasi# shl.mi.ext.* 3841.92Suebayasi# shl.${shlib} 3851.92Suebayasi# shl.${shlib}.ext.* 3861.77Stsutsui# module.mi if ${module} != no 3871.77Stsutsui# module.${MACHINE} if ${module} != no 3881.77Stsutsui# module.ad.${MACHINE_ARCH} if ${module} != no 3891.77Stsutsui# (or) module.ad.${MACHINE_CPU} if ${module} != no 3901.9Slukem# rescue.shl 3911.11Slukem# rescue.${MACHINE} 3921.11Slukem# rescue.ad.${MACHINE_ARCH} 3931.11Slukem# (or) rescue.ad.${MACHINE_CPU} 3941.11Slukem# rescue.ad.${MACHINE_CPU}.shl 3951.1Sdyoung# 3961.9Slukem# Environment: 3971.1Sdyoung# shlib 3981.1Sdyoung# stlib 3991.1Sdyoung# 4001.8Slukemlist_set_lists() 4011.8Slukem{ 4021.1Sdyoung setname=$1 4031.1Sdyoung 4041.111Suebayasi list_set_lists_mi $setname 4051.113Suebayasi list_set_lists_ad $setname 4061.111Suebayasi list_set_lists_md $setname 4071.111Suebayasi list_set_lists_stl $setname 4081.113Suebayasi list_set_lists_shl $setname 4091.113Suebayasi list_set_lists_module $setname 4101.111Suebayasi list_set_lists_rescue $setname 4111.117Suebayasi return 0 4121.111Suebayasi} 4131.110Suebayasi 4141.111Suebayasilist_set_lists_mi() 4151.111Suebayasi{ 4161.111Suebayasi setdir=$setsdir/lists/$1 4171.113Suebayasi # always exist! 4181.9Slukem echo $setdir/mi 4191.111Suebayasi} 4201.110Suebayasi 4211.111Suebayasilist_set_lists_ad() 4221.111Suebayasi{ 4231.111Suebayasi setdir=$setsdir/lists/$1 4241.113Suebayasi [ "${MACHINE}" != "${MACHINE_ARCH}" ] && \ 4251.113Suebayasi list_set_lists_common_ad $1 4261.111Suebayasi} 4271.110Suebayasi 4281.111Suebayasilist_set_lists_md() 4291.111Suebayasi{ 4301.111Suebayasi setdir=$setsdir/lists/$1 4311.110Suebayasi echo_if_exist $setdir/md.${MACHINE}.${MACHINE_ARCH} || \ 4321.110Suebayasi echo_if_exist $setdir/md.${MACHINE} 4331.111Suebayasi} 4341.110Suebayasi 4351.111Suebayasilist_set_lists_stl() 4361.111Suebayasi{ 4371.111Suebayasi setdir=$setsdir/lists/$1 4381.110Suebayasi echo_if_exist $setdir/stl.mi 4391.110Suebayasi echo_if_exist $setdir/stl.${stlib} 4401.111Suebayasi} 4411.110Suebayasi 4421.111Suebayasilist_set_lists_shl() 4431.111Suebayasi{ 4441.111Suebayasi setdir=$setsdir/lists/$1 4451.113Suebayasi [ "$shlib" != "no" ] || return 4461.112Suebayasi echo_if_exist $setdir/shl.mi 4471.112Suebayasi echo_if_exist $setdir/shl.${shlib} 4481.111Suebayasi} 4491.110Suebayasi 4501.111Suebayasilist_set_lists_module() 4511.111Suebayasi{ 4521.111Suebayasi setdir=$setsdir/lists/$1 4531.113Suebayasi [ "$module" != "no" ] || return 4541.112Suebayasi echo_if_exist $setdir/module.mi 4551.112Suebayasi echo_if_exist $setdir/module.${MACHINE} 4561.113Suebayasi # XXX module never has .shl 4571.113Suebayasi [ "${MACHINE}" != "${MACHINE_ARCH}" ] && \ 4581.113Suebayasi list_set_lists_common_ad $1 module 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.113Suebayasi [ "${MACHINE}" != "${MACHINE_ARCH}" ] && \ 4671.113Suebayasi list_set_lists_common_ad $1 rescue 4681.111Suebayasi} 4691.111Suebayasi 4701.113Suebayasilist_set_lists_common_ad() 4711.111Suebayasi{ 4721.113Suebayasi setdir=$setsdir/lists/$1; _prefix=$2 4731.113Suebayasi 4741.113Suebayasi [ -n "$_prefix" ] && prefix="$_prefix". 4751.113Suebayasi 4761.113Suebayasi # Prefer a <prefix>.ad.${MACHINE_ARCH} over a 4771.113Suebayasi # <prefix>.ad.${MACHINE_CPU}, since the arch- 4781.112Suebayasi # specific one will be more specific than the 4791.112Suebayasi # cpu-specific one. 4801.113Suebayasi echo_if_exist $setdir/${prefix}ad.${MACHINE_ARCH} || \ 4811.113Suebayasi echo_if_exist $setdir/${prefix}ad.${MACHINE_CPU} 4821.113Suebayasi [ "$shlib" != "no" ] && \ 4831.113Suebayasi echo_if_exist $setdir/${prefix}ad.${MACHINE_CPU}.shl 4841.5Sdyoung} 4851.5Sdyoung 4861.110Suebayasiecho_if_exist() 4871.110Suebayasi{ 4881.110Suebayasi [ -f $1 ] && echo $1 4891.110Suebayasi return $? 4901.110Suebayasi} 4911.110Suebayasi 4921.110Suebayasiecho_if_exist_foreach() 4931.110Suebayasi{ 4941.110Suebayasi local _list=$1; shift 4951.110Suebayasi for _suffix in $@; do 4961.110Suebayasi echo_if_exist ${_list}.${_suffix} 4971.110Suebayasi done 4981.110Suebayasi} 4991.110Suebayasi 5001.116Suebayasiprint_set_lists() 5011.116Suebayasi{ 5021.116Suebayasi for setname; do 5031.116Suebayasi list=`list_set_lists $setname` 5041.116Suebayasi for l in $list; do 5051.116Suebayasi echo $l 5061.116Suebayasi if $verbose; then 5071.116Suebayasi echo >&2 "DEBUG: list_set_files: $l" 5081.116Suebayasi fi 5091.116Suebayasi done 5101.118Suebayasi done | ${XARGS} ${SED} ${SUBST} 5111.116Suebayasi} 5121.116Suebayasi 5131.9Slukem# arch_to_cpu mach 5141.9Slukem# 5151.11Slukem# Print the ${MACHINE_CPU} for ${MACHINE_ARCH}=mach, 5161.9Slukem# as determined by <bsd.own.mk>. 5171.9Slukem# 5181.8Slukemarch_to_cpu() 5191.8Slukem{ 5201.56Sapb MACHINE_ARCH=${1} ${MAKE} -B -f- all <<EOMAKE 5211.5Sdyoung.include <bsd.own.mk> 5221.5Sdyoungall: 5231.5Sdyoung @echo \${MACHINE_CPU} 5241.12SlukemEOMAKE 5251.1Sdyoung} 5261.46Sapb 5271.46Sapb# arch_to_endian mach 5281.46Sapb# 5291.46Sapb# Print the ${TARGET_ENDIANNESS} for ${MACHINE_ARCH}=mach, 5301.46Sapb# as determined by <bsd.endian.mk>. 5311.46Sapb# 5321.46Sapbarch_to_endian() 5331.46Sapb{ 5341.56Sapb MACHINE_ARCH=${1} ${MAKE} -B -f- all <<EOMAKE 5351.46Sapb.include <bsd.endian.mk> 5361.46Sapball: 5371.46Sapb @echo \${TARGET_ENDIANNESS} 5381.46SapbEOMAKE 5391.46Sapb} 5401.117Suebayasi 5411.117Suebayasi##### 5421.117Suebayasi 5431.117Suebayasi# print_mkvars 5441.117Suebayasiprint_mkvars() 5451.117Suebayasi{ 5461.117Suebayasi for v in $MKVARS; do 5471.117Suebayasi eval echo $v=\$$v 5481.117Suebayasi done 5491.117Suebayasi} 5501.117Suebayasi 5511.117Suebayasi# print_set_lists_{base,x,ext} 5521.117Suebayasi# list_set_lists_{base,x,ext} 5531.117Suebayasi# list_set_files_{base,x,ext} 5541.117Suebayasifor func in print_set_lists list_set_lists list_set_files; do 5551.117Suebayasi for x in base x ext; do 5561.117Suebayasi if [ $x = base ]; then 5571.117Suebayasi list=nlists 5581.117Suebayasi else 5591.117Suebayasi list=${x}lists 5601.117Suebayasi fi 5611.117Suebayasi eval ${func}_${x} \(\) \{ $func \$$list \; \} 5621.117Suebayasi done 5631.117Suebayasidone 564