]> git.ipfire.org Git - thirdparty/util-linux.git/blame - po-man/Makefile.am
build-sys: fix po-man clean
[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
8f5fff53
KZ
66 rm -rf $(PO_LANGS) *.stamp
67
68install-data-local: gen-mans
69 @for l in $(PO_LANGS); do \
70 mansrcdir="$(abs_builddir)/$$l"; \
71 for s in $(MAN_SECTIONS); do \
72 installfiles=`echo $${mansrcdir}/*.$$s`; \
03f88997 73 if test "$$installfiles" != "$${mansrcdir}/*.$$s"; then \
8f5fff53
KZ
74 installdir="$(DESTDIR)$(mandir)/$$l/man$$s"; \
75 $(MKDIR_P) "$${installdir}" || exit 1; \
76 for file in $$installfiles; do \
77 manname=`echo $$file | sed -e 's|^.*/||'`; \
78 echo " Installing " $$l ": " $$manname ; \
79 $(INSTALL_DATA) $$file $${installdir}; \
80 done; \
81 fi; \
82 done; \
83 done
64936a9d
KZ
84
85uninstall-local:
86 @for l in $(PO_LANGS); do \
87 mansrcdir="$(abs_builddir)/$$l"; \
88 for s in $(MAN_SECTIONS); do \
89 installfiles=`echo $${mansrcdir}/*.$$s`; \
03f88997 90 if test "$$installfiles" != "$${mansrcdir}/*.$$s"; then \
64936a9d
KZ
91 installdir="$(DESTDIR)$(mandir)/$$l/man$$s"; \
92 for file in $$installfiles; do \
93 manname=`echo $$file | sed -e 's|^.*/||'`; \
94 echo " Uninstalling " $$l ": " $$manname ; \
95 rm -f $${installdir}/$${manname}; \
96 done; \
97 fi; \
98 done; \
99 done
100
842ec4ce
KZ
101else
102gen-trans:
103gen-mans:
104all:
105distclean-local:
106clean-local:
107endif