]>
Commit | Line | Data |
---|---|---|
8f5fff53 KZ |
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 | |
09343b31 | 10 | DISTCLEANFILES = util-linux-man.pot $(PO_FILES) |
8f5fff53 | 11 | |
842ec4ce | 12 | if ENABLE_POMAN |
65abace2 KZ |
13 | util-linux-man.pot: Makefile |
14 | $(AM_V_GEN) $(PO4A) --verbose --no-translations po4a.cfg | |
15 | ||
8f5fff53 KZ |
16 | po4a-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. | |
26 | util-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 |
30 | gen-trans: $(PO_STAMPS) |
31 | ||
32 | asciidoc_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 |
41 | if HAVE_ASCIIDOCTOR_FAILURE_LEVEL |
42 | asciidoc_man_cmd += --failure-level ERROR | |
43 | endif | |
44 | ||
8f5fff53 | 45 | gen-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 |
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`; \ | |
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 | |
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`; \ | |
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 |
103 | else |
104 | gen-trans: | |
105 | gen-mans: | |
106 | all: | |
107 | distclean-local: | |
108 | clean-local: | |
109 | endif |