makeflist revision 1.58
1#!/bin/sh 2# 3# $NetBSD: makeflist,v 1.58 2003/01/29 11:32:46 simonb 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. 78# Not needed anymore, leave the hook here for future use. 79lintlibs= 80 81# Automatically add XFree86 version specific sets 82for list in $lists 83do 84 if [ -z "$_lists" ] 85 then 86 _lists=$list 87 else 88 _lists="$_lists $list" 89 fi 90 if [ -d "$setd/lists/$list${x11_version}" ] 91 then 92 _lists="$_lists $list${x11_version}" 93 fi 94done 95lists=$_lists 96unset _lists 97 98for setname in $lists; do 99 cat $setd/lists/$setname/mi 100 if [ "$machine" != "$machine_arch" ]; then 101 # Prefer an ad.${machine_arch} over an ad.${machine_cpu}, 102 # since the arch-specific one will be more specific than 103 # the cpu-specific one. 104 if [ -f $setd/lists/$setname/ad.${machine_arch} ]; then 105 cat $setd/lists/$setname/ad.${machine_arch} 106 elif [ -f $setd/lists/$setname/ad.${machine_cpu} ]; then 107 cat $setd/lists/$setname/ad.${machine_cpu} 108 fi 109 if [ "$shlib" != "no" -a \ 110 -f $setd/lists/$setname/ad.${machine_cpu}.shl ]; then 111 cat $setd/lists/$setname/ad.${machine_cpu}.shl 112 fi 113 fi 114 if [ -f $setd/lists/$setname/md.${machine} ]; then 115 cat $setd/lists/$setname/md.${machine} 116 fi 117 if [ -f $setd/lists/$setname/stl.mi ]; then 118 cat $setd/lists/$setname/stl.mi 119 fi 120 if [ -f $setd/lists/$setname/stl.${stlib} ]; then 121 cat $setd/lists/$setname/stl.${stlib} 122 fi 123 if [ "$shlib" != "no" ]; then 124 if [ -f $setd/lists/$setname/shl.mi ]; then 125 cat $setd/lists/$setname/shl.mi 126 fi 127 if [ -f $setd/lists/$setname/shl.${shlib} ]; then 128 cat $setd/lists/$setname/shl.${shlib} 129 fi 130 fi 131 if [ "$lintlibs" != no ]; then 132 if [ -f $setd/lists/$setname/lint.mi ]; then 133 cat $setd/lists/$setname/lint.mi 134 fi 135 fi 136 if [ "$toolchain_missing" != "yes" ]; then 137 if [ -f $setd/lists/$setname/tc.mi ]; then 138 cat $setd/lists/$setname/tc.mi 139 fi 140 if [ "$shlib" != "no" ]; then 141 if [ -f $setd/lists/$setname/tc.shl ]; then 142 cat $setd/lists/$setname/tc.shl 143 fi 144 fi 145 fi 146 147 if [ -f $setd/lists/$setname/rescue.mi ]; then 148 cat $setd/lists/$setname/rescue.mi 149 fi 150 if [ -f $setd/lists/$setname/rescue.${machine} ]; then 151 cat $setd/lists/$setname/rescue.${machine} 152 fi 153 if [ "$machine" != "$machine_arch" ]; then 154 # Prefer a rescue.ad.${machine_arch} over a 155 # rescue.ad.${machine_cpu}, since the arch- 156 # specific one will be more specific than the 157 # cpu-specific one. 158 if [ -f $setd/lists/$setname/rescue.ad.${machine_arch} ]; then 159 cat $setd/lists/$setname/rescue.ad.${machine_arch} 160 elif [ -f $setd/lists/$setname/rescue.ad.${machine_cpu} ]; then 161 cat $setd/lists/$setname/rescue.ad.${machine_cpu} 162 fi 163 if [ "$shlib" != "no" -a -f \ 164 $setd/lists/$setname/rescue.ad.${machine_cpu}.shl ]; then 165 cat $setd/lists/$setname/rescue.ad.${machine_cpu}.shl 166 fi 167 fi 168done | awk -- '/^[^#]/ {print $1}' | sort -u 169