note *
note * This build script is in an extended Make Abstract Machine (MAM)
note * language. Documentation is at: src/cmd/INIT/README-mamake.md
note *

setv MAMAKE_STRICT 4
setv INSTALLROOT ../../..
setv PACKAGEROOT ../../../../..
setv INCLUDE_AST %{INSTALLROOT}/include/ast
setv CC cc
setv AR %{mam_cc_AR} %{mam_cc_AR_ARFLAGS}
setv mam_cc_FLAGS %{mam_cc_TARGET} %{mam_cc_DLL} -D_BLD_ast %{-debug-symbols?1?%{mam_cc_DEBUG} -D_BLD_DEBUG?%{mam_cc_OPTIMIZE}?}
setv CCFLAGS
setv CCLDFLAGS %{-strip-symbols?1?%{mam_cc_LD_STRIP}??}
setv IFFEFLAGS
setv LDFLAGS
setv DYLIB_PRE %{mam_cc_SUFFIX_DYNAMIC?*?%{mam_cc_PREFIX_DYNAMIC}?%{mam_cc_PREFIX_SHARED}?}
setv DYLIB_SUF %{mam_cc_SUFFIX_DYNAMIC-%{mam_cc_SUFFIX_SHARED}}
setv DYLIB_VERSION 6.0

note *
note * iffe and cc invocations are mostly the same but some add custom flags;
note * set shim functions for brevity and "single source of truth" while allowing for variety in invocations
note *

shim - invoke_iffe()
shim - {
shim -     s=$1
shim -     shift
shim -     set -- %{CC} %{mam_cc_FLAGS} %{CCFLAGS} %{mam_cc_NOSTRICTALIASING} %{LDFLAGS} "$@"
shim -     iffe %{IFFEFLAGS} -v -X ast -X std -c "$*" run "$s"
shim - }
shim -
shim - compile()
shim - {
shim -     s=$1
shim -     shift
shim -     %{CC} %{mam_cc_FLAGS} %{CCFLAGS} %{mam_cc_NOSTRICTALIASING} -I. -Icomp "$@" -Iinclude -Istd -c "$s"
shim - }

