Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-runtime / man / Makefile.am
index 4c62007..b4e9259 100644 (file)
@@ -1,5 +1,6 @@
 ## Makefile for the gettext-runtime/man subdirectory of GNU gettext
-## Copyright (C) 2001-2003, 2006, 2009 Free Software Foundation, Inc.
+## Copyright (C) 2001-2003, 2006, 2009, 2015 Free Software Foundation,
+## Inc.
 ##
 ## This program is free software: you can redistribute it and/or modify
 ## it under the terms of the GNU General Public License as published by
@@ -39,17 +40,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) $(man_HTML3)
+CLEANFILES = $(man_MAN1GEN) $(man_HTML1GEN)
+MAINTAINERCLEANFILES = $(man_MAN1IN) $(man_MAN1OTHER) $(man_MAN3) \
+$(man_HTML1IN) $(man_HTML1OTHER) $(man_HTML3)
 
 PERL = @PERL@
 RM = rm -f
@@ -60,6 +64,17 @@ HELP2MAN = $(PERL) -w -- $(srcdir)/help2man
 # groff 1.17 or newer.
 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
@@ -75,89 +90,87 @@ uninstall-local: uninstall-html
 # Man pages.
 
 # The progname.x files contain some extra information not found in the
-# "progname --help" output.
+# "progname --help" output.  Each progname.1 depends on the source,
+# not the binary; we don't need to regenerate the binary when any
+# source file changes, only the main one.
 
-gettext.1: gettext.1.in Makefile
-       sed -e 's|@''localedir''@|$(localedir)|g' < `if test -f gettext.1.in; then echo .; else echo $(srcdir); fi`/gettext.1.in > t-$@
-       mv t-$@ $@
-ngettext.1: ngettext.1.in Makefile
-       sed -e 's|@''localedir''@|$(localedir)|g' < `if test -f ngettext.1.in; then echo .; else echo $(srcdir); fi`/ngettext.1.in > t-$@
-       mv t-$@ $@
+$(man_MAN1GEN): 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.in: gettext.x
-       IN_HELP2MAN=1 $(SHELL) x-to-1 $(UPDATEMODE) "$(PERL)" "$(HELP2MAN)" ../src/gettext$(EXEEXT) $(srcdir)/gettext.x gettext.1.in
-ngettext.1.in: ngettext.x
-       IN_HELP2MAN=1 $(SHELL) x-to-1 $(UPDATEMODE) "$(PERL)" "$(HELP2MAN)" ../src/ngettext$(EXEEXT) $(srcdir)/ngettext.x ngettext.1.in
+gettext.1: gettext.1.in
+ngettext.1: ngettext.1.in
 
-envsubst.1: envsubst.x
-       $(SHELL) x-to-1 $(UPDATEMODE) "$(PERL)" "$(HELP2MAN)" ../src/envsubst$(EXEEXT) $(srcdir)/envsubst.x envsubst.1
+$(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 $@
 
-# Depend on version.sh to get version number changes.
-$(man_MAN1IN) $(man_MAN1OTHER): help2man $(top_srcdir)/../version.sh
+gettext.1.in: gettext.x ../src/gettext.c
+ngettext.1.in: ngettext.x ../src/ngettext.c
+envsubst.1: envsubst.x ../src/envsubst.c
 
-# Update them also during "make dist", in order to propagate added command
-# line options that were added, even if version.sh didn't change.
-UPDATEMODE =
-update-man1:
-       $(MAKE) $(man_MAN1IN) $(man_MAN1OTHER) UPDATEMODE=--update
-       $(MAKE)
-# Hidden from automake, but really activated. Works around an automake-1.5 bug.
-#distdir: update-man1
-
-gettext.3: gettext.3.in $(top_srcdir)/../version.sh
-       sed -e 's/@''VERSION''@/@VERSION@/g' < $(srcdir)/gettext.3.in > t-$@
-       mv t-$@ $@
-ngettext.3: ngettext.3.in $(top_srcdir)/../version.sh
-       sed -e 's/@''VERSION''@/@VERSION@/g' < $(srcdir)/ngettext.3.in > t-$@
-       mv t-$@ $@
-textdomain.3: textdomain.3.in $(top_srcdir)/../version.sh
-       sed -e 's/@''VERSION''@/@VERSION@/g' < $(srcdir)/textdomain.3.in > t-$@
-       mv t-$@ $@
-bindtextdomain.3: bindtextdomain.3.in $(top_srcdir)/../version.sh
-       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.sh
-       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)