summaryrefslogtreecommitdiffstats
path: root/po-man/Makefile.am
diff options
context:
space:
mode:
Diffstat (limited to 'po-man/Makefile.am')
-rw-r--r--po-man/Makefile.am101
1 files changed, 101 insertions, 0 deletions
diff --git a/po-man/Makefile.am b/po-man/Makefile.am
new file mode 100644
index 0000000..99c22aa
--- /dev/null
+++ b/po-man/Makefile.am
@@ -0,0 +1,101 @@
+
+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
+
+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) 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 trigered by "make dist*"
+# only.
+util-linux-man.pot:
+ @echo 'po4a: force pot-update'
+ $(AM_V_GEN) $(PO4A) --force 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)'
+
+gen-mans: gen-trans
+ @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
+
+distclean-local:
+ 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