Imported Upstream version 3.25.1
[platform/upstream/iso-codes.git] / rules.make
1
2 %.mo: %.po
3         $(MSGFMT) $(MSGFMT_FLAGS) -o $@ $<
4
5 .PHONY: check-content
6 check-content:
7         perl $(top_srcdir)/check_valid_utf8.pl $(pofiles)
8
9 # This target merges all po files with the current pot file,
10 # removes obsolete msgids and substitutes the Project-Id-Version
11 # header with the correct value
12 #
13 # NOTE:
14 # Removing obsolete msgids is not the recommended way to go.
15 # However, we've decided that in the specific case of iso-codes
16 # the benefit outweights the loss of information. Having only msgids
17 # with one (sometimes two or three) words, the fuzzy matching performed
18 # with obsolete msgids will not ease the translator's work, but
19 # will lead to confusing entries.
20 .PHONY: update-po
21 update-po:
22         for pofile in $(pofiles); do \
23                 $(MSGMERGE) $$pofile $(DOMAIN).pot > tmpfile; \
24                 msgattrib --no-obsolete tmpfile > $$pofile; \
25                 sed -i -e 's/^\"Project-Id-Version: iso.*/\"Project-Id-Version: $(DOMAIN)\\n\"/' $$pofile; \
26         done
27         $(RECODE_SR_LATIN) < sr.po > sr@latin.po
28         rm -f tmpfile
29
30 localedir = $(datadir)/locale
31
32 install-data-hook: $(mofiles)
33         $(mkinstalldirs) $(DESTDIR)$(datadir)
34         $(mkinstalldirs) $(DESTDIR)$(localedir)
35         catalogs='$(mofiles)'; \
36         for cat in $$catalogs; do \
37                 cat=`basename $$cat`; \
38                 lang=`echo $$cat | sed 's/\.mo$$//'`; \
39                 dir=$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES; \
40                 $(mkinstalldirs) $$dir; \
41                 $(INSTALL_DATA) $$cat $$dir/$(DOMAIN).mo; \
42         done
43
44 uninstall-hook:
45         catalogs='$(mofiles)'; \
46         for cat in $$catalogs; do \
47                 cat=`basename $$cat`; \
48                 lang=`echo $$cat | sed 's/\.mo$$//'`; \
49                 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo; \
50         done