: 'cmake -- make commands that are a single file'
: 'This script runs faster than a huge makefile and is easier to manage'
: 'than a sea of *.mk files or directories'
FLAGS="-O "
LIBS="-lin"
CC=cc
C=
for a in $*
do
	s=.c
	case $a in
	*.y)	s=.y ;;
	*.s)	s=.s ;;
	*.sh)	s=.sh ;;
	esac
	b=`basename $a $s`
	D=/bin
	M=a+x
	echo $a:
	case $b in
	-cmp)	C=cmp
		continue ;;
	-cp)	C=cp
		FLAGS="$FLAGS -s"
		continue ;;
	-test)	C=test
		continue ;;
	route)	$CC $CFLAGS route.c $LIBS -o route;;
	remroutes) $CC $CFLAGS remroutes.c $LIBS -o remroutes; D=/etc;;
	udpconfig) $CC $CFLAGS udpconfig.c $LIBS -o udpconfig; D=/usr/ipc/mgrs;;
	ping)	$CC $CFLAGS ping.c $LIBS -o ping; D=/etc;;
	mping)  $CC $CFLAGS mping.c $LIBS -o mping; D=/bin;;
	pound)	$CC $CFLAGS pound.c $LIBS -o pound; D=/etc;;
	ipconfig) $CC $CFLAGS ipconfig.c $LIBS -o ipconfig; D=/usr/ipc/mgrs;;
	netstat) $CC $CFLAGS netstat.c $LIBS -o netstat;;
	tcpmgr)	$CC $CFLAGS tcpmgr.c -o tcpmgr; D=/usr/ipc/mgrs;;
	rlogind)$CC $CFLAGS rlogind.c $LIBS -o rlogind; D=/usr/ipc/mgrs;;
	snm)$CC $CFLAGS snm.c $LIBS -o snm; D=/usr/ipc/mgrs;;
	smg)$CC $CFLAGS smg.c $LIBS -o smg; D=/usr/ipc/mgrs;;
	eko)$CC $CFLAGS eko.c $LIBS -o eko; D=/usr/ipc/mgrs;;
	usmg)$CC $CFLAGS usmg.c $LIBS -o usmg; D=/usr/ipc/mgrs;;
	flushroutes) cp flushroutes.sh flushroutes; D=/etc;;
	lrconfig) $CC $CFLAGS lrconfig.c -o lrconfig; D=/usr/ipc/mgrs;;
	fnd)	$CC $CFLAGS fnd.c -lin -o fnd; D=/usr/ipc/mgrs;;
	*)	echo "cmake: don't know about $b"
		continue ;;
	esac || continue
	case $C in
	test)	rm -f $b ;; 
	cmp)	cmp $b $D/$b && rm -f $b ;;
	cp)	cp $b $D/$b && rm -f $b && chmod $M $D/$b ;;
	esac
done
