diff options
author | Daiki Ueno <ueno@gnu.org> | 2014-05-19 12:17:39 +0900 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2014-05-19 17:41:39 +0900 |
commit | d711425b1d99250cabbebb110eccec351ce87d38 (patch) | |
tree | 8804ef7e947b27ad09da58a06f7b23184fed19dc /gettext-runtime | |
parent | 3dd10133915e2cea4664ae7767f42e11c5257cb2 (diff) | |
download | external_gettext-d711425b1d99250cabbebb110eccec351ce87d38.zip external_gettext-d711425b1d99250cabbebb110eccec351ce87d38.tar.gz external_gettext-d711425b1d99250cabbebb110eccec351ce87d38.tar.bz2 |
build: Simplify man and HTML documentation generation
Problem reported by Santiago Vila in:
<https://lists.gnu.org/archive/html/bug-gettext/2014-05/msg00024.html>.
Diffstat (limited to 'gettext-runtime')
-rw-r--r-- | gettext-runtime/man/ChangeLog | 16 | ||||
-rw-r--r-- | gettext-runtime/man/Makefile.am | 121 |
2 files changed, 84 insertions, 53 deletions
diff --git a/gettext-runtime/man/ChangeLog b/gettext-runtime/man/ChangeLog index 4bbea80..81a3da5 100644 --- a/gettext-runtime/man/ChangeLog +++ b/gettext-runtime/man/ChangeLog @@ -1,3 +1,19 @@ +2014-05-19 Daiki Ueno <ueno@gnu.org> + + build: Simplify man and HTML documentation generation + Problem reported by Santiago Vila in: + <https://lists.gnu.org/archive/html/bug-gettext/2014-05/msg00024.html>. + * Makefile.am (man_HTML1GEN): Rename from man_HTMLGEN. + (man_HTML1IN): Rename from man_HTMLIN. + (man_HTML1OTHER): Rename from man_HTMLOTHER. + (man_HTML1): New variable. + (man_HTML3): New variable split from man_HTMLOTHER. + (gt_man2html): New variable; don't overwrite output if groff fails. + ($(man_HTML1GEN)): Don't overwrite output if sed fails. + ($(man_HTML1IN)): Rewrite using $(gt_man2html). + ($(man_HTML1OTHER)): Rewrite using $(gt_man2html). + ($(man_HTML3)): Rewrite using $(gt_man2html). + 2014-05-12 Daiki Ueno <ueno@gnu.org> * Makefile.am (gettext.1 ngettext.1): Don't try to replace diff --git a/gettext-runtime/man/Makefile.am b/gettext-runtime/man/Makefile.am index b05154e..2232cfb 100644 --- a/gettext-runtime/man/Makefile.am +++ b/gettext-runtime/man/Makefile.am @@ -39,17 +39,20 @@ man_MAN3LINK = dgettext.3 dcgettext.3 dngettext.3 dcngettext.3 man_MANS = $(man_MAN1) notrans_man_MANS = $(man_MAN3) $(man_MAN3LINK) -man_HTMLGEN = gettext.1.html ngettext.1.html -man_HTMLIN = gettext.1.html.in ngettext.1.html.in -man_HTMLOTHER = \ -envsubst.1.html \ -gettext.3.html ngettext.3.html \ +man_HTML1GEN = gettext.1.html ngettext.1.html +man_HTML1IN = gettext.1.html.in ngettext.1.html.in +man_HTML1OTHER = envsubst.1.html +man_HTML1 = $(man_HTML1GEN) $(man_HTML1OTHER) +man_HTML3 = gettext.3.html ngettext.3.html \ textdomain.3.html bindtextdomain.3.html bind_textdomain_codeset.3.html -man_HTML = $(man_HTMLGEN) $(man_HTMLOTHER) +man_HTML = $(man_HTML1) $(man_HTML3) -EXTRA_DIST += help2man $(man_aux) $(man_MAN1IN) $(man_MAN1OTHER) $(man_MAN3) $(man_MAN3IN) $(man_MAN3LINK) $(man_HTMLIN) $(man_HTMLOTHER) -CLEANFILES = $(man_MAN1GEN) $(man_HTMLGEN) -MAINTAINERCLEANFILES = $(man_MAN1IN) $(man_MAN1OTHER) $(man_MAN3) $(man_HTMLIN) $(man_HTMLOTHER) +EXTRA_DIST += help2man $(man_aux) $(man_MAN1IN) $(man_MAN1OTHER) \ +$(man_MAN3) $(man_MAN3IN) $(man_MAN3LINK) \ +$(man_HTML1IN) $(man_HTML1OTHER) +CLEANFILES = $(man_MAN1GEN) $(man_HTML1GEN) +MAINTAINERCLEANFILES = $(man_MAN1IN) $(man_MAN1OTHER) $(man_MAN3) \ +$(man_HTML1IN) $(man_HTML1OTHER) $(man_HTML3) PERL = @PERL@ RM = rm -f @@ -63,6 +66,15 @@ MAN2HTML = groff -mandoc -Thtml UPDATEMODE = +gt_man2html = \ + if test -f $${srcdir}$$m; then \ + $(MAN2HTML) $${srcdir}$$m > t-$@ && \ + sed -e '/CreationDate:/d' < t-$@ > t2-$@ && \ + mv t2-$@ $@; \ + rm -f t-$@ t2-$@; \ + fi + + # We distribute both the man pages and their HTML equivalent. # The user can generate the parts, via # make man @@ -81,80 +93,83 @@ uninstall-local: uninstall-html # not the binary; we don't need to regenerate the binary when any # source file changes, only the main one. -gettext.1 ngettext.1: Makefile +$(man_MAN1GEN): Makefile srcdir=''; \ test -f ./$@.in || srcdir=$(srcdir)/; \ if test -f $${srcdir}$@.in; then \ - sed -e 's|@''localedir''@|$(localedir)|g' $${srcdir}$@.in > t-$@; \ + sed -e 's|@''localedir''@|$(localedir)|g' $${srcdir}$@.in > t-$@ && \ mv t-$@ $@; \ fi + gettext.1: gettext.1.in ngettext.1: ngettext.1.in +$(man_MAN1IN) $(man_MAN1OTHER): help2man $(top_srcdir)/../.version + progname=`echo $@ | sed -e 's/\.in$$//' -e 's/\.1$$//'`; \ + IN_HELP2MAN=1 $(SHELL) x-to-1 $(UPDATEMODE) "$(PERL)" "$(HELP2MAN)" \ + ../src/$${progname}$(EXEEXT) $(srcdir)/$${progname}.x $@ + gettext.1.in: gettext.x ../src/gettext.c - IN_HELP2MAN=1 $(SHELL) x-to-1 $(UPDATEMODE) "$(PERL)" "$(HELP2MAN)" ../src/gettext$(EXEEXT) $(srcdir)/gettext.x gettext.1.in ngettext.1.in: ngettext.x ../src/ngettext.c - IN_HELP2MAN=1 $(SHELL) x-to-1 $(UPDATEMODE) "$(PERL)" "$(HELP2MAN)" ../src/ngettext$(EXEEXT) $(srcdir)/ngettext.x ngettext.1.in - envsubst.1: envsubst.x ../src/envsubst.c - $(SHELL) x-to-1 $(UPDATEMODE) "$(PERL)" "$(HELP2MAN)" ../src/envsubst$(EXEEXT) $(srcdir)/envsubst.x envsubst.1 - -$(man_MAN1IN) $(man_MAN1OTHER): help2man $(top_srcdir)/../.version -gettext.3: gettext.3.in $(top_srcdir)/../.version - sed -e 's/@''VERSION''@/@VERSION@/g' < $(srcdir)/gettext.3.in > t-$@ - mv t-$@ $@ -ngettext.3: ngettext.3.in $(top_srcdir)/../.version - sed -e 's/@''VERSION''@/@VERSION@/g' < $(srcdir)/ngettext.3.in > t-$@ - mv t-$@ $@ -textdomain.3: textdomain.3.in $(top_srcdir)/../.version - sed -e 's/@''VERSION''@/@VERSION@/g' < $(srcdir)/textdomain.3.in > t-$@ - mv t-$@ $@ -bindtextdomain.3: bindtextdomain.3.in $(top_srcdir)/../.version - sed -e 's/@''VERSION''@/@VERSION@/g' < $(srcdir)/bindtextdomain.3.in > t-$@ - mv t-$@ $@ -bind_textdomain_codeset.3: bind_textdomain_codeset.3.in $(top_srcdir)/../.version - sed -e 's/@''VERSION''@/@VERSION@/g' < $(srcdir)/bind_textdomain_codeset.3.in > t-$@ +$(man_MAN3): $(top_srcdir)/../.version + sed -e 's/@''VERSION''@/@VERSION@/g' < $(srcdir)/$@.in > t-$@ && \ mv t-$@ $@ +gettext.3: gettext.3.in +ngettext.3: ngettext.3.in +textdomain.3: textdomain.3.in +bindtextdomain.3: bindtextdomain.3.in +bind_textdomain_codeset.3: bind_textdomain_codeset.3.in + # Man pages in HTML format. html-local: $(man_HTML) -gettext.1.html: gettext.1.html.in Makefile - sed -e 's|@''localedir''@|$(localedir)|g' < `if test -f gettext.1.html.in; then echo .; else echo $(srcdir); fi`/gettext.1.html.in > t-$@ - mv t-$@ $@ -ngettext.1.html: ngettext.1.html.in Makefile - sed -e 's|@''localedir''@|$(localedir)|g' < `if test -f ngettext.1.html.in; then echo .; else echo $(srcdir); fi`/ngettext.1.html.in > t-$@ - mv t-$@ $@ +$(man_HTML1GEN): Makefile + srcdir=''; \ + test -f ./$@.in || srcdir=$(srcdir)/; \ + if test -f $${srcdir}$@.in; then \ + sed -e 's|@''localedir''@|$(localedir)|g' $${srcdir}$@.in > t-$@ && \ + mv t-$@ $@; \ + fi + +gettext.1.html: gettext.1.html.in +ngettext.1.html: ngettext.1.html.in + +$(man_HTML1IN): + srcdir=''; \ + progname=`echo $@ | sed -e 's/\.1\.html\.in$$//'`; \ + m=$${progname}.1.in; \ + test -f ./$$m || srcdir=$(srcdir)/; \ + $(gt_man2html) gettext.1.html.in: gettext.1.in - $(MAN2HTML) `if test -f gettext.1.in; then echo .; else echo $(srcdir); fi`/gettext.1.in | sed -e '/CreationDate:/d' > t-$@ - mv t-$@ $@ ngettext.1.html.in: ngettext.1.in - $(MAN2HTML) `if test -f ngettext.1.in; then echo .; else echo $(srcdir); fi`/ngettext.1.in | sed -e '/CreationDate:/d' > t-$@ - mv t-$@ $@ + +$(man_HTML1OTHER): + srcdir=''; \ + progname=`echo $@ | sed -e 's/\.1\.html$$//'`; \ + m=$${progname}.1; \ + test -f ./$$m || srcdir=$(srcdir)/; \ + $(gt_man2html) envsubst.1.html: envsubst.1 - $(MAN2HTML) `if test -f envsubst.1; then echo .; else echo $(srcdir); fi`/envsubst.1 | sed -e '/CreationDate:/d' > t-$@ - mv t-$@ $@ + +$(man_HTML3): + srcdir=''; \ + progname=`echo $@ | sed -e 's/\.3\.html$$//'`; \ + m=$${progname}.3.in; \ + test -f ./$$m || srcdir=$(srcdir)/; \ + $(gt_man2html) gettext.3.html: gettext.3.in - $(MAN2HTML) $(srcdir)/gettext.3.in | sed -e '/CreationDate:/d' > t-$@ - mv t-$@ $@ ngettext.3.html: ngettext.3.in - $(MAN2HTML) $(srcdir)/ngettext.3.in | sed -e '/CreationDate:/d' > t-$@ - mv t-$@ $@ textdomain.3.html: textdomain.3.in - $(MAN2HTML) $(srcdir)/textdomain.3.in | sed -e '/CreationDate:/d' > t-$@ - mv t-$@ $@ bindtextdomain.3.html: bindtextdomain.3.in - $(MAN2HTML) $(srcdir)/bindtextdomain.3.in | sed -e '/CreationDate:/d' > t-$@ - mv t-$@ $@ bind_textdomain_codeset.3.html: bind_textdomain_codeset.3.in - $(MAN2HTML) $(srcdir)/bind_textdomain_codeset.3.in | sed -e '/CreationDate:/d' > t-$@ - mv t-$@ $@ install-html-local: $(MKDIR_P) $(DESTDIR)$(htmldir) |