# $Id: Makefile.in,v 1.15.4.1 1999/02/11 13:34:52 roessler Exp $

SHELL=/bin/sh

PACKAGE=@PACKAGE@
VERSION=@VERSION@

prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
libdir=@libdir@
mandir=@mandir@
sharedir=@sharedir@
srcdir=@srcdir@
docdir=@docdir@
top_srcdir=@top_srcdir@
top_builddir=..
VPATH=@srcdir@
@SET_MAKE@

INSTALL=@INSTALL@
CC=@CC@
XCPPFLAGS=-I. @CPPFLAGS@
CFLAGS=@CFLAGS@ -DSHAREDIR=\"$(sharedir)\" $(XCPPFLAGS)
LDFLAGS=@LDFLAGS@
subdir = doc


DISTFILES = Makefile.in dotlock.man.in  \
	manual.sgml.in mutt.man.in	\
	PGP-Notes.txt			\
	applying-patches.txt		\
	devel-notes.txt			\
	manual.txt

srcdir_DOCFILES = PGP-Notes.txt applying-patches.txt	\
	devel-notes.txt	\
	manual.txt

topsrcdir_DOCFILES = COPYRIGHT GPL INSTALL ChangeLog	\
	README NEWS TODO README.SECURITY

DOCFILES = manual.txt


all: mutt.man dotlock.man try-html try-txt

complete: all html

# We don't ship the html stuff, but we build and install it
# if sgml2html is available.  Instead of nifty autoconf magic,
# we just do this in the makefile. ;)

try-html:
	-$(MAKE) html

try-txt:
	-$(MAKE) manual.txt

html: manual.html

install: dotlock.man mutt.man all
	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/man1
	$(INSTALL) -m 644 mutt.man $(DESTDIR)$(mandir)/man1/mutt.1
	$(INSTALL) -m 644 dotlock.man $(DESTDIR)$(mandir)/man1/mutt_dotlock.1
	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(docdir)
	for f in $(DOCFILES) ; do $(INSTALL) -m 644 $$f $(DESTDIR)$(docdir) ; done
	for f in $(srcdir_DOCFILES) ; do $(INSTALL) -m 644 $(srcdir)/$$f $(DESTDIR)$(docdir) ; done
	for f in $(topsrcdir_DOCFILES) ; do $(INSTALL) -m 644 $(top_srcdir)/$$f $(DESTDIR)$(docdir) ; done
	if [ -f manual.html ] ; then \
		$(MAKE) install-html ; \
	fi
		
install-html: html
	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(docdir)/html
	for f in manual*.html ; do $(INSTALL) -m 644 $$f $(DESTDIR)$(docdir)/html ; done


uninstall:
	-rm -f $(DESTDIR)$(mandir)/man1/mutt.1
	-rm -rf $(DESTDIR)$(docdir)

manual.txt: manual.sgml
	sgml2txt -c latin manual

manual.html: manual.sgml
	sgml2html manual

clean: 
	rm -f *~ *.html *.orig *.rej *.man manual.sgml

clean-real:
	rm -f manual.txt

maintainer-clean: clean clean-real distclean

distclean: clean
	rm -f Makefile

Makefile: Makefile.in ../config.status
	cd .. \
	  && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status

mutt.man: mutt.man.in ../config.status
	cd .. \
	  && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status

dotlock.man: dotlock.man.in ../config.status
	cd .. \
	  && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status

manual.sgml: manual.sgml.in ../config.status
	cd .. \
	  && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status

distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
dist distdir: Makefile $(DISTFILES)
	for file in $(DISTFILES) ; do				\
		ln $(srcdir)/$$file $(distdir) 2> /dev/null 	\
			|| cp -p $(srcdir)/$$file $(distdir); 	\
	done
