# doc/Makefile.in	-*- Makefile -*-

DATE = @DATE@
VERSION = @VERSION@
RXVTNAME = @RXVTNAME@
SHELL = /bin/sh
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
man1dir = @mandir@/man1
man1ext = 1
man3dir = @mandir@/man3
man3ext = 3
man7dir = @mandir@/man7
man7ext = 7
PERL = @PERL@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL@ -m 755
INSTALL_DATA = @INSTALL@ -m 644

srcdir = @srcdir@
VPATH = @srcdir@

first_rule: all
dummy:

#-------------------------------------------------------------------------

SEDREPLACE = -e 's%@@RXVT_VERSION@@%$(VERSION)%g;'	\
	     -e 's%@@RXVT_NAME@@%$(RXVTNAME)%g;'	\
	     -e 's%@@RXVT_DATE@@%$(DATE)%g;'		\
	     -e 's%@@RXVT_LIBDIR@@%$(libdir)%g;'	\
	     -e 's%@@URXVT_NAME@@%urxvt%g;'

POD2MAN = pod2man -n @@RXVT_NAME@@ -r @@RXVT_VERSION@@ -q\" -c "RXVT-UNICODE"

all:
	sed $(SEDREPLACE) < $(srcdir)/rxvt.1.man.in   >rxvt.1.man
	sed $(SEDREPLACE) < $(srcdir)/rxvtc.1.man.in  >rxvtc.1.man
	sed $(SEDREPLACE) < $(srcdir)/rxvtd.1.man.in  >rxvtd.1.man
	sed $(SEDREPLACE) < $(srcdir)/rxvt.7.man.in   >rxvt.7.man
	sed $(SEDREPLACE) < $(srcdir)/rclock.1.man.in >rclock.1.man

.INTERMEDIATE: rxvt.7.tbl

%.tbl: %.pod
	$(srcdir)/podtbl <$< >$@

%.1.man.in: %.1.tbl
	$(POD2MAN) -s1 <$< >$@

%.3.man.in: %.3.tbl
	$(POD2MAN) -s3 <$< >$@

%.7.man.in: %.7.tbl
	$(POD2MAN) -s7 <$< >$@

%.html: %.tbl
	sed $(SEDREPLACE) <$< | pod2xhtml --css http://res.tst.eu/pod.css >$@

%.txt: %.tbl
	sed $(SEDREPLACE) <$< | pod2text >$@

../README.configure: rxvt.7.tbl
	sed $(SEDREPLACE) <$< | podselect -section "CONFIGURE OPTIONS" | pod2text >$@

../README.FAQ: rxvt.7.tbl
	sed $(SEDREPLACE) <$< | podselect -section "RXVT-UNICODE\/URXVT FREQUENTLY ASKED QUESTIONS" | pod2text >$@

$(srcdir)/etc/rxvt-unicode.termcap: $(srcdir)/etc/rxvt-unicode.terminfo
	tic -C $< >$@

tags allbin:

alldoc: rxvt.1.man.in rxvt.7.man.in rxvtc.1.man.in rxvtd.1.man.in rclock.1.man.in \
	../README.configure ../README.FAQ \
	$(srcdir)/etc/rxvt-unicode.termcap

alldocclean:
	rm -f rxvt.1.man.in rxvt.7.man.in rxvtc.1.man.in rxvtd.1.man.in
	rm -f ../README.configure ../README.FAQ
	rm -f $(srcdir)/etc/rxvt-unicode.termcap

clean:
	rm -f rxvt.1.man rxvt.7.man rxvtc.1.man rxvtd.1.man

distclean: clean
	rm -f Makefile

realclean: distclean alldocclean

cleandir: realclean

install: all
	$(INSTALL) -d $(DESTDIR)$(man1dir)
	$(INSTALL) -d $(DESTDIR)$(man7dir)
	$(INSTALL_DATA) rxvt.1.man    $(DESTDIR)$(man1dir)/$(RXVTNAME).$(man1ext)
	$(INSTALL_DATA) rxvtc.1.man   $(DESTDIR)$(man1dir)/$(RXVTNAME)c.$(man1ext)
	$(INSTALL_DATA) rxvtd.1.man   $(DESTDIR)$(man1dir)/$(RXVTNAME)d.$(man1ext)
	$(INSTALL_DATA) rxvt.7.man    $(DESTDIR)$(man7dir)/$(RXVTNAME).$(man7ext)
	$(INSTALL_DATA) rclock.1.man  $(DESTDIR)$(man1dir)/urclock.$(man1ext)
	@TIC@ -x $(srcdir)/etc/rxvt-unicode.terminfo || \
           @TIC@ $(srcdir)/etc/rxvt-unicode.terminfo

distdepend: alldoc

