Plan 9 from Bell Labs’s /usr/web/sources/contrib/uriel/scripts/gen-mk

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/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'
}


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.