Support mcount/gprof test with GCC defaulting to PIE
[glibc.git] / po / Makefile
blob122db235912051cc8566c32383c4f8684a454dfa
1 # Copyright (C) 1996-2017 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
4 # The GNU C Library is free software; you can redistribute it and/or
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.
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
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with the GNU C Library; if not, see
16 # <http://www.gnu.org/licenses/>.
18 # Makefile for installing libc message catalogs.
20 subdir := po
22 include ../Makeconfig
24 # Add names of the languages with broken .po files here.
25 BROKEN_LINGUAS =
27 # List of languages for which we have message catalogs of translations.
28 ALL_LINGUAS := $(filter-out $(BROKEN_LINGUAS),$(basename $(wildcard *.po)))
30 # You can override this in configparms or the make command line to limit
31 # the languages which get installed.
32 ifdef LINGUAS
33 LINGUAS := $(filter $(addsuffix %,$(LINGUAS)),$(ALL_LINGUAS))
34 else
35 LINGUAS = $(ALL_LINGUAS)
36 endif
38 # Text domain name to install under; must match ../locale/SYS_libc.c string.
39 domainname = libc
41 # Pattern for where message catalog object for language % gets installed.
42 mo-installed = $(inst_localedir)/%/LC_MESSAGES/$(domainname).mo
44 # Files to install: a $(domainname).mo file for each language.
45 install-others = $(LINGUAS:%=$(mo-installed))
48 include ../Rules
50 # Generate the translation template from all the source files.
51 libc.pot: pot.header libc.pot.files
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`/" \
56 -e "s/CHARSET/UTF-8/" \
57 $< > $@.new
58 egrep -v '\.ksh$$' $(word 2,$^) > $(objdir)/tmp-libc.pot-files
59 cd ..; $(XGETTEXT) --keyword=_ --keyword=N_ \
60 --add-comments=TRANS --flag=error:3:c-format \
61 --flag=f_print:2:c-format \
62 --sort-by-file --omit-header -E -n -d - \
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
69 mv -f $@.new $@
71 po-sed-cmd = \
72 '/\/tst-/d;$(foreach S,[ch] cxx sh ksh bash,$(subst .,\.,/.$S\(.in\)*$$/p;))'
74 # Omit tst-* files, and get only files with the given suffixes.
75 libc.pot.files: FORCE
76 $(..)scripts/list-sources.sh .. | sed -n $(po-sed-cmd) > $@.new
77 mv -f $@.new $@
79 .SUFFIXES: .mo .po .pot
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 $@ $<
86 # Install the message object files as libc.po in the language directory.
87 $(mo-installed): %.mo $(+force); $(do-install) || exit 0
89 .PHONY: linguas linguas.mo
90 linguas: $(ALL_LINGUAS:=.po)
91 linguas.mo: $(ALL_LINGUAS:=.mo)
93 realclean:
94 rm -f $(ALL_LINGUAS:=.mo)
96 # Copy the PO files from the translation coordinator's repository.
98 podir = /com/share/ftp/gnu/po/maint/glibc
100 pofiles := $(wildcard $(podir)/*.po)
102 ifneq (,$(pofiles))
104 %.po: $(podir)/%.po
105 cp -f $< $@
106 chmod 444 $@
108 linguas: $(pofiles:$(podir)/%=%)
109 linguas.mo: $(pofiles:$(podir)/%.po=%.mo)
111 endif
113 # Update translations from the translation project.
114 TRANSLATIONS_URL = https://translationproject.org/latest/libc
115 WGET = wget
117 update-translations:
118 $(WGET) -qO- $(TRANSLATIONS_URL) | sed -n 's|.*href="\([^"]\+po\)".*|\1|p' | \
119 while read f; do \
120 $(WGET) -O $(objdir)/$$f-tmp $(TRANSLATIONS_URL)/$$f && \
121 mv -f $(objdir)/$$f-tmp $$f; \
122 done