]> git.ipfire.org Git - thirdparty/util-linux.git/blame - po-man/Makefile.am
build-sys: only pass --failure-level if supported
[thirdparty/util-linux.git] / po-man / Makefile.am
CommitLineData
8f5fff53
KZ
1
2PO_FILES = $(wildcard *.po)
3PO_LANGS = $(PO_FILES:.po=)
4
5PO_STAMPS = po4a-gen.stamp
6MAN_SECTIONS = 1 3 5 8
7CLEANFILES = $(PO_STAMPS)
8
9EXTRA_DIST = README.md $(PO_FILES) po4a.cfg util-linux-man.pot
09343b31 10DISTCLEANFILES = util-linux-man.pot $(PO_FILES)
8f5fff53 11
842ec4ce 12if ENABLE_POMAN
65abace2
KZ
13util-linux-man.pot: Makefile
14 $(AM_V_GEN) $(PO4A) --verbose --no-translations po4a.cfg
15
8f5fff53
KZ
16po4a-gen.stamp: $(PO_FILES)
17 @echo 'po4a: generate man-pages translations'
9c56fa95 18 $(AM_V_GEN) $(PO4A) --srcdir $(srcdir) $(srcdir)/po4a.cfg
8f5fff53
KZ
19 @touch po4a-gen.stamp
20
00043324
KZ
21# We need to call po4a --force only on 'make dist', otherwise .po and .pot
22# files has to be unmodified. This update has to be done before 'make' copies
23# sources to the $distdir. $EXTRA_DIST (where is util-linux-man.pot) is used as
24# a dependence for 'distdir' automake target, so it's trigered by "make dist*"
25# only.
26util-linux-man.pot:
27 @echo 'po4a: force pot-update'
9c56fa95 28 $(AM_V_GEN) $(PO4A) --force --srcdir $(srcdir) $(srcdir)/po4a.cfg
00043324 29
8f5fff53
KZ
30gen-trans: $(PO_STAMPS)
31
32asciidoc_man_cmd = $(ASCIIDOCTOR) \
33 -b manpage \
6ca582fb
KZ
34 -a 'release-version=$(VERSION)' \
35 -a 'package-docdir=$(docdir)' \
8f5fff53 36 -a 'VERSION=$(VERSION)' \
b4684b50
TW
37 -a 'ADJTIME_PATH=$(ADJTIME_PATH)' \
38 --load-path '$(top_srcdir)/tools' \
39 --require asciidoctor-unicodeconverter
8f5fff53 40
25a70dcb
TW
41if HAVE_ASCIIDOCTOR_FAILURE_LEVEL
42asciidoc_man_cmd += --failure-level ERROR
43endif
44
8f5fff53 45gen-mans: gen-trans
8e9f316c
TW
46 @set -e; \
47 for l in $(PO_LANGS); do \
8f5fff53
KZ
48 gendir="$(abs_builddir)/$$l"; \
49 genfiles=`echo $${gendir}/*.adoc`; \
03f88997 50 if test "$$genfiles" != "$${gendir}/*.adoc"; then \
8f5fff53
KZ
51 for file in $${genfiles}; do \
52 manname=`echo $$file | sed -e 's|^.*/||' -e 's|\.adoc||'`; \
53 test -f $${gendir}/$${manname} || { \
54 echo " GEN " $$l ": " $$manname && \
55 $(asciidoc_man_cmd) \
56 --base-dir=$${gendir} \
57 --destination-dir $${gendir} $${file}; \
58 }; \
59 done; \
60 fi; \
61 done
8f5fff53
KZ
62all: gen-mans
63
64clean-local:
65 rm -f *~ *.bak
66
67distclean-local:
68 rm -rf $(PO_LANGS) *.stamp
69
70install-data-local: gen-mans
71 @for l in $(PO_LANGS); do \
72 mansrcdir="$(abs_builddir)/$$l"; \
73 for s in $(MAN_SECTIONS); do \
74 installfiles=`echo $${mansrcdir}/*.$$s`; \
03f88997 75 if test "$$installfiles" != "$${mansrcdir}/*.$$s"; then \
8f5fff53
KZ
76 installdir="$(DESTDIR)$(mandir)/$$l/man$$s"; \
77 $(MKDIR_P) "$${installdir}" || exit 1; \
78 for file in $$installfiles; do \
79 manname=`echo $$file | sed -e 's|^.*/||'`; \
80 echo " Installing " $$l ": " $$manname ; \
81 $(INSTALL_DATA) $$file $${installdir}; \
82 done; \
83 fi; \
84 done; \
85 done
64936a9d
KZ
86
87uninstall-local:
88 @for l in $(PO_LANGS); do \
89 mansrcdir="$(abs_builddir)/$$l"; \
90 for s in $(MAN_SECTIONS); do \
91 installfiles=`echo $${mansrcdir}/*.$$s`; \
03f88997 92 if test "$$installfiles" != "$${mansrcdir}/*.$$s"; then \
64936a9d
KZ
93 installdir="$(DESTDIR)$(mandir)/$$l/man$$s"; \
94 for file in $$installfiles; do \
95 manname=`echo $$file | sed -e 's|^.*/||'`; \
96 echo " Uninstalling " $$l ": " $$manname ; \
97 rm -f $${installdir}/$${manname}; \
98 done; \
99 fi; \
100 done; \
101 done
102
842ec4ce
KZ
103else
104gen-trans:
105gen-mans:
106all:
107distclean-local:
108clean-local:
109endif