1#!/bin/sh 2# 3# $NetBSD: makeflist,v 1.56 2002/11/26 06:22:22 lukem Exp $ 4# 5# Print out the files in some or all lists. 6# Usage: makeflist [-b] [-x] [-a arch] [-m machine] [-s setsdir] [setname ...] 7# 8 9# set defaults 10make="${MAKE:-make} -j 1 -f `dirname $0`/Makefile" 11machine=`${make} print_machine` 12machine_arch=`${make} print_machine_arch` 13machine_cpu=`${make} print_machine_cpu` 14object_fmt=`${make} print_object_fmt` 15toolchain_missing=`${make} print_toolchain_missing` 16x11_version=`${make} print_x11_version` 17setd=`pwd` 18nlists="base comp etc games man misc text" 19xlists="xbase xcomp xcontrib xfont xserver xmisc" 20lists=$nlists 21 22# handle args 23while : ; do 24 case $1 in 25 -b*) 26 lists="$xlists $nlists" 27 ;; 28 -x*) 29 lists=$xlists 30 ;; 31 -a*) 32 machine_arch=`MACHINE_ARCH=${2} ${make} print_machine_arch` 33 machine_cpu=`MACHINE_ARCH=${2} ${make} print_machine_cpu` 34 shift 35 ;; 36 -m*) 37 machine=$2; shift 38 ;; 39 -s*) 40 setd=$2; shift 41 ;; 42 -*) 43 cat 1>&2 <<USAGE 44Usage: $0 [-b] [-x] [-a arch] [-m machine] [-s setsdir] [setname ...] 45 -b make netbsd + x11 lists 46 -x only make x11 lists 47 -a arch set arch (e.g, m68k, mipseb, mipsel, powerpc) [$machine_arch] 48 -m machine set machine (e.g, amiga, i386, macppc) [$machine] 49 -s setsdir directory to find sets [$setd] 50 [setname ...] sets to build [$lists] 51USAGE 52 exit 1 53 ;; 54 *) 55 break 56 ;; 57 esac 58 shift 59done 60if [ -n "$1" ]; then 61 lists="$@" 62fi 63 64# Determine lib type. 65if [ "$object_fmt" = "ELF" ]; then 66 shlib=elf 67else 68 shlib=aout 69fi 70stlib=$shlib 71 72# Turn off shlibs for some ports. 73if [ "$machine_cpu" = "sh3" -o "$machine_arch" = "m68000" ]; then 74 shlib=no 75fi 76 77# Turn off lintlibs for some ports. 78lintlibs= 79if [ "$machine" = "x86_64" ]; then 80 lintlibs=no 81fi 82 83# Automatically add XFree86 version specific sets 84for list in $lists 85do 86 if [ -z "$_lists" ] 87 then 88 _lists=$list 89 else 90 _lists="$_lists $list" 91 fi 92 if [ -d "$setd/lists/$list${x11_version}" ] 93 then 94 _lists="$_lists $list${x11_version}" 95 fi 96done 97lists=$_lists 98unset _lists 99 100for setname in $lists; do 101 cat $setd/lists/$setname/mi 102 if [ "$machine" != "$machine_arch" ]; then 103 # Prefer an ad.${machine_arch} over an ad.${machine_cpu}, 104 # since the arch-specific one will be more specific than 105 # the cpu-specific one. 106 if [ -f $setd/lists/$setname/ad.${machine_arch} ]; then 107 cat $setd/lists/$setname/ad.${machine_arch} 108 elif [ -f $setd/lists/$setname/ad.${machine_cpu} ]; then 109 cat $setd/lists/$setname/ad.${machine_cpu} 110 fi 111 if [ "$shlib" != "no" -a \ 112 -f $setd/lists/$setname/ad.${machine_cpu}.shl ]; then 113 cat $setd/lists/$setname/ad.${machine_cpu}.shl 114 fi 115 fi 116 if [ -f $setd/lists/$setname/md.${machine} ]; then 117 cat $setd/lists/$setname/md.${machine} 118 fi 119 if [ -f $setd/lists/$setname/stl.mi ]; then 120 cat $setd/lists/$setname/stl.mi 121 fi 122 if [ -f $setd/lists/$setname/stl.${stlib} ]; then 123 cat $setd/lists/$setname/stl.${stlib} 124 fi 125 if [ "$shlib" != "no" ]; then 126 if [ -f $setd/lists/$setname/shl.mi ]; then 127 cat $setd/lists/$setname/shl.mi 128 fi 129 if [ -f $setd/lists/$setname/shl.${shlib} ]; then 130 cat $setd/lists/$setname/shl.${shlib} 131 fi 132 fi 133 if [ "$lintlibs" != no ]; then 134 if [ -f $setd/lists/$setname/lint.mi ]; then 135 cat $setd/lists/$setname/lint.mi 136 fi 137 fi 138 if [ "$toolchain_missing" != "yes" ]; then 139 if [ -f $setd/lists/$setname/tc.mi ]; then 140 cat $setd/lists/$setname/tc.mi 141 fi 142 if [ "$shlib" != "no" ]; then 143 if [ -f $setd/lists/$setname/tc.shl ]; then 144 cat $setd/lists/$setname/tc.shl 145 fi 146 fi 147 fi 148 149 # XXX MIPS does not support rescue right now. 150 if [ ${machine_cpu} = "mips" ]; then 151 continue 152 fi 153 154 if [ -f $setd/lists/$setname/rescue.mi ]; then 155 cat $setd/lists/$setname/rescue.mi 156 fi 157 if [ -f $setd/lists/$setname/rescue.${machine} ]; then 158 cat $setd/lists/$setname/rescue.${machine} 159 fi 160 if [ "$machine" != "$machine_arch" ]; then 161 # Prefer a rescue.ad.${machine_arch} over a 162 # rescue.ad.${machine_cpu}, since the arch- 163 # specific one will be more specific than the 164 # cpu-specific one. 165 if [ -f $setd/lists/$setname/rescue.ad.${machine_arch} ]; then 166 cat $setd/lists/$setname/rescue.ad.${machine_arch} 167 elif [ -f $setd/lists/$setname/rescue.ad.${machine_cpu} ]; then 168 cat $setd/lists/$setname/rescue.ad.${machine_cpu} 169 fi 170 if [ "$shlib" != "no" -a -f \ 171 $setd/lists/$setname/rescue.ad.${machine_cpu}.shl ]; then 172 cat $setd/lists/$setname/rescue.ad.${machine_cpu}.shl 173 fi 174 fi 175done | awk -- '/^[^#]/ {print $1}' | sort -u 176