]> git.saurik.com Git - apt-legacy.git/blame - po/makefile
Drastic, sweeping modifications to support iPhone 1.2.0/2.0.
[apt-legacy.git] / po / makefile
CommitLineData
da6ee469
JF
1# -*- make -*-
2
3# This will compile the gettext message catalogues.
4
5# The other make files drop file lists in build/po/domains/DOMAIN/* which
6# is then picked up by this make file to define all the domains and all the
7# source files that compose each domain. It then produces the POT files
8# and then filters the PO files through the per-domain POT file to create
9# the input to msgformat, which is then dumped into a locale directory.
10
11BASE=..
12SUBDIR=po
13
14# Bring in the default rules
15include ../buildlib/defaults.mak
16
17CATALOGS := $(addsuffix .gmo,$(shell cat LINGUAS))
18DOMAINS := $(notdir $(wildcard $(PO_DOMAINS)/*))
19POTFILES := $(addsuffix .pot,$(addprefix $(PO)/,$(DOMAINS)))
20
21# Construct a list of all mo files for all domains under $(PO_DOMAINS)
22MOFILES := $(patsubst %.gmo,%.mo,$(CATALOGS))
23MOFILES := $(foreach D,$(DOMAINS),$(addprefix $(PO_DOMAINS)/$(D)/,$(MOFILES)))
24LANG_POFILES := $(patsubst %.mo,%.po,$(MOFILES))
25LINGUAS := $(patsubst %.gmo,%,$(CATALOGS))
26
27GETDOMAIN = $(word 1,$(subst /, ,$(1)))
28
29# Generate the list of files from the bits the other make files dropped
30# and produce the .pot file.
31$(POTFILES) : $(PO)/%.pot :
32 printf "%s " "Generating POT file $@"
33 echo $@ : $(wildcard $(PO)/domains/$*/*.*list) $(addprefix $(BASE)/,$(shell cat $(wildcard $(PO)/domains/$*/*.srclist))) > $@.d
34# From sh source
35 cat $(PO)/domains/$*/*.shlist 2> /dev/null | (cd $(BASE) && xargs -n1 bash --dump-po-strings) > $(PO)/domains/$*/sh.pot
36# From C/C++ source
37 cat $(PO)/domains/$*/*.srclist > $(PO)/POTFILES_$*.in
38 $(XGETTEXT) --default-domain=$* --directory=$(BASE) \
39 --add-comments --foreign --keyword=_ --keyword=N_ \
40 --files-from=$(PO)/POTFILES_$*.in -o $(PO)/domains/$*/c.pot
41 rm -f $(PO)/POTFILES_$*.in
42 $(MSGCOMM) --more-than=0 $(PO)/domains/$*/c.pot $(PO)/domains/$*/sh.pot --output=$@
43
44$(PACKAGE)-all.pot: $(POTFILES)
45 $(MSGCOMM) --more-than=0 $(POTFILES) --output=$@
46
47# Filter the complete translation with the domain specific file to produce
48# only the subtext needed for this domain
49# We cannot express the dependencies required for this directly with a pattern
50# rule, so we use the .d hack.
51$(LANG_POFILES) : $(PO_DOMAINS)/%.po : $(PACKAGE)-all.pot
52 printf "%s " "Generating $@"
53 echo $@ : $(notdir $@) $(PO)/$(call GETDOMAIN,$*).pot > $(PO)/$(call GETDOMAIN,$*)_$(notdir $@).d
54 $(MSGMERGE) $(notdir $@) $(PO)/$(call GETDOMAIN,$*).pot -o $@
55
56$(MOFILES) : $(PO_DOMAINS)/%.mo : $(PO_DOMAINS)/%.po
57 printf "%s: " "Generating $(LOCALE)/$(notdir $*)/LC_MESSAGES/$(call GETDOMAIN,$*).mo"
58 $(GMSGFMT) --statistics -o $@ $<
59 mkdir -p $(LOCALE)/$(notdir $*)/LC_MESSAGES/
60 cp $@ $(LOCALE)/$(notdir $*)/LC_MESSAGES/$(call GETDOMAIN,$*).mo
61
62stats:
63 for i in *.pot *.po; do echo -n "$$i: "; msgfmt --statistics $$i; done
64
65binary: $(POTFILES) $(PACKAGE)-all.pot $(MOFILES)
66
67.PHONY: update-po
68update-po: $(PACKAGE)-all.pot
69 for lang in ${LINGUAS}; do \
70 echo "Updating $$lang.po"; \
71 $(MSGMERGE) $$lang.po $(PACKAGE)-all.pot -o $$lang.new.po; \
72 cmp $$lang.new.po $$lang.po || cp $$lang.new.po $$lang.po; \
73 rm -f $$lang.new.po; \
74 done
75
76clean: clean/local
77clean/local: update-po
78 rm -f $(MOFILES) $(LANG_POFILES) $(PO)/*.d
79
80# Include the dependencies that are available
81The_DFiles = $(wildcard $(PO)/*.d)
82ifneq ($(words $(The_DFiles)),0)
83include $(The_DFiles)
84endif
85
86.NOTPARALLEL: