#!/bin/sh
export LANG=C
find 0*_* *.html *.css -type f -print | sort | awk '
BEGIN {
	print "### autogenerated, DO NOT EDIT (but do commit); run make regen on *NIX ###"
	print "install_all:"
}
($0 ~ "[/][.]") { next }
($0 ~ "[/]src[/]") { next }
/[.]bak$/ { next }
/[.]backup$/ { next }
/^ps_title/ { next }
/^index_pdf.html/ { next }
/~$/ { next }

function get_svn_st(path,  st,cmd)
{
	cmd="svn stat " path
	cmd | getline st
	close(cmd)
	return st;
}

($0 ~ "/") {
	path = $0

	# don not list temp files
	if (get_svn_st(path) ~ "[^?]")
		next

	sub("/[^/]*$", "", path)
	if (!(path in PATHS)) {
		print "	$(SCCBOX) mkdir -p $(USERDIR)/" path
		PATHS[path]=1
	}
}

{
	# don not list temp files
	if (get_svn_st($0) ~ "[^?]")
		next

	print "	$(SCCBOX) $(HOW) " $0 " $(USERDIR)/" $0
}
' > Makefile.inst
