Factor trim format function out
[mmh] / man / Makefile.in
index ad2b458..adb0e89 100644 (file)
@@ -1,8 +1,6 @@
 #
 # Makefile for man subdirectory
 #
-# $Id$
-#
 
 VERSION = @VERSION@
 DATE = @DATE@
@@ -18,161 +16,165 @@ exec_prefix = @exec_prefix@
 bindir      = @bindir@
 libdir      = @libdir@
 etcdir      = @sysconfdir@
+datarootdir = @datarootdir@
 mandir      = @mandir@
 manext1     = 1
 manext5     = 5
+manext7     = 7
 manext8     = 8
 
 mailspool    = @mailspool@
 sendmailpath = @sendmailpath@
 
-default_editor = @editorpath@
-default_pager = @pagerpath@
-
 INSTALL      = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 
 SED = sed
 SEDMAN = $(SED) -f man.sed $< > $@
 
-# sed line for editing pop information in man pages
-POPSED = @POPSED@
-
 .SUFFIXES:
-.SUFFIXES: .man .$(manext1) .$(manext5) .$(manext8)
+.SUFFIXES: .man1 .man5 .man7 .man8 \
+       .$(manext1) .$(manext5) .$(manext7) .$(manext8)
+
+.man1.$(manext1):
+       $(SEDMAN)
 
-.man.$(manext1):
+.man5.$(manext5):
        $(SEDMAN)
 
-.man.$(manext5):
+.man7.$(manext7):
        $(SEDMAN)
 
-.man.$(manext8):
+.man8.$(manext8):
        $(SEDMAN)
 
 # man pages to install in $(mandir)/$(manext1)
-MAN1SRC = ali. anno. burst. comp.              \
-       dist. flist. flists. folder. folders.   \
-       forw. inc. install-mh. mark. mh-chart.  \
-       nmh. mhbuild. mhl. mhlist. mhmail.      \
-       mhn. mhparam. mhpath. mhshow.           \
-       mhstore. msgchk. msh.                   \
-       next. packf. pick. prev.                        \
-       prompter. rcvdist. rcvpack.             \
-       rcvstore. rcvtty. refile.               \
-       repl. rmf. rmm. scan.                   \
-       send. sendfiles. show. slocal.          \
-       sortm. whatnow. whom.
-
-MAN5SRC = mh-alias. mh-draft. mh-format.       \
-       mh-mail. mh-profile. mh-sequence.       \
-       mh-tailor. mts.conf.
-
-MAN8SRC = ap. conflict. dp. fmtdump.           \
-       mh-mts. post.
+MAN1SRC = ali. anno. burst. comp. dist. flist. flists. folder. folders. \
+       forw. inc. mark. mhbuild. mhl. mhlist. mhsign. mhpgp. mmh. mmhwrap. \
+       mhmail. mhparam. mhpath. mhstore. new. fnext. \
+       fprev. unseen. next. packf. pick. prev. prompter. rcvdist. rcvpack. \
+       rcvstore. refile. repl. rmf. rmm. scan. send. sendfiles. \
+       show. slocal. sortm. whatnow. whom. whatnow2.
+
+MAN5SRC = mh-alias. mh-format. mh-mail. mh-profile.
+
+MAN7SRC = mmh-intro. mh-chart. mh-draft. mh-sequence. 
+
+MAN8SRC = spost. ap. dp. fmtdump.
 
 MAN1 = $(MAN1SRC:.=.$(manext1))
 MAN5 = $(MAN5SRC:.=.$(manext5))
+MAN7 = $(MAN7SRC:.=.$(manext7))
 MAN8 = $(MAN8SRC:.=.$(manext8))
 
-# Since vmh is not built or distributed, neither should vmh.1 be
-# MANEXTRA = vmh. 
+ALLPROGS = $(MAN1) $(MAN8)
 
-# source for man pages
-DIST_MANSRC = $(MAN1SRC) $(MAN5SRC) $(MAN8SRC)
-DIST_MAN = $(DIST_MANSRC:.=.man)
-
-# auxiliary files
-AUX = Makefile.in
+# ========= DEFAULT TARGET ==========
 
-# all files in this directory included in the distribution
-DIST = $(DIST_MAN) $(AUX)
+all: $(MAN1) $(MAN5) $(MAN7) $(MAN8)
 
-# ========= DEFAULT TARGET ==========
+mh-chart.man7: $(ALLPROGS)
+       $(srcdir)/mh-chart-gen.sh $(ALLPROGS) >$@
 