make install virtual
	note *
	note * Generate release information
	note *
	note * (The target is 'virtual' as it needs to be run at
	note * every build, so we can catch changes of git commit)
	note *
	make releaseflags.h notrace virtual
		exec -	git_commit=$(git rev-parse --short=8 HEAD 2>/dev/null)
		exec -	case $?,$git_commit in
		exec -	0,[0-9a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z])
		exec -		echo "/* generated by libast/Mamfile using $(git --version) */"
		exec -		git update-index --really-refresh >/dev/null
		exec -		git diff-index --quiet HEAD
		exec -		wd_clean=$((! $?))	# working directory clean?
		exec -		case $(git branch) in
		exec -		*\*\ [0-9]*.[0-9]*)
		exec -			# If we're not on a branch that starts with a number
		exec -			# (release branch), then compile as a release version
		exec -			case $wd_clean in
		exec -			1)	echo "#ifndef _AST_release"
		exec -				echo "#    define _AST_release	1"
		exec -				echo "#endif"
		exec -				;;
		exec -			0)	echo "/*"
		exec -				echo " * on a git release branch, but changes were made;"
		exec -				echo " * _AST_release not defined by default"
		exec -				echo " */"
		exec -				;;
		exec -			esac
		exec -			;;
		exec -		*)
		exec -			echo "/* not on a git release branch; _AST_release not defined by default */"
		exec -			;;
		exec -		esac
		exec -		test "$wd_clean" -eq 0 && git_commit=$git_commit/MOD
		exec -		echo "#define _AST_git_commit   \"$git_commit\""
		exec -		echo "# current git commit: $git_commit" >&2  # for the log
		exec -		;;
		exec -	*)
		exec -		echo "/* generated by libast/Mamfile (we're not in a git repo) */"
		exec -		echo "#ifndef _AST_release"
		exec -		echo "#    define _AST_release	1"
		exec -		echo "#endif"
		exec -		echo "#undef _AST_git_commit"
		exec -		;;
		exec -	esac > releaseflags.h.new
		exec -	if	cmp -s releaseflags.h.new releaseflags.h
		exec -	then	rm -f releaseflags.h.new
		exec -	else	mv -f releaseflags.h.new releaseflags.h
		exec -	fi
	done

	note *
	note * Generate some fundamental headers from iffe feature tests
	note *

	note * The standards test influences all subsequent iffe feature tests, so must be made first
	make ast_standards.h
		make FEATURE/standards
			makp features/standards
			exec - invoke_iffe %{<}
		done
		exec - cp -f %{<} %{@}
	done

	note * AST API versioning voodoo
	make ast_api.h
		make FEATURE/api
			makp features/api
			exec - invoke_iffe %{<}
		done
		exec - cp -f %{<} %{@}
	done

	note * Compiler features, basic system headers, backward compat, etc. -- included by just about everything
	make ast_common.h
		make FEATURE/common
			makp features/common
			exec - invoke_iffe %{<}
		done
		note * include <ast_map.h> from ast_common.h but not from FEATURE/common
		exec - sed '/define _def_map_ast/d' < %{<} > %{@}
	done ast_common.h

	note * Main feature test for system libraries
	make ast_lib.h
		make FEATURE/lib
			makp features/lib
			exec - invoke_iffe %{<}
		done
		exec - cp -f %{<} %{@}
	done

	note * AST replacement for <signal.h>
	make sig.h
		make FEATURE/sig
			makp features/sig.sh
			exec - invoke_iffe %{<}
		done
		exec - cp -f %{<} %{@}
	done

	make FEATURE/eaccess
		makp features/eaccess
		exec - invoke_iffe %{<}
	done

	make ast_mmap.h
		make FEATURE/mmap
			makp features/mmap
			exec - invoke_iffe %{<}
		done
		exec - cp -f %{<} %{@}
	done

	make FEATURE/options
		makp features/options
		exec - invoke_iffe %{<}
	done

	make ast_map.h
		make FEATURE/map
			make features/map.c
				prev sig.h
				prev FEATURE/api
				prev FEATURE/eaccess
				prev FEATURE/options
				prev FEATURE/mmap
				prev FEATURE/lib
			done
			exec - invoke_iffe %{<} -I.
		done
		exec - cp -f %{<} %{@}
	done ast_map.h

	make std/endian.h
		make std/bytesex.h
			prev ast_common.h
			prev ast_map.h
		done std/bytesex.h
	done std/endian.h


	note * Checks for system headers, data types, and C library functions. Emits prorotypes if needed.
	make ast_sys.h
		make FEATURE/sys
			makp features/sys
			exec - invoke_iffe %{<}
			prev std/endian.h
		done
		exec - cp -f %{<} %{@}
	done

	note * Feature test for atomic integer operations
	make FEATURE/aso
		prev FEATURE/common
		makp features/aso
		exec - invoke_iffe %{<}
	done

	make ast_wait.h
		make FEATURE/wait
			makp features/wait
			exec - invoke_iffe %{<}
		done
		exec - cp -f %{<} %{@}
	done

	make ast_param.h
		make FEATURE/param
			prev std/endian.h
			makp features/param.sh
			exec - invoke_iffe %{<}
		done FEATURE/param
		exec - cp -f %{<} %{@}
	done

	make ast_fs.h
		make FEATURE/fs
			makp features/fs
			exec - invoke_iffe %{<}
		done
		exec - cp -f %{<} %{@}
	done

	make ast_tty.h
		make FEATURE/tty
			prev ast_lib.h
			makp features/tty
			exec - invoke_iffe %{<}
		done
		exec - cp -f %{<} %{@}
	done

	make ast_fcntl.h
		prev ast_fs.h
		make FEATURE/fcntl
			prev ast_fs.h
			make features/fcntl.c
				prev FEATURE/tty
				prev FEATURE/fs
				prev FEATURE/lib
				prev FEATURE/standards
			done
			exec - invoke_iffe %{<} -I. -Icomp -Iinclude -Istd
		done
		exec - cp -f %{<} %{@}
	done

	make ast_wchar.h
		make FEATURE/wchar
			makp std/wctype.h
			makp std/stdio.h
			prev ast_common.h
			make features/wchar
				prev ast_common.h
			done
			exec - invoke_iffe %{<}
		done
		exec - cp -f %{<} %{@}
		prev std/stdio.h
		prev ast_common.h
	done

	note *
	note * Generate system library dependency information
	note *

	make ast.req
		note *
		note * generate initial ast.req
		note *
		makp %{INSTALLROOT}/bin/mkreq
		exec - set -o errexit
		exec - mkreq %{CC} %{mam_cc_FLAGS} %{CCFLAGS} %{mam_cc_NOSTRICTALIASING} : %{LDFLAGS} : ast iconv w
		note *
		note * some systems move -lc routines to -lm; see astmath.c for details
		note *
		make astmath.out
			make port/astmath.c
				prev std/endian.h
			done
			setv _math_test %{CC} %{CCLDFLAGS} %{mam_cc_FLAGS} %{CCFLAGS} %{mam_cc_NOSTRICTALIASING} %{LDFLAGS} -DN=$N -DIS -o astmath.exe %{<}
			exec - X=1
			exec - for N in 1 2 3 4 5 6 7 8
			exec - do	if	%{_math_test} 2>/dev/null
			exec -		then	: math function N=$N :
			exec -		elif	%{_math_test} -lm
			exec -		then	: math function N=$N requires -lm :
			exec -			X=0
			exec -			break
			exec -		else	: ERROR: %{<} fails to compile or link, even with -lm :
			exec -			exit 1
			exec -		fi
			exec - done
			exec - (set +f; exec rm -rf astmath.exe*)
			exec - echo $X > astmath.out
		done
		note *
		note * add library dependencies resulting from the aso feature test
		note *
		prev FEATURE/aso
		exec - sed -e '/^#define _REQ_/!d' -e 's/#define _REQ_\([a-z0-9_]*\).*/ -l\1/' %{<} >> %{@}
		note *
		note * add -lm if the astmath.c probe found it necessary
		note *
		exec - read no_libm_needed <astmath.out
		exec - case $no_libm_needed in
		exec - 0)	echo ' -lm' >> %{@} ;;
		exec - *)	touch %{@} ;;
		exec - esac
	done ast.req

	note *
	note * Probe all manner of configuration values from conf.tab
	note * These are used for astconf(3) and the getconf(1) built-in
	note *

	make ast_limits.h
		make FEATURE/limits
			make features/limits.c
				prev FEATURE/param
				prev FEATURE/common
				prev FEATURE/lib
				prev FEATURE/standards
				make conflim.h
					prev FEATURE/standards
					prev FEATURE/common
					prev FEATURE/param
					prev FEATURE/wait
					make conf
						makp comp/conf.sh
						exec - cat - comp/conf.sh <<'EOF' >conf && chmod u+w,+x conf
						exec - HOSTTYPE='%{mam_cc_HOSTTYPE}'
						exec - EOF
					done
					makp comp/conf.tab
					exec - conf -v %{<} %{CC} %{mam_cc_FLAGS} %{CCFLAGS} %{mam_cc_NOSTRICTALIASING}
				done
			done features/limits.c
			exec - invoke_iffe %{<} -I. -Icomp -Iinclude -Istd
		done FEATURE/limits
		exec - cp -f %{<} %{@}
	done ast_limits.h


	note *
	note * Declare header dependencies
	note *

	make include/ast.h
		prev ast_api.h
		make include/ast_std.h
			make include/regex.h
				prev ast_api.h
				prev ast_wchar.h
				prev ast_common.h
			done
			prev ast_map.h
			prev ast_limits.h
			prev ast_fcntl.h
			prev ast_sys.h
			prev ast_lib.h
			prev ast_common.h
			prev ast_standards.h
		done include/ast_std.h
		make include/sfio.h
			makp include/sfio_s.h
			prev ast_common.h
			prev include/ast_std.h
		done
	done

	make include/stak.h
		make include/stk.h
			prev include/sfio.h
		done
	done

	makp include/magicid.h
	makp include/tar.h
	makp include/vdb.h

	note *
	note * Generate more header files based on iffe feature tests
	note *

	make ast_dirent.h
		prev include/ast_std.h
		make FEATURE/dirent
			prev include/ast_std.h
			makp features/dirent
			exec - invoke_iffe %{<}
		done
		exec - cp -f %{<} %{@}
	done

	make ast_wctype.h
		make FEATURE/wctype
			makp features/wctype
			exec - invoke_iffe %{<}
			prev std/endian.h
			make std/wchar.h
				prev ast_wchar.h
			done
		done
		exec - cp -f %{<} %{@}
	done

	make ast_stdio.h
		prev include/sfio_s.h
		prev include/ast_std.h
		make FEATURE/stdio
			prev include/sfio_s.h
			prev include/ast_std.h
			makp features/stdio
			exec - invoke_iffe %{<}
		done FEATURE/stdio
		exec - cp -f %{<} %{@}
	done ast_stdio.h

	make ast_nl_types.h
		make FEATURE/nl_types
			makp features/nl_types
			exec - invoke_iffe %{<}
		done
		exec - cp -f %{<} %{@}
	done

	make ast_mode.h
		make FEATURE/mode
			make features/mode.c
				makp include/modecanon.h
				prev FEATURE/param
			done
			exec - invoke_iffe %{<} -I. -Iinclude -Istd
		done
		exec - cp -f %{<} %{@}
	done

	make FEATURE/syscall
		makp features/syscall
		exec - invoke_iffe %{<}
	done

	make FEATURE/hack
		make features/hack
			prev FEATURE/common
		done
		exec - invoke_iffe %{<}
	done

	make ast_ccode.h
		make FEATURE/ccode
			makp features/ccode
			exec - invoke_iffe %{<}
		done
		exec - cp -f %{<} %{@}
	done

	make ast_time.h
		make FEATURE/time
			makp features/time
			exec - invoke_iffe %{<}
		done
		exec - cp -f %{<} %{@}
	done

	make tv.h
		prev include/ast.h
		make FEATURE/tv
			prev include/ast.h
			makp features/tv
			exec - invoke_iffe %{<}
		done
		exec - cp -f %{<} %{@}
	done

	make ast_float.h
		make FEATURE/float
			prev ast_common.h
			makp features/float
			exec - invoke_iffe %{<}
		done
		exec - cp -f %{<} %{@}
	done

	make lc.h
		prev include/ast.h
		makp port/lc.tab
		make lctab.c
			make port/lclang.h
				makp include/ast_windows.h
			done
			make lcgen
				make port/lcgen.c
					prev std/stdio.h
				done
				exec - %{CC} %{CCLDFLAGS} %{CCFLAGS} %{mam_cc_NOSTRICTALIASING} %{LDFLAGS} -o lcgen port/lcgen.c
			done
			exec - lcgen lc.h lctab.c < port/lc.tab
		done
		note * the lctab.c action above generates both lc.h and lctab.c; we now
		note * need a dummy shell action for lc.h to mark it as generated as well
		exec - test -f lc.h
	done
	note * The following block was moved out of lc.h to resolve a circular dependency on lc.h.
	note * We have to break the dependency loop somewhere: lctab.c depends on lclib.h but we cannot declare that here.
	make port/lclib.h
		prev lc.h
		make include/error.h
			make include/option.h
				prev include/ast.h
			done
			prev include/ast.h
		done
		prev include/ast.h
	done

	make ast_ndbm.h
		make FEATURE/ndbm
			prev std/stdio.h
			makp features/ndbm
			exec - invoke_iffe %{<}
		done
		exec - cp -f %{<} %{@}
	done

	make ast_sizeof.h
		make FEATURE/sizeof
			makp features/sizeof
			exec - invoke_iffe %{<}
		done
		exec - cp -f %{<} %{@}
	done

	make align.h
		make FEATURE/align
			make features/align.c
				prev FEATURE/common
			done
			exec - invoke_iffe %{<} -I.
		done
		exec - cp -f %{<} %{@}
	done

	note *
	note * Build the library
	note *

	make libast.a
		make state.o
			make misc/state.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make opendir.o
			make dir/opendir.c
				make dir/dirlib.h
					makp dir/dirstd.h
					prev ast_param.h
					make std/dirent.h
						prev ast_dirent.h
					done
					prev std/dirent.h
					make include/ls.h
						prev ast_mode.h
						prev ast_fs.h
						prev include/ast_std.h
					done
					prev include/ast.h
				done
			done
			exec - compile %{<} -Idir
		done

		make readdir.o
			make dir/readdir.c
				prev dir/dirlib.h
			done
			exec - compile %{<} -Idir
		done

		make rewinddir.o
			make dir/rewinddir.c
				prev dir/dirlib.h
			done
			exec - compile %{<} -Idir
		done

		make seekdir.o
			make dir/seekdir.c
				prev dir/dirlib.h
			done
			exec - compile %{<} -Idir
		done

		make telldir.o
			make dir/telldir.c
				prev dir/dirlib.h
			done
			exec - compile %{<} -Idir
		done

		make getcwd.o
			make misc/getcwd.c
				make include/ast_dir.h
					prev std/dirent.h
					prev dir/dirlib.h
					prev ast_lib.h
				done
				prev include/error.h
				prev FEATURE/syscall
				prev include/ast.h
			done
			exec - compile %{<} -Idir
		done

		make fastfind.o
			make misc/fastfind.c
				make misc/findlib.h
					makp include/find.h
					prev include/regex.h
					prev include/ls.h
					prev include/error.h
					prev std/endian.h
					make include/cdt.h
						prev ast_common.h
						prev include/ast_std.h
					done
					prev include/ast.h
				done
			done
			exec - compile %{<} -Imisc
		done

		make hashalloc.o
			make hash/hashalloc.c
				prev FEATURE/hack
				make hash/hashlib.h
					make include/hash.h
						makp include/hashpart.h
					done
					prev include/ast.h
				done
			done
			exec - compile %{<} -Ihash
		done

		make hashdump.o
			make hash/hashdump.c
				prev hash/hashlib.h
			done
			exec - compile %{<} -Ihash
		done

		make hashfree.o
			make hash/hashfree.c
				prev hash/hashlib.h
			done
			exec - compile %{<} -Ihash
		done

		make hashlast.o
			make hash/hashlast.c
				prev hash/hashlib.h
			done
			exec - compile %{<} -Ihash
		done

		make hashlook.o
			make hash/hashlook.c
				prev hash/hashlib.h
			done
			exec - compile %{<} -Ihash
		done

		make hashscan.o
			make hash/hashscan.c
				prev hash/hashlib.h
			done
			exec - compile %{<} -Ihash
		done

		make hashsize.o
			make hash/hashsize.c
				prev hash/hashlib.h
			done
			exec - compile %{<} -Ihash
		done

		make hashview.o
			make hash/hashview.c
				prev hash/hashlib.h
			done
			exec - compile %{<} -Ihash
		done

		make hashwalk.o
			make hash/hashwalk.c
				prev hash/hashlib.h
			done
			exec - compile %{<} -Ihash
		done

		make memhash.o
			make hash/memhash.c
				prev hash/hashlib.h
			done
			exec - compile %{<} -Ihash
		done

		make memsum.o
			make hash/memsum.c
				prev hash/hashlib.h
			done
			exec - compile %{<} -Ihash
		done

		make strhash.o
			make hash/strhash.c
				prev hash/hashlib.h
			done
			exec - compile %{<} -Ihash
		done

		make strkey.o
			make hash/strkey.c
				makp include/hashkey.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make strsum.o
			make hash/strsum.c
				prev hash/hashlib.h
			done
			exec - compile %{<} -Ihash
		done

		make stracmp.o
			make string/stracmp.c
				make include/ccode.h
					prev ast_ccode.h
					prev ast_common.h
				done
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make strnacmp.o
			make string/strnacmp.c
				prev include/ccode.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make ccmap.o
			make string/ccmap.c
				prev include/ccode.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make ccmapid.o
			make string/ccmapid.c
				prev include/ccode.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make ccnative.o
			make string/ccnative.c
				prev include/ccode.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make chresc.o
			make string/chresc.c
				prev include/regex.h
				prev include/ccode.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make chrtoi.o
			make string/chrtoi.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make streval.o
			make string/streval.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make strexpr.o
			make string/strexpr.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make strmatch.o
			make string/strmatch.c
				prev include/regex.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make strcopy.o
			make string/strcopy.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make modei.o
			make string/modei.c
				make string/modelib.h
					make include/modex.h
						prev include/modecanon.h
						prev ast_fs.h
					done
					prev include/ls.h
					prev include/ast.h
				done
			done
			exec - compile %{<} -Istring
		done

		make modex.o
			make string/modex.c
				prev string/modelib.h
			done
			exec - compile %{<} -Istring
		done

		make strmode.o
			make string/strmode.c
				prev string/modelib.h
			done
			exec - compile %{<} -Istring
		done

		make strlcat.o
			make string/strlcat.c
				prev ast_map.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make strlcpy.o
			make string/strlcpy.c
				prev ast_map.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make strlook.o
			make string/strlook.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make strncopy.o
			make string/strncopy.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make strsearch.o
			make string/strsearch.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make strpsearch.o
			make string/strpsearch.c
				prev include/ccode.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make stresc.o
			make string/stresc.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make stropt.o
			make string/stropt.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make strtape.o
			make string/strtape.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make strpcmp.o
			make string/strpcmp.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make strnpcmp.o
			make string/strnpcmp.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make strvcmp.o
			make string/strvcmp.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make strnvcmp.o
			make string/strnvcmp.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make tok.o
			make string/tok.c
				make include/tok.h
					prev include/ast.h
				done
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make tokline.o
			make string/tokline.c
				prev include/tok.h
				prev include/error.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make tokscan.o
			make string/tokscan.c
				prev FEATURE/hack
				prev include/tok.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make pathaccess.o
			make path/pathaccess.c
				prev ast_api.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make pathcat.o
			make path/pathcat.c
				prev ast_api.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make pathcanon.o
			make path/pathcanon.c
				prev ast_api.h
				prev include/error.h
				prev include/ls.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make pathcheck.o
			make path/pathcheck.c
				make include/times.h
					prev ast_time.h
					prev include/ast.h
				done
				prev include/error.h
				prev include/ls.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make pathpath.o
			make path/pathpath.c
				prev ast_api.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make pathexists.o
			make path/pathexists.c
				prev include/error.h
				prev include/ls.h
				prev port/lclib.h
			done
			exec - compile %{<} -Iport
		done

		make pathfind.o
			make path/pathfind.c
				prev include/ls.h
				prev include/error.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make pathicase.o
			make path/pathicase.c
				prev include/error.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make pathkey.o
			make path/pathkey.c
				prev ast_api.h
				prev include/ls.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make pathrepl.o
			make path/pathrepl.c
				prev ast_api.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make pathnative.o
			make path/pathnative.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make pathposix.o
			make path/pathposix.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make pathtemp.o
			make path/pathtemp.c
				prev include/error.h
				make include/tm.h
					prev include/times.h
					prev include/ast.h
				done
				prev tv.h
				prev include/ls.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make pathtmp.o
			make path/pathtmp.c
				prev std/stdio.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make pathstat.o
			make path/pathstat.c
				prev include/error.h
				prev include/ls.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make pathgetlink.o
			make path/pathgetlink.c
				make misc/univlib.h
					prev include/ls.h
					prev include/ast.h
				done
			done
			exec - compile %{<} -Imisc
		done

		make pathsetlink.o
			make path/pathsetlink.c
				prev misc/univlib.h
			done
			exec - compile %{<} -Imisc
		done

		make pathbin.o
			make path/pathbin.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make pathshell.o
			make path/pathshell.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make pathcd.o
			make path/pathcd.c
				prev include/stk.h
				prev include/error.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make pathprog.o
			make path/pathprog.c
				make FEATURE/prog
					makp features/prog
					exec - invoke_iffe %{<}
				done
				prev include/ast_windows.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make ftwalk.o
			make misc/ftwalk.c
				make include/ftwalk.h
					make include/fts.h
						prev ast_mode.h
						prev ast_fs.h
						prev include/ast_std.h
					done
				done
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make ftwflags.o
			make misc/ftwflags.c
				prev include/ftwalk.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make fts.o
			make misc/fts.c
				prev include/fts.h
				prev include/ls.h
				prev include/error.h
				prev include/ast_dir.h
				prev include/ast.h
			done
			exec - compile %{<} -Idir
		done

		make astintercept.o
			make misc/astintercept.c
				make misc/intercepts.h
					makp include/shcmd.h
					prev include/ast.h
				done
			done
			exec - compile %{<} -Imisc
		done

		make conformance.o
			make misc/conformance.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make getenv.o
			make misc/getenv.c
				prev misc/intercepts.h
			done
			exec - compile %{<} -Imisc
		done

		make setenviron.o
			make misc/setenviron.c
				prev misc/intercepts.h
			done
			exec - compile %{<} -Imisc
		done

		make optget.o
			make misc/optget.c
				prev include/ccode.h
				make include/debug.h
					prev include/error.h
					prev include/ast.h
				done
				make misc/optlib.h
					prev include/error.h
					prev include/cdt.h
					prev include/ast.h
				done
			done
			exec - compile %{<} -Imisc
		done

		make optjoin.o
			make misc/optjoin.c
				prev misc/optlib.h
			done
			exec - compile %{<} -Imisc
		done

		make optesc.o
			make misc/optesc.c
				prev misc/optlib.h
			done
			exec - compile %{<} -Imisc
		done

		make optctx.o
			make misc/optctx.c
				prev misc/optlib.h
			done
			exec - compile %{<} -Imisc
		done

		make strsort.o
			make string/strsort.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make struniq.o
			make string/struniq.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make magic.o
			make misc/magic.c
				make include/magic.h
					prev include/ls.h
					prev include/sfio.h
				done
				make include/swap.h
					prev ast_common.h
				done
				prev include/regex.h
				prev include/error.h
				prev include/modex.h
				prev include/cdt.h
				prev include/ccode.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make mime.o
			make misc/mime.c
				make misc/mimelib.h
					make include/mime.h
						prev include/ls.h
						prev include/sfio.h
					done
					prev include/tok.h
					prev include/magic.h
					prev include/cdt.h
					prev include/ast.h
				done
			done
			exec - compile %{<} -Imisc
		done

		make mimetype.o
			make misc/mimetype.c
				prev misc/mimelib.h
			done
			exec - compile %{<} -Imisc
		done

		make signal.o
			make misc/signal.c
				prev ast_map.h
				prev sig.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make sigflag.o
			make comp/sigflag.c
				prev sig.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make systrace.o
			make misc/systrace.c
				prev include/debug.h
				make include/proc.h
					prev include/ast.h
				done
				prev include/error.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make error.o
			make misc/error.c
				prev include/regex.h
				prev include/times.h
				prev include/stk.h
				prev sig.h
				makp include/namval.h
				prev include/ccode.h
				prev port/lclib.h
			done
			exec - compile %{<} -Iport -DERROR_CATALOG=\""libast"\"
		done

		make errorf.o
			make misc/errorf.c
				prev include/error.h
			done
			exec - compile %{<}
		done

		make errormsg.o
			make misc/errormsg.c
				prev include/error.h
			done
			exec - compile %{<}
		done

		make errorx.o
			make misc/errorx.c
				prev port/lclib.h
			done
			exec - compile %{<} -Iport
		done

		make localeconv.o
			make comp/localeconv.c
				prev port/lclib.h
			done
			exec - compile %{<} -Iport
		done

		make setlocale.o
			make comp/setlocale.c
				prev include/ast_windows.h
				prev std/wctype.h
				prev include/error.h
				prev include/namval.h
				make include/mc.h
					prev include/ast.h
				done
				prev ast_wchar.h
				prev port/lclib.h
				prev ast_standards.h
			done
			exec - compile %{<} -Iport
		done

		make translate.o
			make misc/translate.c
				make std/nl_types.h
					prev ast_nl_types.h
				done
				prev include/mc.h
				prev include/error.h
				prev include/cdt.h
				prev port/lclib.h
			done
			exec - compile %{<} -Iport
		done

		make catopen.o
			make comp/catopen.c
				make std/iconv.h
					make ast_iconv.h
						make FEATURE/iconv
							prev include/ccode.h
							prev ast_common.h
							makp features/iconv
							exec - invoke_iffe %{<}
						done
						exec - cp -f %{<} %{@}
						prev include/ccode.h
						prev ast_common.h
					done
				done
				prev std/nl_types.h
				prev include/mc.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make iconv.o
			make comp/iconv.c
				prev include/ast_windows.h
				prev port/lclib.h
				prev std/iconv.h
				prev include/ccode.h
				prev include/error.h
				prev std/dirent.h
				prev include/ast.h
			done
			exec - compile %{<} -Iport
		done

		make lc.o
			make port/lc.c
				make FEATURE/locale
					makp features/locale
					exec - invoke_iffe %{<}
				done
				prev port/lclang.h
				prev port/lclib.h
			done
			exec - compile %{<} -Iport
		done

		make lctab.o
			prev lctab.c
			exec - compile %{<} -Iport
		done

		make mc.o
			make port/mc.c
				prev std/nl_types.h
				prev include/mc.h
				prev include/error.h
				prev std/iconv.h
				prev port/lclib.h
				make sfio/sfhdr.h
					prev port/lclib.h
					prev std/wchar.h
					prev include/error.h
					prev FEATURE/float
					prev include/ls.h
					prev ast_tty.h
					prev ast_time.h
					prev include/ast.h
					make include/sfio_t.h
						prev include/sfio.h
					done
					prev FEATURE/common
					prev FEATURE/mmap
					make FEATURE/sfio
						makp features/sfio
						exec - invoke_iffe %{<}
					done
				done
			done
			exec - compile %{<} %{DEBUG+-DDEBUG=%{DEBUG}} -Iport -Isfio
		done

		make base64.o
			make string/base64.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make recfmt.o
			make misc/recfmt.c
				make include/recfmt.h
					prev include/ast.h
				done
			done
			exec - compile %{<}
		done

		make recstr.o
			make misc/recstr.c
				prev include/recfmt.h
			done
			exec - compile %{<}
		done

		make reclen.o
			make misc/reclen.c
				prev include/recfmt.h
			done
			exec - compile %{<}
		done

		make fmtrec.o
			make misc/fmtrec.c
				prev include/recfmt.h
			done
			exec - compile %{<}
		done

		make fmtbuf.o
			make string/fmtbuf.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make fmtclock.o
			make string/fmtclock.c
				prev include/tm.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make fmtdev.o
			make string/fmtdev.c
				prev include/ls.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make fmtelapsed.o
			make string/fmtelapsed.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make fmterror.o
			make string/fmterror.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make fmtesc.o
			make string/fmtesc.c
				prev std/wctype.h
				prev std/wchar.h
				prev include/ccode.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make fmtfmt.o
			make string/fmtfmt.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make fmtfs.o
			make string/fmtfs.c
				prev include/cdt.h
				prev FEATURE/fs
				makp include/mnt.h
				prev include/ls.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make fmtident.o
			make string/fmtident.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make fmtint.o
			make string/fmtint.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make fmtip4.o
			make string/fmtip4.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make fmtip6.o
			make string/fmtip6.c
				makp include/ip6.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make fmtls.o
			make string/fmtls.c
				prev include/tm.h
				prev include/ls.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make fmtmatch.o
			make string/fmtmatch.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make fmtmode.o
			make string/fmtmode.c
				prev string/modelib.h
			done
			exec - compile %{<} -Istring
		done

		make fmtnum.o
			make string/fmtnum.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make fmtperm.o
			make string/fmtperm.c
				prev include/ls.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make fmtre.o
			make string/fmtre.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make fmttime.o
			make string/fmttime.c
				prev include/tm.h
			done
			exec - compile %{<}
		done

		make fmtuid.o
			make string/fmtuid.c
				prev std/stdio.h
				prev include/cdt.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make fmtgid.o
			make string/fmtgid.c
				prev std/stdio.h
				prev include/cdt.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make fmtsignal.o
			make string/fmtsignal.c
				prev sig.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make fmtscale.o
			make string/fmtscale.c
				prev port/lclib.h
				prev include/ast.h
			done
			exec - compile %{<} -Iport
		done

		make fmttmx.o
			make string/fmttmx.c
				prev tv.h
				make tmx.h
					make FEATURE/tmx
						prev tv.h
						prev include/tm.h
						make features/tmx
							prev FEATURE/common
						done
						exec - invoke_iffe %{<}
					done
					exec - cp -f %{<} %{@}
					prev tv.h
					prev include/tm.h
				done
			done
			exec - compile %{<}
		done

		make fmttv.o
			make string/fmttv.c
				prev include/tm.h
				prev tv.h
			done
			exec - compile %{<}
		done

		make fmtversion.o
			make string/fmtversion.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make strelapsed.o
			make string/strelapsed.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make strperm.o
			make string/strperm.c
				prev include/modex.h
				prev include/ls.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make struid.o
			make string/struid.c
				prev include/cdt.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make strgid.o
			make string/strgid.c
				prev include/cdt.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make strtoip4.o
			make string/strtoip4.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make strtoip6.o
			make string/strtoip6.c
				prev include/ip6.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make stk.o
			make misc/stk.c
				prev include/stk.h
				prev align.h
				prev include/ast.h
				prev include/sfio_t.h
			done
			exec - compile %{<}
		done

		make swapget.o
			make string/swapget.c
				prev include/swap.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make swapmem.o
			make string/swapmem.c
				prev include/swap.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make swapop.o
			make string/swapop.c
				prev include/swap.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make swapput.o
			make string/swapput.c
				prev include/swap.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make sigdata.o
			make misc/sigdata.c
				make FEATURE/signal
					make features/signal.c
						make FEATURE/siglist
							makp features/siglist
							exec - invoke_iffe %{<}
						done
						prev FEATURE/standards
					done
					exec - invoke_iffe %{<} -I.
				done
				prev sig.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make sigcrit.o
			make misc/sigcrit.c
				prev sig.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make sigunblock.o
			make comp/sigunblock.c
				prev sig.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make procopen.o
			make misc/procopen.c
				prev include/namval.h
				prev ast_tty.h
				prev include/ls.h
				make misc/proclib.h
					prev include/proc.h
					make include/wait.h
						prev ast_wait.h
						prev include/ast.h
					done
					prev sig.h
					prev include/ast.h
				done
			done
			exec - compile %{<} -Imisc
		done

		make procclose.o
			make misc/procclose.c
				prev misc/proclib.h
			done
			exec - compile %{<} -Imisc
		done

		make procrun.o
			make misc/procrun.c
				prev misc/proclib.h
			done
			exec - compile %{<} -Imisc
		done

		make procfree.o
			make misc/procfree.c
				prev misc/proclib.h
			done
			exec - compile %{<} -Imisc
		done

		make tmdate.o
			make tm/tmdate.c
				prev tmx.h
			done
			exec - compile %{<}
		done

		make tmequiv.o
			make tm/tmequiv.c
				prev include/tm.h
			done
			exec - compile %{<}
		done

		make tmfix.o
			make tm/tmfix.c
				prev tmx.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make tmfmt.o
			make tm/tmfmt.c
				prev tmx.h
			done
			exec - compile %{<}
		done

		make tmform.o
			make tm/tmform.c
				prev include/tm.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make tmgoff.o
			make tm/tmgoff.c
				prev include/tm.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make tminit.o
			make tm/tminit.c
				make FEATURE/tmlib
					makp features/tmlib
					exec - invoke_iffe %{<}
				done
				prev include/namval.h
				prev include/tm.h
			done
			exec - compile %{<}
		done

		make tmleap.o
			make tm/tmleap.c
				prev tmx.h
			done
			exec - compile %{<}
		done

		make tmlex.o
			make tm/tmlex.c
				prev include/tm.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make tmlocale.o
			make tm/tmlocale.c
				prev std/nl_types.h
				prev include/ast_windows.h
				prev port/lclib.h
				prev ast_nl_types.h
				prev include/tm.h
				prev include/mc.h
				prev std/iconv.h
				prev include/cdt.h
				prev include/ast.h
			done
			exec - compile %{<} -Iport
		done

		make tmmake.o
			make tm/tmmake.c
				prev tmx.h
			done
			exec - compile %{<}
		done

		make tmpoff.o
			make tm/tmpoff.c
				prev include/tm.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make tmscan.o
			make tm/tmscan.c
				prev tmx.h
			done
			exec - compile %{<}
		done

		make tmsleep.o
			make tm/tmsleep.c
				prev tv.h
				prev include/tm.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make tmtime.o
			make tm/tmtime.c
				prev tmx.h
			done
			exec - compile %{<}
		done

		make tmtype.o
			make tm/tmtype.c
				prev include/tm.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make tmweek.o
			make tm/tmweek.c
				prev tmx.h
			done
			exec - compile %{<}
		done

		make tmword.o
			make tm/tmword.c
				prev include/tm.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make tmzone.o
			make tm/tmzone.c
				prev include/tm.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make tmxdate.o
			make tm/tmxdate.c
				prev include/debug.h
				prev tmx.h
			done
			exec - compile %{<}
		done

		make tmxduration.o
			make tm/tmxduration.c
				prev tmx.h
			done
			exec - compile %{<}
		done

		make tmxfmt.o
			make tm/tmxfmt.c
				prev tmx.h
			done
			exec - compile %{<}
		done

		make tmxgettime.o
			make tm/tmxgettime.c
				prev tv.h
				prev tmx.h
			done
			exec - compile %{<}
		done

		make tmxleap.o
			make tm/tmxleap.c
				prev tmx.h
			done
			exec - compile %{<}
		done

		make tmxmake.o
			make tm/tmxmake.c
				prev FEATURE/tmlib
				prev tmx.h
			done
			exec - compile %{<}
		done

		make tmxscan.o
			make tm/tmxscan.c
				prev tmx.h
			done
			exec - compile %{<}
		done

		make tmxsettime.o
			make tm/tmxsettime.c
				prev tv.h
				prev tmx.h
			done
			exec - compile %{<}
		done

		make tmxsleep.o
			make tm/tmxsleep.c
				prev tv.h
				prev tmx.h
			done
			exec - compile %{<}
		done

		make tmxtime.o
			make tm/tmxtime.c
				prev FEATURE/tmlib
				prev tmx.h
			done
			exec - compile %{<}
		done

		make tmxtouch.o
			make tm/tmxtouch.c
				prev tv.h
				prev tmx.h
			done
			exec - compile %{<}
		done

		make tvcmp.o
			make tm/tvcmp.c
				prev tv.h
			done
			exec - compile %{<}
		done

		make tvgettime.o
			make tm/tvgettime.c
				make FEATURE/tvlib
					makp features/tvlib
					exec - invoke_iffe %{<}
				done
				prev include/tm.h
				prev tv.h
			done
			exec - compile %{<}
		done

		make tvsettime.o
			make tm/tvsettime.c
				prev FEATURE/tvlib
				prev include/tm.h
				prev tv.h
			done
			exec - compile %{<}
		done

		make tvsleep.o
			make tm/tvsleep.c
				prev FEATURE/tvlib
				prev include/error.h
				prev include/tm.h
				prev tv.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make tvtouch.o
			make tm/tvtouch.c
				prev FEATURE/tvlib
				prev include/error.h
				prev include/times.h
				prev tv.h
				prev include/ls.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make cmdarg.o
			make misc/cmdarg.c
				prev ast_api.h
				prev include/proc.h
				make misc/cmdlib.h
					make include/cmdarg.h
						prev include/error.h
					done
				done
				prev include/ast.h
			done
			exec - compile %{<} -Imisc
		done

		make univdata.o
			make misc/univdata.c
				prev misc/univlib.h
			done
			exec - compile %{<} -Imisc
		done

		make touch.o
			make port/touch.c
				prev tv.h
				prev include/times.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make mnt.o
			make port/mnt.c
				prev std/stdio.h
				prev include/ast_windows.h
				prev include/ls.h
				prev include/mnt.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make debug.o
			make misc/debug.c
				prev include/times.h
				prev FEATURE/time
				prev include/debug.h
				prev include/error.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make memdup.o
			make string/memdup.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make mkdir.o
			make comp/mkdir.c
				prev include/error.h
				prev include/wait.h
				prev include/ls.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make mkfifo.o
			make comp/mkfifo.c
				prev include/error.h
				prev include/ls.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make mknod.o
			make comp/mknod.c
				prev include/error.h
				prev include/ls.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make rmdir.o
			make comp/rmdir.c
				prev include/error.h
				prev include/ls.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make remove.o
			make comp/remove.c
				prev ast_map.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make rename.o
			make comp/rename.c
				prev include/proc.h
				prev include/error.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make link.o
			make comp/link.c
				prev include/error.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make unlink.o
			make comp/unlink.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make strdup.o
			make string/strdup.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make strtod.o
			make comp/strtod.c
				make sfio/sfstrtof.h
					prev FEATURE/float
					prev sfio/sfhdr.h
				done
				prev include/ast.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make strtold.o
			make comp/strtold.c
				prev sfio/sfstrtof.h
				prev include/ast.h
				prev ast_sys.h
				prev ast_lib.h
				prev ast_common.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make strtol.o
			make comp/strtol.c
				make string/strtoi.h
					prev sfio/sfhdr.h
					prev include/error.h
					prev include/ast.h
				done
			done
			exec - compile %{<} -Iport -Isfio -Istring
		done

		make strtoll.o
			make comp/strtoll.c
				prev string/strtoi.h
				prev ast_map.h
				prev include/ast.h
			done
			exec - compile %{<} -Iport -Isfio -Istring
		done

		make strtoul.o
			make comp/strtoul.c
				prev string/strtoi.h
			done
			exec - compile %{<} -Iport -Isfio -Istring
		done

		make strtoull.o
			make comp/strtoull.c
				prev string/strtoi.h
				prev ast_map.h
				prev include/ast.h
			done
			exec - compile %{<} -Iport -Isfio -Istring
		done

		make strton.o
			make string/strton.c
				prev string/strtoi.h
			done
			exec - compile %{<} -Iport -Isfio -Istring
		done

		make strtonll.o
			make string/strtonll.c
				prev string/strtoi.h
			done
			exec - compile %{<} -Iport -Isfio -Istring
		done

		make strntod.o
			make string/strntod.c
				prev sfio/sfstrtof.h
				prev include/ast.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make strntold.o
			make string/strntold.c
				prev sfio/sfstrtof.h
				prev include/ast.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make strnton.o
			make string/strnton.c
				prev string/strtoi.h
			done
			exec - compile %{<} -Iport -Isfio -Istring
		done

		make strntonll.o
			make string/strntonll.c
				prev string/strtoi.h
			done
			exec - compile %{<} -Iport -Isfio -Istring
		done

		make strntol.o
			make string/strntol.c
				prev string/strtoi.h
			done
			exec - compile %{<} -Iport -Isfio -Istring
		done

		make strntoll.o
			make string/strntoll.c
				prev string/strtoi.h
			done
			exec - compile %{<} -Iport -Isfio -Istring
		done

		make strntoul.o
			make string/strntoul.c
				prev string/strtoi.h
			done
			exec - compile %{<} -Iport -Isfio -Istring
		done

		make strntoull.o
			make string/strntoull.c
				prev string/strtoi.h
			done
			exec - compile %{<} -Iport -Isfio -Istring
		done

		make strcasecmp.o
			make comp/strcasecmp.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make strncasecmp.o
			make comp/strncasecmp.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make strerror.o
			make string/strerror.c
				make FEATURE/errno
					makp features/errno
					exec - invoke_iffe %{<}
				done
				prev port/lclib.h
			done
			exec - compile %{<} -Iport
		done

		make mktemp.o
			make comp/mktemp.c
				prev ast_map.h
				prev std/stdio.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make tmpnam.o
			make comp/tmpnam.c
				prev ast_map.h
				prev std/stdio.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make fsync.o
			make comp/fsync.c
				prev include/error.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make spawnveg.o
			make comp/spawnveg.c
				prev ast_tty.h
				prev sig.h
				prev include/wait.h
				prev include/error.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make killpg.o
			make comp/killpg.c
				prev sig.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make putenv.o
			make comp/putenv.c
				prev ast_map.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make setenv.o
			make comp/setenv.c
				prev ast_map.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make unsetenv.o
			make comp/unsetenv.c
				prev ast_map.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make statvfs.o
			make comp/statvfs.c
				prev include/error.h
				prev include/ls.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make eaccess.o
			make comp/eaccess.c
				prev FEATURE/eaccess
				prev include/ls.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make omitted.o
			make comp/omitted.c
				prev include/ast_windows.h
				prev include/ls.h
				make FEATURE/omitted
					makp features/omitted
					exec - invoke_iffe %{<}
				done
				prev include/tm.h
				prev include/error.h
				prev ast_stdio.h
				prev include/ast.h
				prev FEATURE/float
			done
			exec - compile %{<}
		done

		make fcntl.o
			make comp/fcntl.c
				prev include/error.h
				prev ast_tty.h
				prev include/ls.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make open.o
			make comp/open.c
				prev ast_tty.h
				prev include/error.h
				prev include/ls.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make getdents.o
			make dir/getdents.c
				prev dir/dirlib.h
			done
			exec - compile %{<} -Idir
		done

		make errno.o
			make comp/errno.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make mount.o
			make comp/mount.c
				prev include/error.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make system.o
			make comp/system.c
				prev ast_map.h
				prev include/proc.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make iblocks.o
			make port/iblocks.c
				prev include/ls.h
				prev ast_param.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make modedata.o
			make string/modedata.c
				prev string/modelib.h
			done
			exec - compile %{<} -Istring
		done

		make tmdata.o
			make tm/tmdata.c
				prev include/tm.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make sfkeyprintf.o
			make disc/sfkeyprintf.c
				prev ast_api.h
				prev include/regex.h
				make include/sfdisc.h
					prev include/ast.h
				done
				prev include/ccode.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make sfdcdio.o
			make disc/sfdcdio.c
				make disc/sfdchdr.h
					prev include/sfdisc.h
					prev sfio/sfhdr.h
				done
			done
			exec - compile %{<} -Idisc -Iport -Isfio
		done

		make sfdcdos.o
			make disc/sfdcdos.c
				prev disc/sfdchdr.h
			done
			exec - compile %{<} -Idisc -Iport -Isfio
		done

		make sfdcfilter.o
			make disc/sfdcfilter.c
				prev disc/sfdchdr.h
			done
			exec - compile %{<} -Idisc -Iport -Isfio
		done

		make sfdcseekable.o
			make disc/sfdcseekable.c
				prev disc/sfdchdr.h
			done
			exec - compile %{<} -Idisc -Iport -Isfio
		done

		make sfdcslow.o
			make disc/sfdcslow.c
				prev disc/sfdchdr.h
			done
			exec - compile %{<} -Idisc -Iport -Isfio
		done

		make sfdcsubstr.o
			make disc/sfdcsubstr.c
				prev disc/sfdchdr.h
			done
			exec - compile %{<} -Idisc -Iport -Isfio
		done

		make sfdctee.o
			make disc/sfdctee.c
				prev disc/sfdchdr.h
			done
			exec - compile %{<} -Idisc -Iport -Isfio
		done

		make sfdcunion.o
			make disc/sfdcunion.c
				prev disc/sfdchdr.h
			done
			exec - compile %{<} -Idisc -Iport -Isfio
		done

		make sfdcmore.o
			make disc/sfdcmore.c
				prev ast_tty.h
				prev disc/sfdchdr.h
			done
			exec - compile %{<} -Idisc -Iport -Isfio
		done

		make sfdcprefix.o
			make disc/sfdcprefix.c
				prev disc/sfdchdr.h
			done
			exec - compile %{<} -Idisc -Iport -Isfio
		done

		make wc.o
			make comp/wc.c
				prev std/wchar.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make wc2utf8.o
			make string/wc2utf8.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make dirname.o
			make comp/dirname.c
				prev include/ast_std.h
			done
			exec - compile %{<}
		done

		make fmtmsglib.o
			make comp/fmtmsglib.c
				makp comp/fmtmsg.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make fnmatch.o
			make comp/fnmatch.c
				make comp/fnmatch.h
					prev ast_common.h
				done
				prev include/regex.h
				prev include/ast.h
				prev ast_lib.h
			done
			exec - compile %{<}
		done

		make ftw.o
			make comp/ftw.c
				make comp/ftw.h
					prev include/ftwalk.h
				done
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make glob.o
			make misc/glob.c
				makp include/glob.h
				prev include/regex.h
				prev include/error.h
				prev include/ast_dir.h
				prev include/stk.h
				prev include/ls.h
				prev include/ast.h
			done
			exec - compile %{<} -Idir
		done

		make nftw.o
			make comp/nftw.c
				prev comp/ftw.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make re_comp.o
			make comp/re_comp.c
				prev include/regex.h
				makp comp/re_comp.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make resolvepath.o
			make comp/resolvepath.c
				prev ast_api.h
				prev ast_map.h
				prev include/error.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make regcmp.o
			make comp/regcmp.c
				prev align.h
				prev include/regex.h
				makp comp/libgen.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make regexp.o
			make comp/regexp.c
				prev align.h
				prev include/regex.h
				makp comp/regexp.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make strftime.o
			make comp/strftime.c
				prev ast_map.h
				prev include/tm.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make strptime.o
			make comp/strptime.c
				prev ast_map.h
				prev tmx.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make swab.o
			make comp/swab.c
				prev include/swap.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make tempnam.o
			make comp/tempnam.c
				prev std/stdio.h
				prev include/ast.h
				prev include/ast_std.h
			done
			exec - compile %{<}
		done

		make wordexp.o
			make comp/wordexp.c
				prev include/stk.h
				make comp/wordexp.h
					prev ast_common.h
				done
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make mktime.o
			make comp/mktime.c
				prev ast_map.h
				prev include/tm.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make regalloc.o
			make regex/regalloc.c
				make regex/reglib.h
					prev std/wctype.h
					prev std/wchar.h
					prev std/stdio.h
					prev include/regex.h
					prev include/stk.h
					prev include/cdt.h
					prev include/ast.h
				done
			done
			exec - compile %{<} -Iregex
		done

		make regclass.o
			make regex/regclass.c
				prev regex/reglib.h
			done
			exec - compile %{<} -Iregex
		done

		make regcoll.o
			make regex/regcoll.c
				prev regex/reglib.h
			done
			exec - compile %{<} -Iregex
		done

		make regcomp.o
			make regex/regcomp.c
				prev port/lclib.h
				prev regex/reglib.h
			done
			exec - compile %{<} -Iport -Iregex
		done

		make regcache.o
			make regex/regcache.c
				prev include/regex.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make regdecomp.o
			make regex/regdecomp.c
				prev regex/reglib.h
			done
			exec - compile %{<} -Iregex
		done

		make regerror.o
			make regex/regerror.c
				prev regex/reglib.h
			done
			exec - compile %{<} -Iregex
		done

		make regexec.o
			make regex/regexec.c
				prev regex/reglib.h
			done
			exec - compile %{<} -Iregex
		done

		make regfatal.o
			make regex/regfatal.c
				prev include/error.h
				prev regex/reglib.h
			done
			exec - compile %{<} -Iregex
		done

		make reginit.o
			make regex/reginit.c
				prev include/ccode.h
				prev regex/reglib.h
			done
			exec - compile %{<} -Iregex
		done

		make regnexec.o
			make regex/regnexec.c
				prev regex/reglib.h
			done
			exec - compile %{<} -Iregex
		done

		make regsubcomp.o
			make regex/regsubcomp.c
				prev regex/reglib.h
			done
			exec - compile %{<} -Iregex
		done

		make regsubexec.o
			make regex/regsubexec.c
				prev regex/reglib.h
			done
			exec - compile %{<} -Iregex
		done

		make regsub.o
			make regex/regsub.c
				prev regex/reglib.h
			done
			exec - compile %{<} -Iregex
		done

		make regrecord.o
			make regex/regrecord.c
				prev regex/reglib.h
			done
			exec - compile %{<} -Iregex
		done

		make regrexec.o
			make regex/regrexec.c
				prev regex/reglib.h
			done
			exec - compile %{<} -Iregex
		done

		make regstat.o
			make regex/regstat.c
				prev regex/reglib.h
			done
			exec - compile %{<} -Iregex
		done

		make dtclose.o
			make cdt/dtclose.c
				make cdt/dthdr.h
					make cdt/cdtlib.h
						prev include/debug.h
						make include/aso.h
							prev ast_common.h
						done
						prev include/cdt.h
						prev include/ast.h
					done
				done
			done
			exec - compile %{<} -Icdt
		done

		make dtdisc.o
			make cdt/dtdisc.c
				prev cdt/dthdr.h
			done
			exec - compile %{<} -Icdt
		done

		make dthash.o
			make cdt/dthash.c
				prev cdt/dthdr.h
			done
			exec - compile %{<} -Icdt
		done

		make dtlist.o
			make cdt/dtlist.c
				prev cdt/dthdr.h
			done
			exec - compile %{<} -Icdt
		done

		make dtmethod.o
			make cdt/dtmethod.c
				prev cdt/dthdr.h
			done
			exec - compile %{<} -Icdt
		done

		make dtopen.o
			make cdt/dtopen.c
				prev cdt/dthdr.h
			done
			exec - compile %{<} -Icdt
		done

		make dtstat.o
			make cdt/dtstat.c
				prev cdt/dthdr.h
			done
			exec - compile %{<} -Icdt
		done

		make dtstrhash.o
			make cdt/dtstrhash.c
				prev cdt/dthdr.h
			done
			exec - compile %{<} -Icdt
		done

		make dttree.o
			make cdt/dttree.c
				prev cdt/dthdr.h
			done
			exec - compile %{<} -Icdt
		done

		make dtuser.o
			make cdt/dtuser.c
				prev cdt/dthdr.h
			done
			exec - compile %{<} -Icdt
		done

		make dtview.o
			make cdt/dtview.c
				prev cdt/dthdr.h
			done
			exec - compile %{<} -Icdt
		done

		make dtwalk.o
			make cdt/dtwalk.c
				prev cdt/dthdr.h
			done
			exec - compile %{<} -Icdt
		done

		make dtcomp.o
			make cdt/dtcomp.c
				prev include/cdt.h
			done
			exec - compile %{<}
		done

		make sfclose.o
			make sfio/sfclose.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfclrlock.o
			make sfio/sfclrlock.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfdisc.o
			make sfio/sfdisc.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfdlen.o
			make sfio/sfdlen.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfexcept.o
			make sfio/sfexcept.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfgetl.o
			make sfio/sfgetl.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfgetu.o
			make sfio/sfgetu.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfcvt.o
			make sfio/sfcvt.c
				prev sfio/sfhdr.h
				prev FEATURE/standards
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfecvt.o
			make sfio/sfecvt.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sffcvt.o
			make sfio/sffcvt.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfextern.o
			make sfio/sfextern.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sffilbuf.o
			make sfio/sffilbuf.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfflsbuf.o
			make sfio/sfflsbuf.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfprints.o
			make sfio/sfprints.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfgetd.o
			make sfio/sfgetd.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfgetr.o
			make sfio/sfgetr.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfllen.o
			make sfio/sfllen.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfmode.o
			make sfio/sfmode.c
				prev include/wait.h
				prev sig.h
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfmove.o
			make sfio/sfmove.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfnew.o
			make sfio/sfnew.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfpkrd.o
			make sfio/sfpkrd.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfnotify.o
			make sfio/sfnotify.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfnputc.o
			make sfio/sfnputc.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfopen.o
			make sfio/sfopen.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfpeek.o
			make sfio/sfpeek.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfpoll.o
			make sfio/sfpoll.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfpool.o
			make sfio/sfpool.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfpopen.o
			make sfio/sfpopen.c
				prev include/proc.h
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfprintf.o
			make sfio/sfprintf.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} %{mam_cc_NOPROTECT} -Iport -Isfio
		done

		make sfputd.o
			make sfio/sfputd.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfputl.o
			make sfio/sfputl.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfputr.o
			make sfio/sfputr.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfputu.o
			make sfio/sfputu.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfrd.o
			make sfio/sfrd.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} %{DEBUG+-DDEBUG=%{DEBUG}} -Iport -Isfio
		done

		make sfread.o
			make sfio/sfread.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfreserve.o
			make sfio/sfreserve.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfscanf.o
			make sfio/sfscanf.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} %{mam_cc_NOPROTECT} -Iport -Isfio
		done

		make sfseek.o
			make sfio/sfseek.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfset.o
			make sfio/sfset.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} %{DEBUG+-DDEBUG=%{DEBUG}} -Iport -Isfio
		done

		make sfsetbuf.o
			make sfio/sfsetbuf.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfsetfd.o
			make sfio/sfsetfd.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfsize.o
			make sfio/sfsize.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfsk.o
			make sfio/sfsk.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfstack.o
			make sfio/sfstack.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfstrtod.o
			make sfio/sfstrtod.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfsync.o
			make sfio/sfsync.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfswap.o
			make sfio/sfswap.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sftable.o
			make sfio/sftable.c
				make FEATURE/sfinit
					make features/sfinit.c
						prev FEATURE/float
						prev FEATURE/common
					done
					exec - invoke_iffe %{<} -I. -Istd
				done
				prev FEATURE/float
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sftell.o
			make sfio/sftell.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sftmp.o
			make sfio/sftmp.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfungetc.o
			make sfio/sfungetc.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfvprintf.o
			make sfio/sfvprintf.c
				prev include/ccode.h
				prev sfio/sfhdr.h
			done
			exec - compile %{<} %{mam_cc_NOPROTECT} %{DEBUG+-DDEBUG=%{DEBUG}} -Iport -Isfio
		done

		make sfvscanf.o
			make sfio/sfvscanf.c
				prev sfio/sfstrtof.h
				prev sfio/sfhdr.h
			done
			exec - compile %{<} %{mam_cc_NOPROTECT} -Iport -Isfio
		done

		make sfwr.o
			make sfio/sfwr.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfwrite.o
			make sfio/sfwrite.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfpurge.o
			make sfio/sfpurge.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfraise.o
			make sfio/sfraise.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfwalk.o
			make sfio/sfwalk.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfgetm.o
			make sfio/sfgetm.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfputm.o
			make sfio/sfputm.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make sfresize.o
			make sfio/sfresize.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make _sfclrerr.o
			make sfio/_sfclrerr.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make _sfeof.o
			make sfio/_sfeof.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make _sferror.o
			make sfio/_sferror.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make _sffileno.o
			make sfio/_sffileno.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make _sfopen.o
			make sfio/_sfopen.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make _sfstacked.o
			make sfio/_sfstacked.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make _sfvalue.o
			make sfio/_sfvalue.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make _sfgetc.o
			make sfio/_sfgetc.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make _sfgetl.o
			make sfio/_sfgetl.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make _sfgetl2.o
			make sfio/_sfgetl2.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make _sfgetu.o
			make sfio/_sfgetu.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make _sfgetu2.o
			make sfio/_sfgetu2.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make _sfdlen.o
			make sfio/_sfdlen.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make _sfllen.o
			make sfio/_sfllen.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make _sfslen.o
			make sfio/_sfslen.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make _sfulen.o
			make sfio/_sfulen.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make _sfputc.o
			make sfio/_sfputc.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make _sfputd.o
			make sfio/_sfputd.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make _sfputl.o
			make sfio/_sfputl.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make _sfputm.o
			make sfio/_sfputm.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make _sfputu.o
			make sfio/_sfputu.c
				prev sfio/sfhdr.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make clearerr.o
			make stdio/clearerr.c
				make stdio/stdhdr.h
					prev std/stdio.h
					prev sfio/sfhdr.h
					prev ast_standards.h
				done
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make fclose.o
			make stdio/fclose.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make fdopen.o
			make stdio/fdopen.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make fflush.o
			make stdio/fflush.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make fgetc.o
			make stdio/fgetc.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make fgetpos.o
			make stdio/fgetpos.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make fgets.o
			make stdio/fgets.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make fopen.o
			make stdio/fopen.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make fprintf.o
			make stdio/fprintf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make fpurge.o
			make stdio/fpurge.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make fputs.o
			make stdio/fputs.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make fread.o
			make stdio/fread.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make freopen.o
			make stdio/freopen.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make fscanf.o
			make stdio/fscanf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make fseek.o
			make stdio/fseek.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make fseeko.o
			make stdio/fseeko.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make fsetpos.o
			make stdio/fsetpos.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make ftell.o
			make stdio/ftell.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make ftello.o
			make stdio/ftello.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make fwrite.o
			make stdio/fwrite.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make getw.o
			make stdio/getw.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make pclose.o
			make stdio/pclose.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make popen.o
			make stdio/popen.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make printf.o
			make stdio/printf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make puts.o
			make stdio/puts.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make putw.o
			make stdio/putw.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make rewind.o
			make stdio/rewind.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make scanf.o
			make stdio/scanf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make setbuf.o
			make stdio/setbuf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make setbuffer.o
			make stdio/setbuffer.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make setlinebuf.o
			make stdio/setlinebuf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make setvbuf.o
			make stdio/setvbuf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make snprintf.o
			make stdio/snprintf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make sprintf.o
			make stdio/sprintf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make sscanf.o
			make stdio/sscanf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make asprintf.o
			make stdio/asprintf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make vasprintf.o
			make stdio/vasprintf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make tmpfile.o
			make stdio/tmpfile.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make ungetc.o
			make stdio/ungetc.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make vfprintf.o
			make stdio/vfprintf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make vfscanf.o
			make stdio/vfscanf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make vprintf.o
			make stdio/vprintf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make vscanf.o
			make stdio/vscanf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make vsnprintf.o
			make stdio/vsnprintf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make vsprintf.o
			make stdio/vsprintf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make vsscanf.o
			make stdio/vsscanf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make _doprnt.o
			make stdio/_doprnt.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make _doscan.o
			make stdio/_doscan.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make _filbuf.o
			make stdio/_filbuf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make _flsbuf.o
			make stdio/_flsbuf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make _stdopen.o
			make stdio/_stdopen.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make _stdprintf.o
			make stdio/_stdprintf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make _stdscanf.o
			make stdio/_stdscanf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make _stdsprnt.o
			make stdio/_stdsprnt.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make _stdvbuf.o
			make stdio/_stdvbuf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make _stdvsnprnt.o
			make stdio/_stdvsnprnt.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make _stdvsprnt.o
			make stdio/_stdvsprnt.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make _stdvsscn.o
			make stdio/_stdvsscn.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make fgetwc.o
			make stdio/fgetwc.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make fwprintf.o
			make stdio/fwprintf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make putwchar.o
			make stdio/putwchar.c
				prev ast_wchar.h
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make vfwscanf.o
			make stdio/vfwscanf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make wprintf.o
			make stdio/wprintf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make fgetws.o
			make stdio/fgetws.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make fwscanf.o
			make stdio/fwscanf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make swprintf.o
			make stdio/swprintf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make vswprintf.o
			make stdio/vswprintf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make wscanf.o
			make stdio/wscanf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make fputwc.o
			make stdio/fputwc.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make getwc.o
			make stdio/getwc.c
				prev ast_wchar.h
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make swscanf.o
			make stdio/swscanf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make vswscanf.o
			make stdio/vswscanf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make fputws.o
			make stdio/fputws.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make getwchar.o
			make stdio/getwchar.c
				prev ast_wchar.h
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make ungetwc.o
			make stdio/ungetwc.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make vwprintf.o
			make stdio/vwprintf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make fwide.o
			make stdio/fwide.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make putwc.o
			make stdio/putwc.c
				prev ast_wchar.h
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make vfwprintf.o
			make stdio/vfwprintf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make vwscanf.o
			make stdio/vwscanf.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make stdio_c99.o
			make stdio/stdio_c99.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make fcloseall.o
			make stdio/fcloseall.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make fmemopen.o
			make stdio/fmemopen.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make getdelim.o
			make stdio/getdelim.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make getline.o
			make stdio/getline.c
				prev stdio/stdhdr.h
			done
			exec - compile %{<} -Iport -Isfio -Istdio
		done

		make frexp.o
			make comp/frexp.c
				prev FEATURE/float
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make frexpl.o
			make comp/frexpl.c
				prev FEATURE/float
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make astcopy.o
			make port/astcopy.c
				prev include/ls.h
				prev ast_mmap.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make astconf.o
			make port/astconf.c
				make FEATURE/libpath
					makp features/libpath.sh
					exec - invoke_iffe %{<}
				done
				makp conftab.h
				prev include/ls.h
				prev include/proc.h
				prev include/regex.h
				prev include/error.h
				prev include/ast.h
				prev misc/univlib.h
			done
			exec - compile %{<} -Imisc -DCONF_LIBSUFFIX=\""%{DYLIB_SUF}"\" -DCONF_LIBPREFIX=\""%{DYLIB_PRE}"\" -DHOSTTYPE=\""%{mam_cc_HOSTTYPE}"\"
		done

		make astdynamic.o
			make port/astdynamic.c
				prev sfio/sfhdr.h
				prev include/ast_windows.h
				prev include/ast.h
				prev include/sfio_t.h
			done
			exec - compile %{<} -Iport -Isfio
		done

		make astquery.o
			make port/astquery.c
				prev include/error.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make astwinsize.o
			make port/astwinsize.c
				prev ast_tty.h
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make conftab.o
			make conftab.c
				prev conftab.h
				prev FEATURE/param
				prev FEATURE/common
				prev FEATURE/standards
			done
			exec - compile %{<}
		done

		make aststatic.o
			make port/aststatic.c
				prev include/ast.h
			done
			exec - compile %{<}
		done

		make aso.o
			make aso/aso.c
				prev std/stdio.h
				prev FEATURE/aso
				make aso/asohdr.h
					prev include/aso.h
					make FEATURE/asometh
						makp features/asometh
						exec - invoke_iffe %{<}
					done
					make include/fnv.h
						prev ast_common.h
					done
					prev include/error.h
					prev include/ast.h
				done
			done
			exec - compile %{<} -Iaso
		done

		make asolock.o
			make aso/asolock.c
				prev aso/asohdr.h
			done
			exec - compile %{<} -Iaso
		done

		make asometh.o
			make aso/asometh.c
				prev aso/asohdr.h
			done
			exec - compile %{<} -Iaso
		done

		make asorelax.o
			make aso/asorelax.c
				prev tv.h
				prev aso/asohdr.h
			done
			exec - compile %{<} -Iaso
		done

		make aso-sem.o
			make aso/aso-sem.c
				prev aso/asohdr.h
			done
			exec - compile %{<} -Iaso
		done

		make aso-fcntl.o
			make aso/aso-fcntl.c
				prev aso/asohdr.h
			done
			exec - compile %{<} -Iaso
		done

		note *
		note * Link the library
		note *

		exec - if	test -f %{@}
		exec - then	%{AR} rc %{@} %{?}  # add changed *.o
		exec - else	%{AR} rc %{@} %{^}  # add all *.o
		exec - fi || exit
		exec - ranlib %{@} >/dev/null 2>&1 || true

		note * save for dylink
		setv _libast_object_files_ %{^}
	done libast.a

	note *
	note * Dynamically linked version, if supported
	note *

	make %{INSTALLROOT}/dyn/lib/%{DYLIB_PRE}ast%{DYLIB_SUF} dontcare
		prev libast.a
		prev ast.req
		exec - export LDFLAGS='%{LDFLAGS} %{CCLDFLAGS} %{mam_cc_LD_NOASNEEDED}'
		exec - dylink -m ast -v %{DYLIB_VERSION} -p '%{DYLIB_PRE}' -s '%{DYLIB_SUF}' $(sed 1d %{<}) %{_libast_object_files_}
	done

	note *
	note * pre-install libast in $INSTALLROOT
	note *

	note * ensure preinstallation directories exist
	loop DIR include/ast lib/lib lib/mam lib/file man/man3
		make %{INSTALLROOT}/%{DIR}
			exec - mkdir -p %{@}
		done
	done

	note * the library and dependency information
	make %{INSTALLROOT}/lib/libast.a
		prev libast.a
		exec - cp -f %{<} %{@} || exit
		exec - ranlib %{@} >/dev/null 2>&1 || true
	done
	make %{INSTALLROOT}/lib/lib/ast
		prev ast.req
		exec - cp -f %{<} %{@}
	done

	note * section 3 manual pages
	loop SECT3MAN LIBAST aso ast cdt chr compat error find fmt fmtls ftwalk getcwd hash iblocks int ip6 magic mem mime modecanon optget path proc re regex setenviron sfio sig spawnveg stk strcopy strdup strelapsed strerror stresc streval strgid strmatch stropt strperm strsignal strsort strtape strton struid swap tab tm tmx tok touch tv
		make %{INSTALLROOT}/man/man3/%{SECT3MAN}.3
			makp man/%{SECT3MAN}.3
			exec - cp -f %{<} %{@}
		done
	done

	note * install releaseflags.h outside the lib/ast/mam block below, so the mkdeps action is not triggered when
	note * releaseflags.h changes every time that the git commit changes (it doesn't contain #includes anyway)
	make %{INCLUDE_AST}/releaseflags.h
		prev releaseflags.h
		exec - cp -f %{<} %{@}
	done

	note * #include headers
	make %{INSTALLROOT}/lib/mam/ast
		note * ...main AST headers
		loop HDR ast ast_dir ast_std ast_windows ccode cdt cmdarg debug error find ftwalk fts glob hash hashkey hashpart ip6 ls magic mc mime mnt modecanon modex namval option proc recfmt regex sfio sfio_s sfio_t sfdisc shcmd stk stak swap tar times tm tok vdb wait magicid fnv aso
			make %{INCLUDE_AST}/%{HDR}.h
				prev include/%{HDR}.h
				exec - cp -f %{<} %{@}
			done
		done
		note * ...comp(atibility)
		loop HDR ftw re_comp regexp wordexp fnmatch
			make %{INCLUDE_AST}/%{HDR}.h
				prev comp/%{HDR}.h
				exec - cp -f %{<} %{@}
			done
		done
		note * ...std
		loop HDR bytesex endian dirent iconv nl_types stdio wchar wctype
			make %{INCLUDE_AST}/%{HDR}.h
				prev std/%{HDR}.h
				exec - cp -f %{<} %{@}
			done
		done
		note * ...generated headers
		loop HDR ast_standards ast_common ast_lib ast_sys lc align sig tmx tv ast_api ast_ccode ast_fcntl ast_float ast_fs ast_map ast_mmap ast_mode ast_ndbm ast_param ast_time ast_tty ast_wait ast_limits ast_sizeof ast_dirent ast_iconv ast_nl_types ast_stdio ast_wchar ast_wctype
			make %{INCLUDE_AST}/%{HDR}.h
				prev %{HDR}.h
				exec - cp -f %{<} %{@}
			done
		done
		note * generate header dependency rules
		exec - mkdeps -last %{INCLUDE_AST}/releaseflags.h %{^} > %{@}
		makp %{INSTALLROOT}/bin/mkdeps
	done %{INSTALLROOT}/lib/mam/ast

	note * misc stuff
	make %{INSTALLROOT}/lib/file/magic
		makp misc/magic.tab
		exec - cp -f %{<} %{@}
	done

	make %{INSTALLROOT}/lib/package/gen/.asthdr_tstamp
		prev ast_lib.h
		prev comp/fmtmsg.h
		prev comp/libgen.h
		note * install our own versions of these if iffe hasn't detected these in the system
		exec - CCt='	'  # one tab
		exec - for src in comp/fmtmsg.h comp/libgen.h
		exec - do	hdr=$(basename "$src" .h)
		exec -		grep -q "define[ $CCt][ $CCt]*_[hl][di][rb]_$hdr" ast_lib.h && continue
		exec -		dst=%{INCLUDE_AST}/$hdr.h
		exec -		if	! cmp -s "$src" "$dst"
		exec -		then	cp -f "$src" "$dst" || exit
		exec -		fi
		exec - done
		exec - touch %{@}
	done

	note *
	note * mamake was previously built by package.sh without libast;
	note * now rebuild it with libast, so we get 'mamake --man', etc.
	note *

	make mamake
		bind -last
		make mamake.o
			make %{PACKAGEROOT}/src/cmd/INIT/mamake.c
				prev %{INCLUDE_AST}/error.h
				prev %{INCLUDE_AST}/ast.h
			done
			exec - compile %{<} -D_PACKAGE_ast
		done
		exec - %{CC} %{CCLDFLAGS} %{CCFLAGS} %{mam_cc_NOSTRICTALIASING} %{LDFLAGS} -o %{@} %{<} %{mam_libast} || exit
		note *
		note * We purposely do not have a make target of %{INSTALLROOT}/bin/mamake here;
		note * this helps to ensure that the package.sh-built version gets overwritten.
		note *
		note * macOS throws code signature error if 'cp' overwrites Mach-O binary; must remove first
		exec - (set +f; exec rm -rf %{INSTALLROOT}/bin/%{@} %{INSTALLROOT}/bin/%{@}.*)
		exec - cp %{@} %{INSTALLROOT}/bin/%{@}
	done
done install

make test dontcare virtual
	make test.mamake virtual
		makp %{PACKAGEROOT}/src/cmd/INIT/mamake.tst
		exec - : testing the libast rebuild of mamake at $PWD/mamake :
		exec - regress --verbose %{<} mamake
	done
done test
