]> git.ipfire.org Git - thirdparty/glibc.git/blame - po/Makefile
glibc 2.21 pre-release update.
[thirdparty/glibc.git] / po / Makefile
CommitLineData
b168057a 1# Copyright (C) 1996-2015 Free Software Foundation, Inc.
ce4d8b66
RM
2# This file is part of the GNU C Library.
3
4# The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
5# modify it under the terms of the GNU Lesser General Public
6# License as published by the Free Software Foundation; either
7# version 2.1 of the License, or (at your option) any later version.
ce4d8b66
RM
8
9# The GNU C Library is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41bdb6e2 12# Lesser General Public License for more details.
ce4d8b66 13
41bdb6e2 14# You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
15# License along with the GNU C Library; if not, see
16# <http://www.gnu.org/licenses/>.
0c5ecdc4
UD
17
18# Makefile for installing libc message catalogs.
ce4d8b66
RM
19
20subdir := po
21
a5f891ac
JM
22include ../Makeconfig
23
bf1097cb 24# Add names of the languages with broken .po files here.
9de06f3c 25BROKEN_LINGUAS =
c5196097 26
ce4d8b66 27# List of languages for which we have message catalogs of translations.
c5196097 28ALL_LINGUAS := $(filter-out $(BROKEN_LINGUAS),$(basename $(wildcard *.po)))
ce4d8b66
RM
29
30# You can override this in configparms or the make command line to limit
31# the languages which get installed.
32ifdef LINGUAS
33LINGUAS := $(filter $(addsuffix %,$(LINGUAS)),$(ALL_LINGUAS))
34else
35LINGUAS = $(ALL_LINGUAS)
36endif
37
38# Text domain name to install under; must match ../locale/SYS_libc.c string.
8ca5c11b 39domainname = libc
ce4d8b66 40
ce4d8b66 41# Pattern for where message catalog object for language % gets installed.
4a33c2f5 42mo-installed = $(inst_msgcatdir)/%/LC_MESSAGES/$(domainname).mo
ce4d8b66
RM
43
44# Files to install: a $(domainname).mo file for each language.
45install-others = $(LINGUAS:%=$(mo-installed))
46
ce4d8b66 47
c17097f1 48include ../Rules
ce4d8b66 49
9de06f3c 50# Generate the translation template from all the source files.
cd6701cf 51libc.pot: pot.header libc.pot.files
9de06f3c
RM
52 @rm -f $@.new
53 set `date -R`; disp="$$6"; \
54 sed -e 's/VERSION/$(version)/' \
55 -e "s/DATE/`date +'%Y-%m-%d %H:%M'$$disp`/" \
771766df 56 -e "s/CHARSET/UTF-8/" \
9de06f3c 57 $< > $@.new
41fce8bd 58 egrep -v '\.ksh$$' $(word 2,$^) > $(objdir)/tmp-libc.pot-files
9de06f3c
RM
59 cd ..; $(XGETTEXT) --keyword=_ --keyword=N_ \
60 --add-comments=TRANS --flag=error:3:c-format \
51f8846e 61 --flag=f_print:2:c-format \
9de06f3c 62 --sort-by-file --omit-header -E -n -d - \
41fce8bd
UD
63 -f $(objdir)/tmp-libc.pot-files >> po/$@.new
64 egrep '\.ksh$$' $(word 2,$^) > $(objdir)/tmp-libc.pot-files
65 cd ..; $(XGETTEXT) --add-comments=TRANS --language=Shell \
66 --sort-by-file --omit-header -E -n -o po/$@.new -j \
67 -f $(objdir)/tmp-libc.pot-files po/$@.new
68 rm $(objdir)/tmp-libc.pot-files
9de06f3c 69 mv -f $@.new $@
9de06f3c 70
977e7f71 71po-sed-cmd = \
41fce8bd 72 '/\/tst-/d;$(foreach S,[ch] cxx sh ksh bash,$(subst .,\.,/.$S\(.in\)*$$/p;))'
977e7f71 73
9de06f3c
RM
74# Omit tst-* files, and get only files with the given suffixes.
75libc.pot.files: FORCE
977e7f71 76 $(..)scripts/list-sources.sh .. | sed -n $(po-sed-cmd) > $@.new
9de06f3c 77 mv -f $@.new $@
ce4d8b66
RM
78
79.SUFFIXES: .mo .po .pot
80
81# Compile the binary message object files from the portable object source
82# files of translations for each language.
83%.mo: %.po
84 $(MSGFMT) -o $@ $<
85
8ca5c11b 86# Install the message object files as libc.po in the language directory.
73237de3 87$(mo-installed): %.mo $(+force); $(do-install) || exit 0
ce4d8b66
RM
88
89.PHONY: linguas linguas.mo
90linguas: $(ALL_LINGUAS:=.po)
91linguas.mo: $(ALL_LINGUAS:=.mo)
9a0a462c
UD
92
93realclean:
94 rm -f $(ALL_LINGUAS:=.mo)
ce4d8b66
RM
95\f
96# Copy the PO files from the translation coordinator's repository.
97
98podir = /com/share/ftp/gnu/po/maint/glibc
99
100pofiles := $(wildcard $(podir)/*.po)
101
102ifneq (,$(pofiles))
103
104%.po: $(podir)/%.po
105 cp -f $< $@
106 chmod 444 $@
107
108linguas: $(pofiles:$(podir)/%=%)
ce4d8b66 109linguas.mo: $(pofiles:$(podir)/%.po=%.mo)
ce4d8b66
RM
110
111endif