#!/bin/rc
echo '
APE=/sys/src/ape
<$APE/config
LIB=libXXX.a'
if(~ $#* 0) {
dirs = `{du -a |grep '\.c$'|awk '{print $2}'|sed -e's%[^/]*$%%' -e 's%^\./(.)%\1%' |sort -u}
}
if not {
dirs = $*
}
echo '#dirs = ' ' '^$dirs
echo 'OFILES=\'
for(d in $dirs) {
ls $d/*.c | sed -e 's%.*/([^/]*)$%\1%' -e 's/\.c/\.$O\\/' | awk '{print "\t" $1 }'
}
echo # Make sure we have a new line after last file!
cat <<'EOF'
HFILES=config.h
UPDATE=\
mkfile\
$HFILES\
${OFILES:%.$O=%.c}\
${TARG:%=%.c}\
${LIB}\
</sys/src/cmd/mklib
CFLAGS=-c -I/sys/include/ape -D_POSIX_SOURCE -D_BSD_EXTENSION -D_SUSV2_SOURCE -D__PLAN9__ -D_PLAN9_SOURCE
EOF
for(d in $dirs) {
echo '%.$O: '$d'%.c'
echo ' $CC $CFLAGS '$d'$stem.c'
}
|