code: fqa.9front.org

ref: d9bcf55266def43df22d796c0b511481dbc5c209
dir: /man7/mkfile/

View raw version
# bind -ac /sys/man `{pwd}
< /sys/man/fonts

LIB=/sys/lib/man

default:V: check

indices:V:
	for (i in [0-8]){
		$LIB/secindex $i > $i/INDEX
		$LIB/mkhtmlindex $i > $i/INDEX.html
	}
	mk lookindex
	$LIB/mksearchindex > searchindex	# index for man2html searches

permind:V:
	rm -f $LIB/permind/toc
	{
		echo .am TH
		echo .tm '\\$1' '\\$2' '\\n%'
		echo ..
		for (i in [0-8]){
			builtin cd $i
			for(j in [a-z0-9]*)
				switch($i/$j){
				case 1/tbl
					tbl $j
				case 1/eqn 3/realtime 6/auth
					eqn $j
				case 1/pic
					pic $j
				case 1/grap
					grap $j | pic
				case *
					cat $j
				}
			builtin cd ..
		}
	} | troff -$MAN > /dev/null >[2] $LIB/permind/toc
	builtin cd $LIB/permind
	rm -f out
	mk out > /dev/null >[2] /dev/null

old-check:V: checksource
	awk -f $LIB/checkman.awk [0-8]/* | sed '/\/(cda|av|midi|pub|weather|service\.9net|isdn)(\/|\))/d'

punccheck:
	grep -n '^\.[IB][^PRIB].+[.;,:]$' [0-9]/* | grep -v '\.\.\.'

check:V: indices checksource
	awk -f $LIB/checkman.awk [0-8]/*

checksource:QV:
	sam -d >[2]/dev/null <<'!'
	f input
	< cat [0-8]/[0-9a-z]*
	B output
	b input
	,x/^\.SH SOURCE/ .,/^\.SH/ x g/^\.B/t "output
	b output
	,x/^\.B.? / d
	,x/ .*/d
	,s/.+/if(! test -f & \&\& ! test -d &) echo no such SOURCE file '&'/g
	,>rc
	!

lookindex:V:
	builtin cd $LIB/lookman
	mkindex


print.out:V:
	{
		{echo -n $FONTS; cat title.ms} | troff -ms
		{echo -n $FONTS; cat indicia.ms} | troff -ms
		{echo -n $FONTS; cat disclaimer.ms} | troff -ms
		{
			for (i in [7]){
				builtin cd $i
				for(j in [a-z0-9]*)
					switch($i/$j){
					case 1/tbl
						tbl $j
					case 1/eqn 6/auth
						eqn $j
					case 1/pic
						pic $j
					case 1/grap
						grap $j | pic
					case *
						cat $j
					}
				builtin cd ..
			}
		} | troff -$MAN
		{echo -n $FONTS; cat tbc.ms} | troff -ms
	} > print.out

%.ps:	print.out
	lp -dstdout $prereq >$target

%.gz:	%
	gzip $prereq

%.pdf:	%.ps
	ps2pdf $prereq $target

clean:V:
	rm -f man.out print.out searchindex $LIB/permind/toc $LIB/lookman/index [0-8]^/INDEX^('' .html)
	builtin cd $LIB/permind
	mk clean