sets.subr revision 1.125
11.125Snjoly# $NetBSD: sets.subr,v 1.125 2010/12/08 23:56:01 njoly 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.118Suebayasi: ${XARGS:=xargs} 591.43Sapb 601.45Sapb# 611.45Sapb# If printf is a shell builtin command, then we can 621.45Sapb# implement cheaper versions of basename and dirname 631.45Sapb# that do not involve any fork/exec overhead. 641.45Sapb# If printf is not builtin, approximate it using echo, 651.45Sapb# and hope there are no weird file names that cause 661.45Sapb# some versions of echo to do the wrong thing. 671.45Sapb# (Converting to this version of dirname speeded up the 681.45Sapb# syspkgdeps script by an order of magnitude, from 68 691.45Sapb# seconds to 6.3 seconds on one particular host.) 701.45Sapb# 711.45Sapb# Note that naive approximations for dirname 721.45Sapb# using ${foo%/*} do not do the right thing in cases 731.45Sapb# where the result should be "/" or ".". 741.45Sapb# 751.45Sapbcase "$(type printf)" in 761.45Sapb*builtin*) 771.45Sapb basename () 781.45Sapb { 791.45Sapb local bn 801.45Sapb bn="${1##*/}" 811.45Sapb bn="${bn%$2}" 821.45Sapb printf "%s\n" "$bn" 831.45Sapb } 841.45Sapb dirname () 851.45Sapb { 861.45Sapb local dn 871.45Sapb case "$1" in 881.45Sapb ?*/*) dn="${1%/*}" ;; 891.45Sapb /*) dn=/ ;; 901.45Sapb *) dn=. ;; 911.45Sapb esac 921.45Sapb printf "%s\n" "$dn" 931.45Sapb } 941.45Sapb ;; 951.45Sapb*) 961.45Sapb basename () 971.45Sapb { 981.45Sapb local bn 991.45Sapb bn="${1##*/}" 1001.45Sapb bn="${bn%$2}" 1011.45Sapb echo "$bn" 1021.45Sapb } 1031.45Sapb dirname () 1041.45Sapb { 1051.45Sapb local dn 1061.45Sapb case "$1" in 1071.45Sapb ?*/*) dn="${1%/*}" ;; 1081.45Sapb /*) dn=/ ;; 1091.45Sapb *) dn=. ;; 1101.45Sapb esac 1111.45Sapb echo "$dn" 1121.45Sapb } 1131.45Sapb ;; 1141.45Sapbesac 1151.45Sapb 1161.108Suebayasi##### 1171.108Suebayasi 1181.9SlukemoIFS=$IFS 1191.9SlukemIFS=" 1201.9Slukem" 1211.100Suebayasi 1221.109Shefor x in $( ${MAKE} -B -f ${rundir}/mkvars.mk mkvars ); do 1231.108Suebayasi eval export $x 1241.9Slukemdone 1251.100Suebayasi 1261.9SlukemIFS=$oIFS 1271.9Slukem 1281.118SuebayasiMKVARS="$( ${MAKE} -B -f ${rundir}/mkvars.mk mkvars | ${SED} -e 's,=.*,,' | ${XARGS} )" 1291.100Suebayasi 1301.105Suebayasi##### 1311.105Suebayasi 1321.117Suebayasisetsdir=${rundir} 1331.9Slukemobsolete=0 1341.91Sdyoungif [ "${MKKMOD}" = "no" ]; then 1351.91Sdyoung module=no # MODULEs are off. 1361.125Snjoly modset="" 1371.125Snjolyelse 1381.125Snjoly module=yes 1391.125Snjoly modset="modules" 1401.125Snjolyfi 1411.125Snjolyif [ "${MKATF}" = "no" ]; then 1421.125Snjoly testset="" 1431.125Snjolyelse 1441.125Snjoly testset="tests" 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.125Snjolynlists="base comp etc games man misc $modset $testset text" 1581.86Sjnemethxlists="xbase xcomp xetc xfont xserver" 1591.92Suebayasiextlists="extbase extcomp extetc" 1601.9Slukem 1611.64SheOSRELEASE=`${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh` 1621.81SrmindMODULEDIR="stand/${MACHINE}/${OSRELEASE}/modules" 1631.62SadSUBST="s#@MODULEDIR@#${MODULEDIR}#g" 1641.62SadSUBST="${SUBST};s#@OSRELEASE@#${OSRELEASE}#g" 1651.62SadSUBST="${SUBST};s#@MACHINE@#${MACHINE}#g" 1661.60Sad 1671.9Slukem# 1681.9Slukem# list_set_files setfile [...] 1691.1Sdyoung# 1701.9Slukem# Produce a packing list for setfile(s). 1711.9Slukem# In each file, a record consists of a path and a System Package name, 1721.9Slukem# separated by whitespace. E.g., 1731.9Slukem# 1741.125Snjoly# # $NetBSD: sets.subr,v 1.125 2010/12/08 23:56:01 njoly Exp $ 1751.9Slukem# . base-sys-root [keyword[,...]] 1761.9Slukem# ./altroot base-sys-root 1771.9Slukem# ./bin base-sys-root 1781.9Slukem# ./bin/[ base-util-root 1791.9Slukem# ./bin/cat base-util-root 1801.9Slukem# [...] 1811.9Slukem# 1821.9Slukem# A # in the first column marks a comment. 1831.9Slukem# 1841.9Slukem# If ${obsolete} != 0, only entries with an "obsolete" keyword will 1851.52Slukem# be printed. All other keywords must be present. 1861.9Slukem# 1871.9Slukem# The third field is an optional comma separated list of keywords to 1881.9Slukem# control if a record is printed; every keyword listed must be enabled 1891.9Slukem# for the record to be printed. The following keywords are available: 1901.9Slukem# dummy dummy entry (ignored) 1911.13Slukem# obsolete file is obsolete, and only printed if 1921.13Slukem# ${obsolete} != 0 1931.13Slukem# 1941.125Snjoly# atf ${MKATF} != no 1951.87Sskrll# bfd obsolete, use binutils. 1961.87Sskrll# binutils ${MKBINUTILS} != no 1971.22Slukem# catpages ${MKCATPAGES} != no 1981.71Smrg# compat ${MKCOMPAT} != no 1991.22Slukem# crypto ${MKCRYPTO} != no 2001.22Slukem# crypto_idea ${MKCRYPTO_IDEA} != no 2011.22Slukem# crypto_mdc2 ${MKCRYPTO_MDC2} != no 2021.22Slukem# crypto_rc5 ${MKCRYPTO_RC5} != no 2031.22Slukem# cvs ${MKCVS} != no 2041.53Slukem# debug ${MKDEBUG} != no 2051.69Slukem# debuglib ${MKDEBUGLIB} != no 2061.23Slukem# doc ${MKDOC} != no 2071.121Sdarran# dtrace ${MKDTRACE} != no 2081.67Slukem# dynamicroot ${MKDYNAMICROOT} != no 2091.92Suebayasi# extsrc ${MKEXTSRC} != no 2101.52Slukem# gcc ${MKGCC} != no 2111.36Smatt# gcccmds ${MKGCCCMDS} != no 2121.32Sscw# gdb ${MKGDB} != no 2131.22Slukem# hesiod ${MKHESIOD} != no 2141.68Slukem# html ${MKHTML} != no 2151.67Slukem# inet6 ${MKINET6} != no 2161.23Slukem# info ${MKINFO} != no 2171.39Speter# ipfilter ${MKIPFILTER} != no 2181.51Smrg# iscsi ${MKISCSI} != no 2191.22Slukem# kerberos ${MKKERBEROS} != no 2201.85Sdyoung# kmod ${MKKMOD} != no 2211.67Slukem# ldap ${MKLDAP} != no 2221.22Slukem# lint ${MKLINT} != no 2231.78Sagc# lvm ${MKLVM} != no 2241.22Slukem# man ${MKMAN} != no 2251.67Slukem# manpages ${MKMANPAGES} != no 2261.22Slukem# manz ${MKMANZ} != no 2271.88Stsarna# mdns ${MKMDNS} != no 2281.23Slukem# nls ${MKNLS} != no 2291.66Sdyoung# nvi ${MKNVI} != no 2301.37She# pam ${MKPAM} != no 2311.120Splunky# pcc ${MKPCC} != no 2321.120Splunky# pcccmds ${MKPCCCMDS} != no 2331.39Speter# pf ${MKPF} != no 2341.67Slukem# pic ${MKPIC} != no 2351.22Slukem# postfix ${MKPOSTFIX} != no 2361.22Slukem# profile ${MKPROFILE} != no 2371.24Slukem# share ${MKSHARE} != no 2381.22Slukem# skey ${MKSKEY} != no 2391.122Stron# solaris ${MKDTRACE} != no or ${MKZFS} != no 2401.73Smrg# x11 ${MKX11} != no && ${X11FLAVOUR} != "Xorg" 2411.73Smrg# xorg ${MKX11} != no && ${X11FLAVOUR} == "Xorg" 2421.22Slukem# yp ${MKYP} != no 2431.89Shaad# zfs ${MKZFS} != no 2441.22Slukem# 2451.87Sskrll# binutils=<n> <n> = value of ${HAVE_BINUTILS} 2461.52Slukem# gcc=<n> <n> = value of ${HAVE_GCC} 2471.52Slukem# gdb=<n> <n> = value of ${HAVE_GDB} 2481.52Slukem# 2491.41Slukem# use_inet6 ${USE_INET6} != no 2501.41Slukem# use_kerberos ${USE_KERBEROS} != no 2511.41Slukem# use_yp ${USE_YP} != no 2521.41Slukem# 2531.22Slukem# .cat if ${MKMANZ} != "no" && ${MKCATPAGES} != "no" 2541.22Slukem# automatically append ".gz" to the filename 2551.22Slukem# 2561.22Slukem# .man if ${MKMANZ} != "no" && ${MKMAN} != "no" 2571.22Slukem# automatically append ".gz" to the filename 2581.1Sdyoung# 2591.8Slukemlist_set_files() 2601.8Slukem{ 2611.83Sapb if [ ${MAKEVERBOSE:-2} -lt 3 ]; then 2621.65She verbose=false 2631.65She else 2641.65She verbose=true 2651.65She fi 2661.116Suebayasi print_set_lists "$@" | \ 2671.43Sapb ${AWK} -v obsolete=${obsolete} ' 2681.9Slukem BEGIN { 2691.52Slukem if (obsolete) 2701.52Slukem wanted["obsolete"] = 1 2711.52Slukem 2721.100Suebayasi split("'"${MKVARS}"'", needvars) 2731.52Slukem for (vi in needvars) { 2741.52Slukem nv = needvars[vi] 2751.52Slukem kw = tolower(nv) 2761.52Slukem sub(/^mk/, "", kw) 2771.52Slukem if (ENVIRON[nv] != "no") 2781.52Slukem wanted[kw] = 1 2791.52Slukem } 2801.52Slukem 2811.52Slukem if ("'"${TOOLCHAIN_MISSING}"'" != "yes") { 2821.90Sdyoung if ("binutils" in wanted) 2831.90Sdyoung wanted["binutils=" "'"${HAVE_BINUTILS}"'"] = 1 2841.90Sdyoung if ("gcc" in wanted) 2851.90Sdyoung wanted["gcc=" "'"${HAVE_GCC}"'"] = 1 2861.90Sdyoung if ("gdb" in wanted) 2871.90Sdyoung wanted["gdb=" "'"${HAVE_GDB}"'"] = 1 2881.9Slukem } 2891.52Slukem if (("man" in wanted) && ("catpages" in wanted)) 2901.52Slukem wanted[".cat"] = 1 2911.52Slukem if (("man" in wanted) && ("manpages" in wanted)) 2921.52Slukem wanted[".man"] = 1 2931.9Slukem } 2941.9Slukem 2951.9Slukem /^#/ { 2961.9Slukem next; 2971.9Slukem } 2981.9Slukem 2991.9Slukem NF > 2 && $3 != "-" { 3001.9Slukem split($3, keywords, ",") 3011.9Slukem show = 1 3021.52Slukem haveobs = 0 3031.9Slukem for (ki in keywords) { 3041.9Slukem kw = keywords[ki] 3051.22Slukem if (("manz" in wanted) && 3061.22Slukem (kw == ".cat" || kw == ".man")) 3071.22Slukem $1 = $1 ".gz" 3081.59Sjmmv negated = match(kw, "! *") 3091.59Sjmmv if (negated > 0) { 3101.59Sjmmv kw = substr(kw, RSTART + RLENGTH) 3111.59Sjmmv if (kw in wanted) 3121.59Sjmmv show = 0 3131.59Sjmmv } else { 3141.59Sjmmv if (! (kw in wanted)) 3151.59Sjmmv show = 0 3161.59Sjmmv } 3171.52Slukem if (kw == "obsolete") 3181.52Slukem haveobs = 1 3191.9Slukem } 3201.52Slukem if (obsolete && ! haveobs) 3211.52Slukem next 3221.9Slukem if (show) 3231.9Slukem print 3241.9Slukem next 3251.9Slukem } 3261.9Slukem 3271.9Slukem { 3281.9Slukem if (! obsolete) 3291.9Slukem print 3301.9Slukem }' 3311.9Slukem 3321.1Sdyoung} 3331.1Sdyoung 3341.1Sdyoung# 3351.1Sdyoung# list_set_lists setname 3361.1Sdyoung# 3371.1Sdyoung# Print to stdout a list of files, one filename per line, which 3381.1Sdyoung# concatenate to create the packing list for setname. E.g., 3391.1Sdyoung# 3401.1Sdyoung# .../lists/base/mi 3411.1Sdyoung# .../lists/base/rescue.mi 3421.1Sdyoung# .../lists/base/md.i386 3431.9Slukem# [...] 3441.1Sdyoung# 3451.9Slukem# For a given setname $set, the following files may be selected from 3461.9Slukem# .../list/$set: 3471.9Slukem# mi 3481.92Suebayasi# mi.ext.* 3491.11Slukem# ad.${MACHINE_ARCH} 3501.11Slukem# (or) ad.${MACHINE_CPU} 3511.11Slukem# ad.${MACHINE_CPU}.shl 3521.11Slukem# md.${MACHINE}.${MACHINE_ARCH} 3531.11Slukem# (or) md.${MACHINE} 3541.9Slukem# stl.mi 3551.92Suebayasi# stl.${stlib} 3561.9Slukem# shl.mi 3571.92Suebayasi# shl.mi.ext.* 3581.92Suebayasi# shl.${shlib} 3591.92Suebayasi# shl.${shlib}.ext.* 3601.77Stsutsui# module.mi if ${module} != no 3611.77Stsutsui# module.${MACHINE} if ${module} != no 3621.77Stsutsui# module.ad.${MACHINE_ARCH} if ${module} != no 3631.77Stsutsui# (or) module.ad.${MACHINE_CPU} if ${module} != no 3641.9Slukem# rescue.shl 3651.11Slukem# rescue.${MACHINE} 3661.11Slukem# rescue.ad.${MACHINE_ARCH} 3671.11Slukem# (or) rescue.ad.${MACHINE_CPU} 3681.11Slukem# rescue.ad.${MACHINE_CPU}.shl 3691.1Sdyoung# 3701.9Slukem# Environment: 3711.1Sdyoung# shlib 3721.1Sdyoung# stlib 3731.1Sdyoung# 3741.8Slukemlist_set_lists() 3751.8Slukem{ 3761.1Sdyoung setname=$1 3771.1Sdyoung 3781.111Suebayasi list_set_lists_mi $setname 3791.113Suebayasi list_set_lists_ad $setname 3801.111Suebayasi list_set_lists_md $setname 3811.111Suebayasi list_set_lists_stl $setname 3821.113Suebayasi list_set_lists_shl $setname 3831.113Suebayasi list_set_lists_module $setname 3841.111Suebayasi list_set_lists_rescue $setname 3851.117Suebayasi return 0 3861.111Suebayasi} 3871.110Suebayasi 3881.111Suebayasilist_set_lists_mi() 3891.111Suebayasi{ 3901.111Suebayasi setdir=$setsdir/lists/$1 3911.113Suebayasi # always exist! 3921.9Slukem echo $setdir/mi 3931.111Suebayasi} 3941.110Suebayasi 3951.111Suebayasilist_set_lists_ad() 3961.111Suebayasi{ 3971.111Suebayasi setdir=$setsdir/lists/$1 3981.113Suebayasi [ "${MACHINE}" != "${MACHINE_ARCH}" ] && \ 3991.113Suebayasi list_set_lists_common_ad $1 4001.111Suebayasi} 4011.110Suebayasi 4021.111Suebayasilist_set_lists_md() 4031.111Suebayasi{ 4041.111Suebayasi setdir=$setsdir/lists/$1 4051.110Suebayasi echo_if_exist $setdir/md.${MACHINE}.${MACHINE_ARCH} || \ 4061.110Suebayasi echo_if_exist $setdir/md.${MACHINE} 4071.111Suebayasi} 4081.110Suebayasi 4091.111Suebayasilist_set_lists_stl() 4101.111Suebayasi{ 4111.111Suebayasi setdir=$setsdir/lists/$1 4121.110Suebayasi echo_if_exist $setdir/stl.mi 4131.110Suebayasi echo_if_exist $setdir/stl.${stlib} 4141.111Suebayasi} 4151.110Suebayasi 4161.111Suebayasilist_set_lists_shl() 4171.111Suebayasi{ 4181.111Suebayasi setdir=$setsdir/lists/$1 4191.113Suebayasi [ "$shlib" != "no" ] || return 4201.112Suebayasi echo_if_exist $setdir/shl.mi 4211.112Suebayasi echo_if_exist $setdir/shl.${shlib} 4221.111Suebayasi} 4231.110Suebayasi 4241.111Suebayasilist_set_lists_module() 4251.111Suebayasi{ 4261.111Suebayasi setdir=$setsdir/lists/$1 4271.113Suebayasi [ "$module" != "no" ] || return 4281.112Suebayasi echo_if_exist $setdir/module.mi 4291.112Suebayasi echo_if_exist $setdir/module.${MACHINE} 4301.113Suebayasi # XXX module never has .shl 4311.113Suebayasi [ "${MACHINE}" != "${MACHINE_ARCH}" ] && \ 4321.113Suebayasi list_set_lists_common_ad $1 module 4331.111Suebayasi} 4341.1Sdyoung 4351.111Suebayasilist_set_lists_rescue() 4361.111Suebayasi{ 4371.111Suebayasi setdir=$setsdir/lists/$1 4381.110Suebayasi echo_if_exist $setdir/rescue.mi 4391.110Suebayasi echo_if_exist $setdir/rescue.${MACHINE} 4401.113Suebayasi [ "${MACHINE}" != "${MACHINE_ARCH}" ] && \ 4411.113Suebayasi list_set_lists_common_ad $1 rescue 4421.111Suebayasi} 4431.111Suebayasi 4441.113Suebayasilist_set_lists_common_ad() 4451.111Suebayasi{ 4461.113Suebayasi setdir=$setsdir/lists/$1; _prefix=$2 4471.113Suebayasi 4481.113Suebayasi [ -n "$_prefix" ] && prefix="$_prefix". 4491.113Suebayasi 4501.113Suebayasi # Prefer a <prefix>.ad.${MACHINE_ARCH} over a 4511.113Suebayasi # <prefix>.ad.${MACHINE_CPU}, since the arch- 4521.112Suebayasi # specific one will be more specific than the 4531.112Suebayasi # cpu-specific one. 4541.113Suebayasi echo_if_exist $setdir/${prefix}ad.${MACHINE_ARCH} || \ 4551.113Suebayasi echo_if_exist $setdir/${prefix}ad.${MACHINE_CPU} 4561.113Suebayasi [ "$shlib" != "no" ] && \ 4571.113Suebayasi echo_if_exist $setdir/${prefix}ad.${MACHINE_CPU}.shl 4581.5Sdyoung} 4591.5Sdyoung 4601.110Suebayasiecho_if_exist() 4611.110Suebayasi{ 4621.110Suebayasi [ -f $1 ] && echo $1 4631.110Suebayasi return $? 4641.110Suebayasi} 4651.110Suebayasi 4661.110Suebayasiecho_if_exist_foreach() 4671.110Suebayasi{ 4681.110Suebayasi local _list=$1; shift 4691.110Suebayasi for _suffix in $@; do 4701.110Suebayasi echo_if_exist ${_list}.${_suffix} 4711.110Suebayasi done 4721.110Suebayasi} 4731.110Suebayasi 4741.116Suebayasiprint_set_lists() 4751.116Suebayasi{ 4761.116Suebayasi for setname; do 4771.116Suebayasi list=`list_set_lists $setname` 4781.116Suebayasi for l in $list; do 4791.116Suebayasi echo $l 4801.116Suebayasi if $verbose; then 4811.116Suebayasi echo >&2 "DEBUG: list_set_files: $l" 4821.116Suebayasi fi 4831.116Suebayasi done 4841.118Suebayasi done | ${XARGS} ${SED} ${SUBST} 4851.116Suebayasi} 4861.116Suebayasi 4871.9Slukem# arch_to_cpu mach 4881.9Slukem# 4891.11Slukem# Print the ${MACHINE_CPU} for ${MACHINE_ARCH}=mach, 4901.9Slukem# as determined by <bsd.own.mk>. 4911.9Slukem# 4921.8Slukemarch_to_cpu() 4931.8Slukem{ 4941.56Sapb MACHINE_ARCH=${1} ${MAKE} -B -f- all <<EOMAKE 4951.5Sdyoung.include <bsd.own.mk> 4961.5Sdyoungall: 4971.5Sdyoung @echo \${MACHINE_CPU} 4981.12SlukemEOMAKE 4991.1Sdyoung} 5001.46Sapb 5011.46Sapb# arch_to_endian mach 5021.46Sapb# 5031.46Sapb# Print the ${TARGET_ENDIANNESS} for ${MACHINE_ARCH}=mach, 5041.46Sapb# as determined by <bsd.endian.mk>. 5051.46Sapb# 5061.46Sapbarch_to_endian() 5071.46Sapb{ 5081.56Sapb MACHINE_ARCH=${1} ${MAKE} -B -f- all <<EOMAKE 5091.46Sapb.include <bsd.endian.mk> 5101.46Sapball: 5111.46Sapb @echo \${TARGET_ENDIANNESS} 5121.46SapbEOMAKE 5131.46Sapb} 5141.117Suebayasi 5151.117Suebayasi##### 5161.117Suebayasi 5171.117Suebayasi# print_mkvars 5181.117Suebayasiprint_mkvars() 5191.117Suebayasi{ 5201.117Suebayasi for v in $MKVARS; do 5211.117Suebayasi eval echo $v=\$$v 5221.117Suebayasi done 5231.117Suebayasi} 5241.117Suebayasi 5251.117Suebayasi# print_set_lists_{base,x,ext} 5261.117Suebayasi# list_set_lists_{base,x,ext} 5271.117Suebayasi# list_set_files_{base,x,ext} 5281.117Suebayasifor func in print_set_lists list_set_lists list_set_files; do 5291.117Suebayasi for x in base x ext; do 5301.117Suebayasi if [ $x = base ]; then 5311.117Suebayasi list=nlists 5321.117Suebayasi else 5331.117Suebayasi list=${x}lists 5341.117Suebayasi fi 5351.117Suebayasi eval ${func}_${x} \(\) \{ $func \$$list \; \} 5361.117Suebayasi done 5371.117Suebayasidone 538