Imported Upstream version 2.8.4
[platform/upstream/man-db.git] / man / po4a / Makefile.am
1 ## Process this file with automake to produce Makefile.in
2 ##
3 ## Copyright (C) 2008 Colin Watson.
4 ##
5 ## This file is part of man-db.
6 ##
7 ## man-db is free software; you can redistribute it and/or modify it
8 ## under the terms of the GNU General Public License as published by
9 ## the Free Software Foundation; either version 2 of the License, or
10 ## (at your option) any later version.
11 ##
12 ## man-db is distributed in the hope that it will be useful, but
13 ## WITHOUT ANY WARRANTY; without even the implied warranty of
14 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 ## GNU General Public License for more details.
16 ##
17 ## You should have received a copy of the GNU General Public License
18 ## along with man-db; if not, write to the Free Software Foundation,
19 ## Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20
21 DOMAIN = man-db-manpages
22 POFILES = \
23         po/da.po \
24         po/de.po \
25         po/es.po \
26         po/fr.po \
27         po/id.po \
28         po/ja.po \
29         po/nl.po \
30         po/pl.po \
31         po/pt_BR.po \
32         po/ru.po \
33         po/sr.po \
34         po/sv.po \
35         po/tr.po \
36         po/zh_CN.po
37
38 EXTRA_DIST = po4a.cfg Locale/Po4a/Manext.pm po/$(DOMAIN).pot $(POFILES)
39
40 if PO4A
41 PO4A_ENVIRONMENT = PERL5LIB=$(srcdir)
42 STAGING = $(builddir)/tmp-po
43
44 # Always generate output files even if poorly translated, since Automake's
45 # generated rules will get upset otherwise.
46 PO4A_ARGS = --variable srcdir=$(top_srcdir)/man \
47             --variable builddir=$(top_builddir)/man \
48             --variable podir=$(STAGING) \
49             --keep 0
50
51 RUN_PO4A = $(PO4A_ENVIRONMENT) $(PO4A) $(PO4A_ARGS)
52
53 all-local:
54         rm -rf $(STAGING)
55         $(MKDIR_P) $(STAGING)
56         set -e; for f in po/$(DOMAIN).pot $(POFILES); do \
57                 base=`basename $$f`; \
58                 cp -p $(srcdir)/$$f $(STAGING)/; \
59                 chmod u+w $(STAGING)/$$base; \
60         done
61         $(RUN_PO4A) $(srcdir)/po4a.cfg
62         rm -rf $(STAGING)
63
64 update-po-real:
65         @$(MAKE) -C $(top_builddir)/po remove-potcdate.sed
66         rm -rf $(STAGING)
67         $(MKDIR_P) $(STAGING)
68         set -e; for f in po/$(DOMAIN).pot $(POFILES); do \
69                 base=`basename $$f`; \
70                 cp -p $(srcdir)/$$f $(STAGING)/; \
71                 chmod u+w $(STAGING)/$$base; \
72         done
73         $(RUN_PO4A) --force --no-translations $(srcdir)/po4a.cfg
74         sed -f $(top_builddir)/po/remove-potcdate.sed \
75                 < $(srcdir)/po/$(DOMAIN).pot > $(STAGING)/$(DOMAIN).1po
76         sed -f $(top_builddir)/po/remove-potcdate.sed \
77                 < $(STAGING)/$(DOMAIN).pot > $(STAGING)/$(DOMAIN).2po
78         set -e; if ! cmp $(STAGING)/$(DOMAIN).1po $(STAGING)/$(DOMAIN).2po \
79                         >/dev/null 2>&1; then \
80                 for f in po/$(DOMAIN).pot $(POFILES); do \
81                         base=`basename $$f`; \
82                         mv -f $(STAGING)/$$base $(srcdir)/$$f; \
83                 done; \
84         fi
85         rm -rf $(STAGING)
86
87 update-po:
88         @set -e; if test $(srcdir) = $(builddir); then \
89                 $(MAKE) update-po-real; \
90         else \
91                 echo "update-po does not yet work with out-of-tree builds."; \
92         fi
93
94 po/man-db-manpages.pot:
95         $(MAKE) update-po
96
97 clean-local:
98         rm -rf $(STAGING)
99 endif