]> git.ipfire.org Git - thirdparty/util-linux.git/blob - po-man/Makefile.am
flock: initialize timevals [-Werror=maybe-uninitialized]
[thirdparty/util-linux.git] / po-man / Makefile.am
1
2 PO_FILES = $(wildcard *.po)
3 PO_LANGS = $(PO_FILES:.po=)
4
5 PO_STAMPS = po4a-gen.stamp
6 MAN_SECTIONS = 1 3 5 8
7 CLEANFILES = $(PO_STAMPS)
8
9 EXTRA_DIST = README.md $(PO_FILES) po4a.cfg util-linux-man.pot
10 DISTCLEANFILES = util-linux-man.pot $(PO_FILES)
11
12 if ENABLE_POMAN
13 util-linux-man.pot: Makefile
14 $(AM_V_GEN) $(PO4A) --verbose --no-translations po4a.cfg
15
16 po4a-gen.stamp: $(PO_FILES)
17 @echo 'po4a: generate man-pages translations'
18 $(AM_V_GEN) $(PO4A) --srcdir $(srcdir) $(srcdir)/po4a.cfg
19 @touch po4a-gen.stamp
20
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.
26 util-linux-man.pot:
27 @echo 'po4a: force pot-update'
28 $(AM_V_GEN) $(PO4A) --force --srcdir $(srcdir) $(srcdir)/po4a.cfg
29
30 gen-trans: $(PO_STAMPS)
31
32 asciidoc_man_cmd = $(ASCIIDOCTOR) \
33 -b manpage \
34 -a 'release-version=$(VERSION)' \
35 -a 'package-docdir=$(docdir)' \
36 -a 'VERSION=$(VERSION)' \
37 -a 'ADJTIME_PATH=$(ADJTIME_PATH)' \
38 --load-path '$(top_srcdir)/tools' \
39 --require asciidoctor-unicodeconverter
40
41 if HAVE_ASCIIDOCTOR_FAILURE_LEVEL
42 asciidoc_man_cmd += --failure-level ERROR
43 endif
44
45 gen-mans: gen-trans
46 @set -e; \
47 for l in $(PO_LANGS); do \
48 gendir="$(abs_builddir)/$$l"; \
49 genfiles=`echo $${gendir}/*.adoc`; \
50 if test "$$genfiles" != "$${gendir}/*.adoc"; then \
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
62 all: gen-mans
63
64 clean-local:
65 rm -f *~ *.bak
66
67 distclean-local:
68 rm -rf $(PO_LANGS) *.stamp
69
70 install-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`; \
75 if test "$$installfiles" != "$${mansrcdir}/*.$$s"; then \
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
86
87 uninstall-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`; \
92 if test "$$installfiles" != "$${mansrcdir}/*.$$s"; then \
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
103 else
104 gen-trans:
105 gen-mans:
106 all:
107 distclean-local:
108 clean-local:
109 endif