summaryrefslogtreecommitdiff
path: root/man-po/Makefile.am
blob: 240ef4bef2c60aa951efae218f3a5fa88392bd89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121

# *.po and *.pot are kept in VCS and generated by po4a-dist command
# translated/* are put in distribution but not found in VCS
#
# run:
#   make -C man-po po4a-dist
# To update man page translations

dist_man_MANS = \
	../free.1 \
	../pgrep.1 \
	../pkill.1 \
	../pmap.1 \
	../uptime.1 \
	../vmstat.8 \
	../w.1 \
	../ps/procps.1

if !CYGWIN
dist_man_MANS += \
	../pwdx.1 \
	../tload.1 \
	../sysctl.8 \
	../sysctl.conf.5 \
	../ps/ps.1
endif

translated_MANS = $(wildcard translated/*/*.[1-9])
translated_MAN_sections=$(subst .,,$(sort $(suffix $(translated_MANS))))

translated_langs = $(notdir $(wildcard translated/*))


EXTRA_DIST = po4a.cfg \
	     procps-man.pot \
	     $(translated_MANS)

LINGUAS_DIST=$(subst .po,,$(wildcard $(srcdir)/*.po))
# If the user has not defined it let's use the default.
LINGUAS ?= $(LINGUAS_DIST)


PO4A_V = $(PO4A_V_@AM_V@)
PO4A_V_ = $(PO4A_V_@AM_DEFAULT_V@)
PO4A_V_0 = @echo "  PO4A   $@";

PO4A_OPTS = --srcdir $(srcdir) --destdir $(CURDIR) \
            --package-name $(PACKAGE) --package-version $(VERSION) \
            --msgid-bugs-address "Procps list <procps@freelists.org>"

all-local: all-local-@USE_PO4A@

all-local-no:
all-local-yes: man.stamp

# FIXME: Use a stamp file until po4a supports them internally.
man.stamp:
	$(PO4A_V) $(PO4A) $(PO4A_OPTS) $(srcdir)/po4a.cfg
	$(AM_V_at) touch $@

clean-local: clean-local-@USE_PO4A@

clean-local-no:
clean-local-yes:
	rm -rf $(LINGUAS_DIST)
	$(AM_V_at) rm -f man.stamp

.PHONY: update-po

procps-man.pot:
#	parafiles = $(patsubst %,-m%,$(subst :, ,$(dist_man_MANS)))
#	parafiles = $(dist_man_MANS:doc=Ente)
	po4a-gettextize -M utf8 --option groff_code=verbatim --option generated --option untranslated="a.RE,\|" --option unknown_macros=untranslated -f man $(patsubst %,-m%,$(subst :, ,$(dist_man_MANS))) -p $@


install-data-local: install-data-local-@USE_PO4A@

install-data-local-no:
install-data-local-yes:
	for lang in $(LINGUAS) ; do \
	    files=""; \
	    for trans in $(notdir $(dist_man_MANS)); do \
		if [ -f $(CURDIR)/$$lang/$$trans ]; then \
		    files="$$files $(CURDIR)/$$lang/$$trans"; \
		elif [ -f $(srcdir)/$$lang/$$trans ]; then \
		    files="$$files $(srcdir)/$$lang/$$trans"; \
		fi; \
	    done; \
	    $(MAKE) install-man \
	            mandir="$(mandir)/$$lang" \
		    man_MANS="" \
		    dist_man_MANS="$$files"; \
	done

uninstall-local: uninstall-local-@USE_PO4A@

uninstall-local-no:
uninstall-local-yes:
	for lang in $(LINGUAS); do \
		files=""; \
		for trans in $(notdir $(dist_man_MANS)); do \
			if [ -f $(CURDIR)/$$lang/$$trans ]; then \
				files="$$files $(CURDIR)/$$lang/$$trans"; \
			elif [ -f $(srcdir)/$$lang/$$trans ]; then \
				files="$$files $(srcdir)/$$lang/$$trans"; \
			fi; \
		done; \
		$(MAKE) uninstall-man \
			mandir="$(mandir)/$$lang" \
			man_MANS="" \
			dist_man_MANS="$$files"; \
	done

dist-hook: man.stamp
	cp $(srcdir)/man.stamp $(distdir)/
	for lang in $(LINGUAS_DIST); do \
		cp $(srcdir)/$$lang.po $(distdir); \
		cp $(srcdir)/$$lang.add $(distdir); \
		$(MKDIR_P) $(distdir)/$$lang; \
		cp -r $(srcdir)/$$lang $(distdir)/; \
	done