-all: $(MAN1) $(MAN5) $(MAN8)
+titles:
+       $(srcdir)/gettitles.sh 1 >titles1.temp
+       $(srcdir)/gettitles.sh 5 >titles5.temp
+       $(srcdir)/gettitles.sh 7 >titles7.temp
+       $(srcdir)/gettitles.sh 8 >titles8.temp
 
-$(MAN1) $(MAN5) $(MAN8): man.sed
+$(MAN1) $(MAN5) $(MAN7) $(MAN8): man.sed
 
 # create the sed file for building man pages
-man.sed: Makefile
-       echo 's,%nmhwarning%,THIS FILE HAS BEEN AUTOMATICALLY GENERATED.  DO NOT EDIT.,g' > $@
-       echo 's,%nmhversion%,nmh-$(VERSION),g' >> $@
-       echo 's,%nmhdate%,$(DATE),g' >> $@
-       echo 's,%bindir%,$(bindir),g' >> $@
-       echo 's,%etcdir%,$(etcdir),g' >> $@
-       echo 's,%libdir%,$(libdir),g' >> $@
-       echo 's,%mandir%,$(mandir),g' >> $@
-       echo 's,%mailspool%,$(mailspool),g' >> $@
-       echo 's,%sendmailpath%,$(sendmailpath),g' >> $@
-       echo 's,%default_editor%,$(default_editor),g' >> $@
-       echo 's,%default_pager%,$(default_pager),g' >> $@
-       echo 's,%manext1%,$(manext1),g' >> $@
-       echo 's,%manext5%,$(manext5),g' >> $@
-       echo 's,%manext8%,$(manext8),g' >> $@
-       echo '$(POPSED)' >> $@
-       echo '/%components%/r $(top_srcdir)/etc/components' >> $@
-       echo ' s,%components%,,g' >> $@
-       echo '/%distcomps%/r $(top_srcdir)/etc/distcomps' >> $@
-       echo ' s,%distcomps%,,g' >> $@
-       echo '/%forwcomps%/r $(top_srcdir)/etc/forwcomps' >> $@
-       echo ' s,%forwcomps%,,g' >> $@
-       echo '/%mhl_forward%/r $(top_srcdir)/etc/mhl.forward' >> $@
-       echo ' s,%mhl_forward%,,g' >> $@
-       echo '/%mhl_format%/r $(top_srcdir)/etc/mhl.format' >> $@
-       echo ' s,%mhl_format%,,g' >> $@
-       echo '/%mhl_reply%/r $(top_srcdir)/etc/mhl.reply' >> $@
-       echo ' s,%mhl_reply%,,g' >> $@
+man.sed: Makefile titles
+       @echo 's,%nmhwarning%,THIS FILE HAS BEEN AUTOMATICALLY GENERATED.  DO NOT EDIT.,g' > $@
+       @echo 's,%nmhversion%,mmh-$(VERSION),g' >> $@
+       @echo 's,%nmhdate%,$(DATE),g' >> $@
+       @echo 's,%bindir%,$(bindir),g' >> $@
+       @echo 's,%etcdir%,$(etcdir),g' >> $@
+       @echo 's,%libdir%,$(libdir),g' >> $@
+       @echo 's,%mandir%,$(mandir),g' >> $@
+       @echo 's,%mailspool%,$(mailspool),g' >> $@
+       @echo 's,%sendmailpath%,$(sendmailpath),g' >> $@
+       @echo 's,%manext1%,$(manext1),g' >> $@
+       @echo 's,%manext5%,$(manext5),g' >> $@
+       @echo 's,%manext7%,$(manext7),g' >> $@
+       @echo 's,%manext8%,$(manext8),g' >> $@
+       @echo '/%components%/r $(top_srcdir)/etc/components' >> $@
+       @echo ' s,%components%,,g' >> $@
+       @echo '/%distcomps%/r $(top_srcdir)/etc/distcomps' >> $@
+       @echo ' s,%distcomps%,,g' >> $@
+       @echo '/%forwcomps%/r $(top_srcdir)/etc/forwcomps' >> $@
+       @echo ' s,%forwcomps%,,g' >> $@
+       @echo '/%mhl_forward%/r $(top_srcdir)/etc/mhl.forward' >> $@
+       @echo ' s,%mhl_forward%,,g' >> $@
+       @echo '/%mhl_format%/r $(top_srcdir)/etc/mhl.format' >> $@
+       @echo ' s,%mhl_format%,,g' >> $@
+       @echo '/%mhl_reply%/r $(top_srcdir)/etc/mhl.reply' >> $@
+       @echo ' s,%mhl_reply%,,g' >> $@
+       @echo '/^%titles1%$$/r titles1.temp' >> $@
+       @echo '/^%titles5%$$/r titles5.temp' >> $@
+       @echo '/^%titles7%$$/r titles7.temp' >> $@
+       @echo '/^%titles8%$$/r titles8.temp' >> $@
+       @echo '/^%titles[0-9]%$$/d' >> $@
 
 # ========= INSTALL TARGETS =========
 
