Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
[qemu.git] / po / Makefile
1 # This makefile is very special as it's meant to build as part of the build
2 # process and also within the source tree to update the translation files.
3
4 # Set SRC_PATH for in-tree builds without configuration.
5 SRC_PATH=..
6
7 -include ../config-host.mak
8 include $(SRC_PATH)/rules.mak
9
10 PO_PATH=$(SRC_PATH)/po
11
12 VERSION=$(shell cat $(SRC_PATH)/VERSION)
13 SRCS=$(filter-out $(PO_PATH)/messages.po,$(wildcard $(PO_PATH)/*.po))
14 OBJS=$(patsubst $(PO_PATH)/%.po,%.mo,$(SRCS))
15
16 vpath %.po $(PO_PATH)
17
18 all:
19 @echo "Use 'make update' to update translation files or use 'make build'"
20 @echo "or 'make install' to build and install the translation files."
21
22 update: $(SRCS)
23
24 build: $(OBJS)
25
26 clean:
27 $(RM) $(OBJS)
28
29 install: $(OBJS)
30 for obj in $(OBJS); do \
31 base=`basename $$obj .mo`; \
32 $(INSTALL) -d $(DESTDIR)$(prefix)/share/locale/$$base/LC_MESSAGES; \
33 $(INSTALL) -m644 $$obj $(DESTDIR)$(prefix)/share/locale/$$base/LC_MESSAGES/qemu.mo; \
34 done
35
36 %.mo: %.po
37 $(call quiet-command, msgfmt -o $@ $<, " GEN $@")
38
39 $(PO_PATH)/messages.po: $(SRC_PATH)/ui/gtk.c
40 $(call quiet-command, cd $(SRC_PATH) && \
41 (xgettext -o - --from-code=UTF-8 --foreign-user \
42 --package-name=QEMU --package-version=$(VERSION) \
43 --msgid-bugs-address=qemu-devel@nongnu.org -k_ -C ui/gtk.c | \
44 sed -e s/CHARSET/UTF-8/) >$@, " GEN $@")
45
46 $(PO_PATH)/%.po: $(PO_PATH)/messages.po
47 $(call quiet-command, msgmerge -q $@ $< > $@.bak && mv $@.bak $@, " GEN $@")
48
49 .PHONY: clean all