sets.subr revision 1.117
11.115Suebayasi# $NetBSD: sets.subr,v 1.117 2009/12/15 06:18:07 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.105Suebayasi##### 1301.105Suebayasi 1311.117Suebayasisetsdir=${rundir} 1321.9Slukemobsolete=0 1331.76Stsutsuimodule=yes 1341.91Sdyoungif [ "${MKKMOD}" = "no" ]; then 1351.91Sdyoung module=no # MODULEs are off. 1361.9Slukemfi 1371.31Sjmc# Determine lib type. Do this first so stlib also gets set. 1381.31Sjmcif [ "${OBJECT_FMT}" = "ELF" ]; then 1391.9Slukem shlib=elf 1401.9Slukemelse 1411.9Slukem shlib=aout 1421.9Slukemfi 1431.9Slukemstlib=$shlib 1441.31Sjmc# Now check for MKPIC or specials and turn off shlib if need be. 1451.31Sjmcif [ "${MKPIC}" = "no" ]; then 1461.31Sjmc shlib=no 1471.31Sjmcfi 1481.86Sjnemethif [ "$module" != "no" ]; then 1491.86Sjnemeth nlists="base comp etc games man misc modules tests text" 1501.86Sjnemethelse 1511.86Sjnemeth nlists="base comp etc games man misc tests text" 1521.86Sjnemethfi 1531.86Sjnemethxlists="xbase xcomp xetc xfont xserver" 1541.92Suebayasiextlists="extbase extcomp extetc" 1551.9Slukem 1561.64SheOSRELEASE=`${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh` 1571.81SrmindMODULEDIR="stand/${MACHINE}/${OSRELEASE}/modules" 1581.62SadSUBST="s#@MODULEDIR@#${MODULEDIR}#g" 1591.62SadSUBST="${SUBST};s#@OSRELEASE@#${OSRELEASE}#g" 1601.62SadSUBST="${SUBST};s#@MACHINE@#${MACHINE}#g" 1611.60Sad 1621.9Slukem# 1631.9Slukem# list_set_files setfile [...] 1641.1Sdyoung# 1651.9Slukem# Produce a packing list for setfile(s). 1661.9Slukem# In each file, a record consists of a path and a System Package name, 1671.9Slukem# separated by whitespace. E.g., 1681.9Slukem# 1691.115Suebayasi# # $NetBSD: sets.subr,v 1.117 2009/12/15 06:18:07 uebayasi Exp $ 1701.9Slukem# . base-sys-root [keyword[,...]] 1711.9Slukem# ./altroot base-sys-root 1721.9Slukem# ./bin base-sys-root 1731.9Slukem# ./bin/[ base-util-root 1741.9Slukem# ./bin/cat base-util-root 1751.9Slukem# [...] 1761.9Slukem# 1771.9Slukem# A # in the first column marks a comment. 1781.9Slukem# 1791.9Slukem# If ${obsolete} != 0, only entries with an "obsolete" keyword will 1801.52Slukem# be printed. All other keywords must be present. 1811.9Slukem# 1821.9Slukem# The third field is an optional comma separated list of keywords to 1831.9Slukem# control if a record is printed; every keyword listed must be enabled 1841.9Slukem# for the record to be printed. The following keywords are available: 1851.9Slukem# dummy dummy entry (ignored) 1861.13Slukem# obsolete file is obsolete, and only printed if 1871.13Slukem# ${obsolete} != 0 1881.13Slukem# 1891.87Sskrll# bfd obsolete, use binutils. 1901.87Sskrll# binutils ${MKBINUTILS} != no 1911.22Slukem# catpages ${MKCATPAGES} != no 1921.71Smrg# compat ${MKCOMPAT} != no 1931.22Slukem# crypto ${MKCRYPTO} != no 1941.22Slukem# crypto_idea ${MKCRYPTO_IDEA} != no 1951.22Slukem# crypto_mdc2 ${MKCRYPTO_MDC2} != no 1961.22Slukem# crypto_rc5 ${MKCRYPTO_RC5} != no 1971.22Slukem# cvs ${MKCVS} != no 1981.53Slukem# debug ${MKDEBUG} != no 1991.69Slukem# debuglib ${MKDEBUGLIB} != no 2001.23Slukem# doc ${MKDOC} != no 2011.67Slukem# dynamicroot ${MKDYNAMICROOT} != no 2021.92Suebayasi# extsrc ${MKEXTSRC} != no 2031.52Slukem# gcc ${MKGCC} != no 2041.36Smatt# gcccmds ${MKGCCCMDS} != no 2051.32Sscw# gdb ${MKGDB} != no 2061.22Slukem# hesiod ${MKHESIOD} != no 2071.68Slukem# html ${MKHTML} != no 2081.67Slukem# inet6 ${MKINET6} != no 2091.23Slukem# info ${MKINFO} != no 2101.39Speter# ipfilter ${MKIPFILTER} != no 2111.51Smrg# iscsi ${MKISCSI} != no 2121.22Slukem# kerberos ${MKKERBEROS} != no 2131.85Sdyoung# kmod ${MKKMOD} != no 2141.67Slukem# ldap ${MKLDAP} != no 2151.22Slukem# lint ${MKLINT} != no 2161.78Sagc# lvm ${MKLVM} != no 2171.22Slukem# man ${MKMAN} != no 2181.67Slukem# manpages ${MKMANPAGES} != no 2191.22Slukem# manz ${MKMANZ} != no 2201.88Stsarna# mdns ${MKMDNS} != no 2211.23Slukem# nls ${MKNLS} != no 2221.66Sdyoung# nvi ${MKNVI} != no 2231.37She# pam ${MKPAM} != no 2241.39Speter# pf ${MKPF} != no 2251.67Slukem# pic ${MKPIC} != no 2261.22Slukem# postfix ${MKPOSTFIX} != no 2271.22Slukem# profile ${MKPROFILE} != no 2281.24Slukem# share ${MKSHARE} != no 2291.22Slukem# skey ${MKSKEY} != no 2301.73Smrg# x11 ${MKX11} != no && ${X11FLAVOUR} != "Xorg" 2311.73Smrg# xorg ${MKX11} != no && ${X11FLAVOUR} == "Xorg" 2321.22Slukem# yp ${MKYP} != no 2331.89Shaad# zfs ${MKZFS} != no 2341.22Slukem# 2351.87Sskrll# binutils=<n> <n> = value of ${HAVE_BINUTILS} 2361.52Slukem# gcc=<n> <n> = value of ${HAVE_GCC} 2371.52Slukem# gdb=<n> <n> = value of ${HAVE_GDB} 2381.52Slukem# 2391.41Slukem# use_inet6 ${USE_INET6} != no 2401.41Slukem# use_kerberos ${USE_KERBEROS} != no 2411.41Slukem# use_yp ${USE_YP} != no 2421.41Slukem# 2431.22Slukem# .cat if ${MKMANZ} != "no" && ${MKCATPAGES} != "no" 2441.22Slukem# automatically append ".gz" to the filename 2451.22Slukem# 2461.22Slukem# .man if ${MKMANZ} != "no" && ${MKMAN} != "no" 2471.22Slukem# automatically append ".gz" to the filename 2481.1Sdyoung# 2491.8Slukemlist_set_files() 2501.8Slukem{ 2511.83Sapb if [ ${MAKEVERBOSE:-2} -lt 3 ]; then 2521.65She verbose=false 2531.65She else 2541.65She verbose=true 2551.65She fi 2561.116Suebayasi print_set_lists "$@" | \ 2571.43Sapb ${AWK} -v obsolete=${obsolete} ' 2581.9Slukem BEGIN { 2591.52Slukem if (obsolete) 2601.52Slukem wanted["obsolete"] = 1 2611.52Slukem 2621.100Suebayasi split("'"${MKVARS}"'", needvars) 2631.52Slukem for (vi in needvars) { 2641.52Slukem nv = needvars[vi] 2651.52Slukem kw = tolower(nv) 2661.52Slukem sub(/^mk/, "", kw) 2671.52Slukem if (ENVIRON[nv] != "no") 2681.52Slukem wanted[kw] = 1 2691.52Slukem } 2701.52Slukem 2711.52Slukem if ("'"${TOOLCHAIN_MISSING}"'" != "yes") { 2721.90Sdyoung if ("binutils" in wanted) 2731.90Sdyoung wanted["binutils=" "'"${HAVE_BINUTILS}"'"] = 1 2741.90Sdyoung if ("gcc" in wanted) 2751.90Sdyoung wanted["gcc=" "'"${HAVE_GCC}"'"] = 1 2761.90Sdyoung if ("gdb" in wanted) 2771.90Sdyoung wanted["gdb=" "'"${HAVE_GDB}"'"] = 1 2781.9Slukem } 2791.52Slukem if (("man" in wanted) && ("catpages" in wanted)) 2801.52Slukem wanted[".cat"] = 1 2811.52Slukem if (("man" in wanted) && ("manpages" in wanted)) 2821.52Slukem wanted[".man"] = 1 2831.9Slukem } 2841.9Slukem 2851.9Slukem /^#/ { 2861.9Slukem next; 2871.9Slukem } 2881.9Slukem 2891.9Slukem NF > 2 && $3 != "-" { 2901.9Slukem split($3, keywords, ",") 2911.9Slukem show = 1 2921.52Slukem haveobs = 0 2931.9Slukem for (ki in keywords) { 2941.9Slukem kw = keywords[ki] 2951.22Slukem if (("manz" in wanted) && 2961.22Slukem (kw == ".cat" || kw == ".man")) 2971.22Slukem $1 = $1 ".gz" 2981.59Sjmmv negated = match(kw, "! *") 2991.59Sjmmv if (negated > 0) { 3001.59Sjmmv kw = substr(kw, RSTART + RLENGTH) 3011.59Sjmmv if (kw in wanted) 3021.59Sjmmv show = 0 3031.59Sjmmv } else { 3041.59Sjmmv if (! (kw in wanted)) 3051.59Sjmmv show = 0 3061.59Sjmmv } 3071.52Slukem if (kw == "obsolete") 3081.52Slukem haveobs = 1 3091.9Slukem } 3101.52Slukem if (obsolete && ! haveobs) 3111.52Slukem next 3121.9Slukem if (show) 3131.9Slukem print 3141.9Slukem next 3151.9Slukem } 3161.9Slukem 3171.9Slukem { 3181.9Slukem if (! obsolete) 3191.9Slukem print 3201.9Slukem }' 3211.9Slukem 3221.1Sdyoung} 3231.1Sdyoung 3241.1Sdyoung# 3251.1Sdyoung# list_set_lists setname 3261.1Sdyoung# 3271.1Sdyoung# Print to stdout a list of files, one filename per line, which 3281.1Sdyoung# concatenate to create the packing list for setname. E.g., 3291.1Sdyoung# 3301.1Sdyoung# .../lists/base/mi 3311.1Sdyoung# .../lists/base/rescue.mi 3321.1Sdyoung# .../lists/base/md.i386 3331.9Slukem# [...] 3341.1Sdyoung# 3351.9Slukem# For a given setname $set, the following files may be selected from 3361.9Slukem# .../list/$set: 3371.9Slukem# mi 3381.92Suebayasi# mi.ext.* 3391.11Slukem# ad.${MACHINE_ARCH} 3401.11Slukem# (or) ad.${MACHINE_CPU} 3411.11Slukem# ad.${MACHINE_CPU}.shl 3421.11Slukem# md.${MACHINE}.${MACHINE_ARCH} 3431.11Slukem# (or) md.${MACHINE} 3441.9Slukem# stl.mi 3451.92Suebayasi# stl.${stlib} 3461.9Slukem# shl.mi 3471.92Suebayasi# shl.mi.ext.* 3481.92Suebayasi# shl.${shlib} 3491.92Suebayasi# shl.${shlib}.ext.* 3501.77Stsutsui# module.mi if ${module} != no 3511.77Stsutsui# module.${MACHINE} if ${module} != no 3521.77Stsutsui# module.ad.${MACHINE_ARCH} if ${module} != no 3531.77Stsutsui# (or) module.ad.${MACHINE_CPU} if ${module} != no 3541.9Slukem# rescue.shl 3551.11Slukem# rescue.${MACHINE} 3561.11Slukem# rescue.ad.${MACHINE_ARCH} 3571.11Slukem# (or) rescue.ad.${MACHINE_CPU} 3581.11Slukem# rescue.ad.${MACHINE_CPU}.shl 3591.1Sdyoung# 3601.9Slukem# Environment: 3611.1Sdyoung# shlib 3621.1Sdyoung# stlib 3631.1Sdyoung# 3641.8Slukemlist_set_lists() 3651.8Slukem{ 3661.1Sdyoung setname=$1 3671.1Sdyoung 3681.111Suebayasi list_set_lists_mi $setname 3691.113Suebayasi list_set_lists_ad $setname 3701.111Suebayasi list_set_lists_md $setname 3711.111Suebayasi list_set_lists_stl $setname 3721.113Suebayasi list_set_lists_shl $setname 3731.113Suebayasi list_set_lists_module $setname 3741.111Suebayasi list_set_lists_rescue $setname 3751.117Suebayasi return 0 3761.111Suebayasi} 3771.110Suebayasi 3781.111Suebayasilist_set_lists_mi() 3791.111Suebayasi{ 3801.111Suebayasi setdir=$setsdir/lists/$1 3811.113Suebayasi # always exist! 3821.9Slukem echo $setdir/mi 3831.111Suebayasi} 3841.110Suebayasi 3851.111Suebayasilist_set_lists_ad() 3861.111Suebayasi{ 3871.111Suebayasi setdir=$setsdir/lists/$1 3881.113Suebayasi [ "${MACHINE}" != "${MACHINE_ARCH}" ] && \ 3891.113Suebayasi list_set_lists_common_ad $1 3901.111Suebayasi} 3911.110Suebayasi 3921.111Suebayasilist_set_lists_md() 3931.111Suebayasi{ 3941.111Suebayasi setdir=$setsdir/lists/$1 3951.110Suebayasi echo_if_exist $setdir/md.${MACHINE}.${MACHINE_ARCH} || \ 3961.110Suebayasi echo_if_exist $setdir/md.${MACHINE} 3971.111Suebayasi} 3981.110Suebayasi 3991.111Suebayasilist_set_lists_stl() 4001.111Suebayasi{ 4011.111Suebayasi setdir=$setsdir/lists/$1 4021.110Suebayasi echo_if_exist $setdir/stl.mi 4031.110Suebayasi echo_if_exist $setdir/stl.${stlib} 4041.111Suebayasi} 4051.110Suebayasi 4061.111Suebayasilist_set_lists_shl() 4071.111Suebayasi{ 4081.111Suebayasi setdir=$setsdir/lists/$1 4091.113Suebayasi [ "$shlib" != "no" ] || return 4101.112Suebayasi echo_if_exist $setdir/shl.mi 4111.112Suebayasi echo_if_exist $setdir/shl.${shlib} 4121.111Suebayasi} 4131.110Suebayasi 4141.111Suebayasilist_set_lists_module() 4151.111Suebayasi{ 4161.111Suebayasi setdir=$setsdir/lists/$1 4171.113Suebayasi [ "$module" != "no" ] || return 4181.112Suebayasi echo_if_exist $setdir/module.mi 4191.112Suebayasi echo_if_exist $setdir/module.${MACHINE} 4201.113Suebayasi # XXX module never has .shl 4211.113Suebayasi [ "${MACHINE}" != "${MACHINE_ARCH}" ] && \ 4221.113Suebayasi list_set_lists_common_ad $1 module 4231.111Suebayasi} 4241.1Sdyoung 4251.111Suebayasilist_set_lists_rescue() 4261.111Suebayasi{ 4271.111Suebayasi setdir=$setsdir/lists/$1 4281.110Suebayasi echo_if_exist $setdir/rescue.mi 4291.110Suebayasi echo_if_exist $setdir/rescue.${MACHINE} 4301.113Suebayasi [ "${MACHINE}" != "${MACHINE_ARCH}" ] && \ 4311.113Suebayasi list_set_lists_common_ad $1 rescue 4321.111Suebayasi} 4331.111Suebayasi 4341.113Suebayasilist_set_lists_common_ad() 4351.111Suebayasi{ 4361.113Suebayasi setdir=$setsdir/lists/$1; _prefix=$2 4371.113Suebayasi 4381.113Suebayasi [ -n "$_prefix" ] && prefix="$_prefix". 4391.113Suebayasi 4401.113Suebayasi # Prefer a <prefix>.ad.${MACHINE_ARCH} over a 4411.113Suebayasi # <prefix>.ad.${MACHINE_CPU}, since the arch- 4421.112Suebayasi # specific one will be more specific than the 4431.112Suebayasi # cpu-specific one. 4441.113Suebayasi echo_if_exist $setdir/${prefix}ad.${MACHINE_ARCH} || \ 4451.113Suebayasi echo_if_exist $setdir/${prefix}ad.${MACHINE_CPU} 4461.113Suebayasi [ "$shlib" != "no" ] && \ 4471.113Suebayasi echo_if_exist $setdir/${prefix}ad.${MACHINE_CPU}.shl 4481.5Sdyoung} 4491.5Sdyoung 4501.110Suebayasiecho_if_exist() 4511.110Suebayasi{ 4521.110Suebayasi [ -f $1 ] && echo $1 4531.110Suebayasi return $? 4541.110Suebayasi} 4551.110Suebayasi 4561.110Suebayasiecho_if_exist_foreach() 4571.110Suebayasi{ 4581.110Suebayasi local _list=$1; shift 4591.110Suebayasi for _suffix in $@; do 4601.110Suebayasi echo_if_exist ${_list}.${_suffix} 4611.110Suebayasi done 4621.110Suebayasi} 4631.110Suebayasi 4641.116Suebayasiprint_set_lists() 4651.116Suebayasi{ 4661.116Suebayasi for setname; do 4671.116Suebayasi list=`list_set_lists $setname` 4681.116Suebayasi for l in $list; do 4691.116Suebayasi echo $l 4701.116Suebayasi if $verbose; then 4711.116Suebayasi echo >&2 "DEBUG: list_set_files: $l" 4721.116Suebayasi fi 4731.116Suebayasi done 4741.116Suebayasi done | xargs ${SED} ${SUBST} 4751.116Suebayasi} 4761.116Suebayasi 4771.9Slukem# arch_to_cpu mach 4781.9Slukem# 4791.11Slukem# Print the ${MACHINE_CPU} for ${MACHINE_ARCH}=mach, 4801.9Slukem# as determined by <bsd.own.mk>. 4811.9Slukem# 4821.8Slukemarch_to_cpu() 4831.8Slukem{ 4841.56Sapb MACHINE_ARCH=${1} ${MAKE} -B -f- all <<EOMAKE 4851.5Sdyoung.include <bsd.own.mk> 4861.5Sdyoungall: 4871.5Sdyoung @echo \${MACHINE_CPU} 4881.12SlukemEOMAKE 4891.1Sdyoung} 4901.46Sapb 4911.46Sapb# arch_to_endian mach 4921.46Sapb# 4931.46Sapb# Print the ${TARGET_ENDIANNESS} for ${MACHINE_ARCH}=mach, 4941.46Sapb# as determined by <bsd.endian.mk>. 4951.46Sapb# 4961.46Sapbarch_to_endian() 4971.46Sapb{ 4981.56Sapb MACHINE_ARCH=${1} ${MAKE} -B -f- all <<EOMAKE 4991.46Sapb.include <bsd.endian.mk> 5001.46Sapball: 5011.46Sapb @echo \${TARGET_ENDIANNESS} 5021.46SapbEOMAKE 5031.46Sapb} 5041.117Suebayasi 5051.117Suebayasi##### 5061.117Suebayasi 5071.117Suebayasi# print_mkvars 5081.117Suebayasiprint_mkvars() 5091.117Suebayasi{ 5101.117Suebayasi for v in $MKVARS; do 5111.117Suebayasi eval echo $v=\$$v 5121.117Suebayasi done 5131.117Suebayasi} 5141.117Suebayasi 5151.117Suebayasi# print_set_lists_{base,x,ext} 5161.117Suebayasi# list_set_lists_{base,x,ext} 5171.117Suebayasi# list_set_files_{base,x,ext} 5181.117Suebayasifor func in print_set_lists list_set_lists list_set_files; do 5191.117Suebayasi for x in base x ext; do 5201.117Suebayasi if [ $x = base ]; then 5211.117Suebayasi list=nlists 5221.117Suebayasi else 5231.117Suebayasi list=${x}lists 5241.117Suebayasi fi 5251.117Suebayasi eval ${func}_${x} \(\) \{ $func \$$list \; \} 5261.117Suebayasi done 5271.117Suebayasidone 528