1 #-------------------------------------------------------------------------------
3 # Basic LINGUAS environment variable support
5 ALL_LINGUAS := $(basename $(wildcard *.po))
8 LINGUAS := $(filter $(ALL_LINGUAS), $(LINGUAS))
10 LINGUAS := $(ALL_LINGUAS)
13 #-------------------------------------------------------------------------------
18 LOCALEDIR := $(ROOT)/locale
19 POFILES := $(LINGUAS:%=%.po)
20 MOFILES := $(LINGUAS:%=$(LOCALEDIR)/%/LC_MESSAGES/$(DOMAIN).mo)
22 $(wildcard $(ROOT)/ball/*.[ch]) \
23 $(wildcard $(ROOT)/share/*.[ch]) \
24 $(wildcard $(ROOT)/putt/*.[ch])
26 COPYRIGHT := Robert Kooima
27 BUGADDR := robert.kooima@gmail.com
31 --add-comments=TRANSLATORS --from-code=UTF-8 \
32 --keyword=_ --keyword=N_ --keyword=L_ \
34 --default-domain="$(DOMAIN)" \
35 --copyright-holder="$(COPYRIGHT)" \
36 --msgid-bugs-address="$(BUGADDR)"
38 #------------------------------------------------------------------------------
45 #------------------------------------------------------------------------------
47 # Here it gets somewhat convoluted. Basic idea is: we want the
48 # update-po target which is widely supported in autotools-based
49 # internationalised packages. update-po unconditionally updates the POT
50 # file, and thus forces PO and MO files to be updated as well. The
51 # logic is loosely based on Makefile.in.in distributed with GNU gettext.
53 update-po: $(DOMAIN).pot-update $(POFILES) $(MOFILES)
55 $(LOCALEDIR)/%/LC_MESSAGES/$(DOMAIN).mo: %.po
57 msgfmt -c --statistics -o $@ $<
63 $(DOMAIN).pot $(DOMAIN).pot-update:
64 $(XGETTEXT) $(XGETTEXT_FLAGS) -o $(DOMAIN).pot \
65 --directory="$(ROOT)" $(SOURCES:$(ROOT)/%=%)
67 # Force encoding to UTF-8
68 sed "1,/^$$/ s/CHARSET/UTF-8/" < $(DOMAIN).pot > $(DOMAIN).pot.utf8
69 mv -f $(DOMAIN).pot.utf8 $(DOMAIN).pot
71 sh $(ROOT)/scripts/extractpo.sh $(ROOT) >> $(DOMAIN).pot
72 msguniq -o $(DOMAIN).pot.uniq $(DOMAIN).pot
73 mv -f $(DOMAIN).pot.uniq $(DOMAIN).pot
75 #------------------------------------------------------------------------------
78 @find -name '*.po' | sort | xargs -n1 -I{} \
79 sh -c 'printf "{}: "; msgfmt -o /dev/null --statistics {}'
81 #------------------------------------------------------------------------------