-install: install-man1 install-man5 install-man8
+install: install-man1 install-man5 install-man7 install-man8
 
 # install the man pages in man1
 install-man1:
-       $(top_srcdir)/mkinstalldirs $(mandir)/man$(manext1)
+       mkdir -p $(DESTDIR)$(mandir)/man$(manext1)
        for file in $(MAN1); do \
-         $(INSTALL_DATA) $$file $(mandir)/man$(manext1) ; \
+         $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man$(manext1) ; \
        done
 
 # install the man pages in man5
 install-man5:
-       $(top_srcdir)/mkinstalldirs $(mandir)/man$(manext5)
+       mkdir -p $(DESTDIR)$(mandir)/man$(manext5)
        for file in $(MAN5); do \
-         $(INSTALL_DATA) $$file $(mandir)/man$(manext5) ; \
+         $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man$(manext5) ; \
+       done
+
+# install the man pages in man7
+install-man7:
+       mkdir -p $(DESTDIR)$(mandir)/man$(manext7)
+       for file in $(MAN7); do \
+         $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man$(manext7) ; \
        done
-       if [ ! -f $(mandir)/man$(manext5)/mh_profile.$(manext5) ] ; then \
-         ( cd $(mandir)/man$(manext5) ; ln mh-profile.$(manext5) \
-            mh_profile.$(manext5) ) \
-       fi
 
 # install the man pages in man8
 install-man8:
-       $(top_srcdir)/mkinstalldirs $(mandir)/man$(manext8)
+       mkdir -p $(DESTDIR)$(mandir)/man$(manext8)
        for file in $(MAN8); do \
-         $(INSTALL_DATA) $$file $(mandir)/man$(manext8) ; \
+         $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man$(manext8) ; \
        done
 
 # ========= UNINSTALL TARGETS =========
 
-uninstall: uninstall-man1 uninstall-man5 uninstall-man8
+uninstall: uninstall-man1 uninstall-man5 uninstall-man7 uninstall-man8
 
 # uninstall the man pages in man1
 uninstall-man1:
        for file in $(MAN1); do \
-         rm -f $(mandir)/man$(manext1)/$$file; \
+         rm -f $(DESTDIR)$(mandir)/man$(manext1)/$$file; \
        done
 
 # uninstall the man pages in man5
 uninstall-man5:
        for file in $(MAN5); do \
-         rm -f $(mandir)/man$(manext5)/$$file; \
+         rm -f $(DESTDIR)$(mandir)/man$(manext5)/$$file; \
+       done
+
+# uninstall the man pages in man7
+uninstall-man7:
+       for file in $(MAN7); do \
+         rm -f $(DESTDIR)$(mandir)/man$(manext7)/$$file; \
        done
 
 # uninstall the man pages in man8
 uninstall-man8:
        for file in $(MAN8); do \
-         rm -f $(mandir)/man$(manext8)/$$file; \
+         rm -f $(DESTDIR)$(mandir)/man$(manext8)/$$file; \
        done
 
 # ========== DEPENDENCIES FOR CLEANUP ==========
@@ -181,7 +183,9 @@ mostlyclean:
        rm -f *~
 
 clean: mostlyclean
-       rm -f man.sed *.$(manext1) *.$(manext5) *.$(manext8)
+       rm -f $(MAN1) $(MAN5) $(MAN7) $(MAN8)
+       rm -f man.sed mh-chart.man7
+       rm -f titles[0-9].temp
 
 distclean: clean
        rm -f Makefile
@@ -198,11 +202,4 @@ subdir = man
 
 Makefile: Makefile.in ../config.status
        cd .. && ./config.status $(subdir)/$@
-distdir = ../`cat ../distname`/$(subdir)
-nmhdist: $(DIST)
-       @echo "Copying distribution files in $(subdir)"
-       @for file in $(DIST); do \
-         cp -p $(srcdir)/$$file $(distdir); \
-       done