]> git.proxmox.com Git - qemu.git/blob - po/Makefile
po/Makefile: Fix generation of messages.po
[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
9 PO_PATH=$(SRC_PATH)/po
10
11 VERSION=$(shell cat $(SRC_PATH)/VERSION)
12 SRCS=$(filter-out $(PO_PATH)/messages.po,$(wildcard $(PO_PATH)/*.po))
13 OBJS=$(patsubst $(PO_PATH)/%.po,%.mo,$(SRCS))
14
15 vpath %.po $(PO_PATH)
16
17 all:
18 @echo "Use 'make update' to update translation files or use 'make build'"
19 @echo "or 'make install' to build and install the translation files."
20
21 update: $(SRCS)
22
23 build: $(OBJS)
24
25 clean:
26 $(RM) $(OBJS)
27
28 install: $(OBJS)
29 for obj in $(OBJS); do \
30 base=`basename $$obj .mo`; \
31 $(INSTALL) -d $(DESTDIR)$(prefix)/share/locale/$$base/LC_MESSAGES; \
32 $(INSTALL) -m644 $$obj $(DESTDIR)$(prefix)/share/locale/$$base/LC_MESSAGES/qemu.mo; \
33 done
34
35 %.mo: %.po
36 @msgfmt -o $@ $<
37
38 $(PO_PATH)/messages.po: $(SRC_PATH)/ui/gtk.c
39 @cd $(SRC_PATH) && \
40 (xgettext -o - --from-code=UTF-8 --foreign-user \
41 --package-name=QEMU --package-version=$(VERSION) \
42 --msgid-bugs-address=qemu-devel@nongnu.org -k_ -C ui/gtk.c | \
43 sed -e s/CHARSET/UTF-8/) >$@
44
45 $(PO_PATH)/%.po: $(PO_PATH)/messages.po
46 @msgmerge $@ $< > $@.bak && mv $@.bak $@
47
48 .PHONY: clean all