Imported Upstream version 2.7.6
[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/fr.po \
26         po/id.po \
27         po/ja.po \
28         po/nl.po \
29         po/pl.po \
30         po/ru.po \
31         po/sv.po \
32         po/zh_CN.po
33
34 EXTRA_DIST = po4a.cfg Locale/Po4a/Manext.pm po/$(DOMAIN).pot $(POFILES)
35
36 if PO4A
37 PO4A_ENVIRONMENT = PERL5LIB=$(srcdir)
38 STAGING = $(builddir)/tmp-po
39
40 # Always generate output files even if poorly translated, since Automake's
41 # generated rules will get upset otherwise.
42 PO4A_ARGS = --variable srcdir=$(top_srcdir)/man \
43             --variable builddir=$(top_builddir)/man \
44             --variable podir=$(STAGING) \
45             --keep 0
46
47 RUN_PO4A = $(PO4A_ENVIRONMENT) $(PO4A) $(PO4A_ARGS)
48
49 all-local:
50         rm -rf $(STAGING)
51         $(MKDIR_P) $(STAGING)
52         set -e; for f in po/$(DOMAIN).pot $(POFILES); do \
53                 base=`basename $$f`; \
54                 cp -p $(srcdir)/$$f $(STAGING)/; \
55                 chmod u+w $(STAGING)/$$base; \
56         done
57         $(RUN_PO4A) $(srcdir)/po4a.cfg
58         rm -rf $(STAGING)
59
60 update-po-real:
61         @$(MAKE) -C $(top_builddir)/po remove-potcdate.sed
62         rm -rf $(STAGING)
63         $(MKDIR_P) $(STAGING)
64         set -e; for f in po/$(DOMAIN).pot $(POFILES); do \
65                 base=`basename $$f`; \
66                 cp -p $(srcdir)/$$f $(STAGING)/; \
67                 chmod u+w $(STAGING)/$$base; \
68         done
69         $(RUN_PO4A) --force --no-translations $(srcdir)/po4a.cfg
70         sed -f $(top_builddir)/po/remove-potcdate.sed \
71                 < $(srcdir)/po/$(DOMAIN).pot > $(STAGING)/$(DOMAIN).1po
72         sed -f $(top_builddir)/po/remove-potcdate.sed \
73                 < $(STAGING)/$(DOMAIN).pot > $(STAGING)/$(DOMAIN).2po
74         set -e; if ! cmp $(STAGING)/$(DOMAIN).1po $(STAGING)/$(DOMAIN).2po \
75                         >/dev/null 2>&1; then \
76                 for f in po/$(DOMAIN).pot $(POFILES); do \
77                         base=`basename $$f`; \
78                         mv -f $(STAGING)/$$base $(srcdir)/$$f; \
79                 done; \
80         fi
81         rm -rf $(STAGING)
82
83 update-po:
84         @set -e; if test $(srcdir) = $(builddir); then \
85                 $(MAKE) update-po-real; \
86         else \
87                 echo "update-po does not yet work with out-of-tree builds."; \
88         fi
89
90 po/man-db-manpages.pot:
91         $(MAKE) update-po
92
93 clean-local:
94         rm -rf $(STAGING)
95 endif