# Generated automatically from Makefile.in by configure.
# Makefile for ncurses manual pages.
#
# NOTE: When you add or rename a man page, make sure you update both
# the top-level MANIFEST and any man/*.renames files!

srcdir	= $(basedir)/man
include ../misc/Makefile.inc

all::

# Someday we'll configure this based on which man program we detect in use
install.man: install.std

# Use this for ordinary man programs, including the GNU and BSD versions
MANDATO= @for %1 in (0 1 2 3 4 5 6 7 8 9) do\
		if exist *.%1* $(MKINSTALLDIRS) $(mandir)/man%1 &\
		for %2 in (*.%1*) do\
			@sed -e "s,@TERMINFO,$(datadir)," < %2 > man.tmp & \
			echo installing man page %2 in $(mandir)/man%1/%2 & \
			$(INSTALL_DATA) ./man.tmp $(mandir)/man%1/%2
install install.std : terminfo.5 $(mandir)
	$(MANDATO)
	@rm -f ./man.tmp
#	@cd $(srcdir); for i in *.[0-9]*; do \
#		section=`expr "$$i" : '.*\\.\\([0-9]\\)[xm]*'`; \
#		if [ ! -d $(mandir)/man$${section} ]; then $(srcdir)/../mkinstalldirs $(mandir)/man$$section; fi; \
#		sed -e 's,@TERMINFO@,$(datadir),' < $$i >./man.tmp; \
#		echo installing man page $$i as $(mandir)/man$${section}/$$i;\
#		$(INSTALL_DATA) ./man.tmp $(mandir)/man$${section}/$$i; \
#	done 
#	@rm -f ./man.tmp      

# We compose terminfo.5 from the real sources...
CAPLIST=$(srcdir)/../include/Caps
terminfo.5: $(srcdir)/terminfo.head $(CAPLIST) $(srcdir)/terminfo.tail Makefile $(srcdir)/MKterminfo.sh
	sh $(srcdir)/MKterminfo.sh $(srcdir)/terminfo.head $(CAPLIST) $(srcdir)/terminfo.tail >terminfo.5
	test -d $(mandir)/man5 || $(MKINSTALLDIRS) $(mandir)/man5
	sed -e "s,@TERMINFO@,$(datadir)," < terminfo.5 >./man.tmp
	echo Installing terminfo.5 man page
	$(INSTALL_DATA) ./man.tmp $(mandir)/man5/terminfo.5
	rm -f ./man.tmp

clean mostlyclean:
	rm -f terminfo.5
