<../../mkconfig

#
#	Utils we build everywhere, because the Plan 9 versions don't yet
#	contain our changes (or they don't exist on Plan 9).
#	Fairly soon the Plan 9 compilers will be updated to match.
#
ALWAYS=\
	libmach\
	libregexp\
	iar\
	cc\
	5a\
	5c\
	5l\
	5coff\
	5cv\
	sqz\
#	tc\
	acid\
	srclist\
	ms2\
	data2c\
	data2s\
	kprof\
	mkppcimage\
	nm\

#
#	Utils we build on Posix and Nt, which already exist on Plan 9.
#
NOTPLAN9=\
	iyacc\
	6a\
	6c\
	6l\
#	7a\
#	7c\
#	7l\
	8a\
	8c\
	8l\
	9a\
	9c\
	9l\
	qa\
	qc\
	ql\
	va\
	vc\
	vl\
	ka\
	kc\
	kl\
	mk\
	ksize\
	kstrip\

#
#	Utils we build on Nt, for build environment compatibility.
#
NTONLY=\
	cp\
	echo\
	mkdir\
	mv\
	rcsh\
	rm\
	sed\
	test\
#	tr\

all:QV:		all-$TARGMODEL
clean:QV:	clean-$TARGMODEL
install:QV:	install-$TARGMODEL
installall:QV:	installall-$TARGMODEL
nuke:QV:	nuke-$TARGMODEL

%-Plan9:QV:
	for (j in $ALWAYS)
	{
		test -d $j && {
			echo '@{cd' $j '; mk $MKFLAGS $stem}'
			@{cd $j; mk $MKFLAGS $stem }
		} || test ! -e $j
	}

%-Posix:QV:
	for j in  $ALWAYS $NOTPLAN9
	do
		test -d $j || continue
		echo "(cd $j; mk $MKFLAGS $stem)"
		(cd $j; mk $MKFLAGS $stem) || exit 1
	done

%-Nt:QV:
	for (j in  $ALWAYS $NTONLY $NOTPLAN9)
	{
		test -d $j && {
			echo.exe '@{cd' $j '; mk $MKFLAGS $stem}'
			@{cd $j; mk $MKFLAGS $stem }
		} || test ! -e $j
	}
