SUBDIRS = po
-if ENABLE_ASCIIDOC
-if ENABLE_POMAN
-SUBDIRS += po-man
-endif
-endif
-
RCS_FIND_IGNORE = \( -name SCCS -o -name BitKeeper -o -name .svn -o \
-name CVS -o -name .pc -o -name .hg -o -name .git \) -prune -o
include pam_lastlog2/Makemodule.am
include bash-completion/Makemodule.am
include man-common/Makemodule.am
+include po-man/Makemodule.am
include Documentation/Makemodule.am
include tests/Makemodule.am
$(MKDIR_P) $$(dirname $@) && \
$(asciidoc_man_cmd) --base-dir=$(abs_srcdir) \
--destination-dir $(abs_builddir)/$$(dirname $@) $<
-
-include \
$(abs_builddir)/**.1.deps \
$(abs_builddir)/**.3.deps \
$(abs_builddir)/**.8.deps
$(MANLINKS): $(MANPAGES)
-gen-man: $(man_MANS)
+gen-man: $(man_MANS) gen-poman
# Standard "make" follows BUILD_* macros from ./configure, and in this case, it
# ignores man pages for disabled tools, but for distribution tarball, we need
+++ /dev/null
-
-PO_FILES = $(wildcard *.po)
-PO_LANGS = $(PO_FILES:.po=)
-
-PO_STAMPS = po4a-gen.stamp
-MAN_SECTIONS = 1 3 5 8
-CLEANFILES = $(PO_STAMPS)
-
-EXTRA_DIST = README.md $(PO_FILES) po4a.cfg util-linux-man.pot
-DISTCLEANFILES = util-linux-man.pot $(PO_FILES)
-
-if ENABLE_POMAN
-util-linux-man.pot: Makefile
- $(AM_V_GEN) $(PO4A) --verbose --no-translations po4a.cfg
-
-po4a-gen.stamp: $(PO_FILES)
- @echo 'po4a: generate man-pages translations'
- $(AM_V_GEN) $(PO4A) --srcdir $(srcdir) $(srcdir)/po4a.cfg
- @touch po4a-gen.stamp
-
-# We need to call po4a --force only on 'make dist', otherwise .po and .pot
-# files has to be unmodified. This update has to be done before 'make' copies
-# sources to the $distdir. $EXTRA_DIST (where is util-linux-man.pot) is used as
-# a dependence for 'distdir' automake target, so it's triggered by "make dist*"
-# only.
-util-linux-man.pot:
- @echo 'po4a: force pot-update'
- $(AM_V_GEN) $(PO4A) --force --srcdir $(srcdir) $(srcdir)/po4a.cfg
-
-gen-trans: $(PO_STAMPS)
-
-asciidoc_man_cmd = $(ASCIIDOCTOR) \
- -b manpage \
- -a 'release-version=$(VERSION)' \
- -a 'package-docdir=$(docdir)' \
- -a 'VERSION=$(VERSION)' \
- -a 'ADJTIME_PATH=$(ADJTIME_PATH)' \
- --load-path '$(top_srcdir)/tools' \
- --require asciidoctor-unicodeconverter
-
-if HAVE_ASCIIDOCTOR_FAILURE_LEVEL
-asciidoc_man_cmd += --failure-level ERROR
-endif
-
-gen-mans: gen-trans
- @set -e; \
- for l in $(PO_LANGS); do \
- gendir="$(abs_builddir)/$$l"; \
- genfiles=`echo $${gendir}/*.adoc`; \
- if test "$$genfiles" != "$${gendir}/*.adoc"; then \
- for file in $${genfiles}; do \
- manname=`echo $$file | sed -e 's|^.*/||' -e 's|\.adoc||'`; \
- test -f $${gendir}/$${manname} || { \
- echo " GEN " $$l ": " $$manname && \
- $(asciidoc_man_cmd) \
- --base-dir=$${gendir} \
- --destination-dir $${gendir} $${file}; \
- }; \
- done; \
- fi; \
- done
-all: gen-mans
-
-clean-local:
- rm -f *~ *.bak
- rm -rf $(PO_LANGS) *.stamp
-
-install-data-local: gen-mans
- @for l in $(PO_LANGS); do \
- mansrcdir="$(abs_builddir)/$$l"; \
- for s in $(MAN_SECTIONS); do \
- installfiles=`echo $${mansrcdir}/*.$$s`; \
- if test "$$installfiles" != "$${mansrcdir}/*.$$s"; then \
- installdir="$(DESTDIR)$(mandir)/$$l/man$$s"; \
- $(MKDIR_P) "$${installdir}" || exit 1; \
- for file in $$installfiles; do \
- manname=`echo $$file | sed -e 's|^.*/||'`; \
- echo " Installing " $$l ": " $$manname ; \
- $(INSTALL_DATA) $$file $${installdir}; \
- done; \
- fi; \
- done; \
- done
-
-uninstall-local:
- @for l in $(PO_LANGS); do \
- mansrcdir="$(abs_builddir)/$$l"; \
- for s in $(MAN_SECTIONS); do \
- installfiles=`echo $${mansrcdir}/*.$$s`; \
- if test "$$installfiles" != "$${mansrcdir}/*.$$s"; then \
- installdir="$(DESTDIR)$(mandir)/$$l/man$$s"; \
- for file in $$installfiles; do \
- manname=`echo $$file | sed -e 's|^.*/||'`; \
- echo " Uninstalling " $$l ": " $$manname ; \
- rm -f $${installdir}/$${manname}; \
- done; \
- fi; \
- done; \
- done
-
-else
-gen-trans:
-gen-mans:
-all:
-distclean-local:
-clean-local:
-endif
--- /dev/null
+if ENABLE_ASCIIDOC
+if ENABLE_POMAN
+
+PO_FILES = po-man/$(wildcard *.po)
+
+EXTRA_DIST += po-man/README.md \
+ po-man/po4a.cfg \
+ po-man/util-linux-man.pot \
+ $(PO_FILES)
+
+
+asciidoc_poman_translate_cmd = $(top_srcdir)/po-man/translate.sh \
+ --progress \
+ --srcdir '$(top_srcdir)/po-man' \
+ --destdir '$(top_builddir)/po-man/translations' \
+ --asciidoctor-load-path '$(top_srcdir)/tools' \
+ --docdir '$(docdir)' \
+ --po4acfg '$(top_srcdir)/po-man/po4a.cfg' \
+ --util-linux-version '$(VERSION)'
+
+asciidoc_poman_install_cmd = $(top_srcdir)/po-man/install-translations.sh \
+ --mandir '$(DESTDIR)/$(mandir)' \
+ --mansrcdir '$(top_builddir)/po-man/translations/man'
+
+
+ADOCFILES = $(MANPAGES:=.adoc)
+gen-poman: $(ADOCFILES_COMMON) $(ADOCFILES)
+ $(asciidoc_poman_translate_cmd) $(ADOCFILES)
+
+
+install-data-hook-poman:
+ $(asciidoc_poman_install_cmd) --install
+INSTALL_DATA_HOOKS += install-data-hook-poman
+
+
+uninstall-hook-poman:
+ $(asciidoc_poman_install_cmd) --uninstall
+UNINSTALL_HOOKS += uninstall-hook-poman
+
+
+clean-local-hook-poman:
+ rm -rf $(top_builddir)/po-man/translations
+CLEAN_LOCALS += clean-local-hook-poman
+
+
+# !ENABLE_POMAN
+else
+gen-poman:
+endif
+
+# ENABLE_ASCIIDOC
+endif