source: trunk/packages/xen-3.1/xen-3.1/tools/python/Makefile @ 34

Last change on this file since 34 was 34, checked in by hartmans, 18 years ago

Add xen and xen-common

File size: 2.6 KB
Line 
1XEN_ROOT = ../..
2include $(XEN_ROOT)/tools/Rules.mk
3
4.PHONY: all
5all: build
6
7# For each new supported translation, add its name here, eg 'fr_FR'
8# to cause the .po file to be built & installed, eg
9LINGUAS :=
10POPACKAGE := xen-xm
11PODIR := xen/xm/messages
12POTFILE := $(PODIR)/xen-xm.pot
13I18NSRCFILES = $(shell find xen/xm/ -name '*.py')
14CATALOGS = $(patsubst %,xen/xm/messages/%.mo,$(LINGUAS))
15NLSDIR = /usr/share/locale
16
17.PHONY: build buildpy
18buildpy:
19        CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py build
20
21build: buildpy refresh-pot refresh-po $(CATALOGS)
22
23# NB we take care to only update the .pot file it strings have
24# actually changed. This is complicated by the embedded date
25# string, hence the sed black magic. This avoids the expensive
26# re-generation of .po files on every single build
27refresh-pot: $(I18NSRCFILES)
28        xgettext --default-domain=$(POPACAKGE) \
29                --keyword=N_ \
30                --keyword=_ \
31                -o $(POTFILE)-tmp \
32                $(I18NSRCFILES)
33        sed -f remove-potcdate.sed < $(POTFILE) > $(POTFILE)-1
34        sed -f remove-potcdate.sed < $(POTFILE)-tmp > $(POTFILE)-2
35        if cmp -s $(POTFILE)-1 $(POTFILE)-2; then \
36                rm -f $(POTFILE)-tmp $(POTFILE)-1 $(POTFILE)-2; \
37        else \
38                mv $(POTFILE)-tmp $(POTFILE); \
39                rm -f $(POTFILE)-1 $(POTFILE)-2; \
40        fi
41
42refresh-po: $(POTFILE)
43        for l in $(LINGUAS); do \
44                if $(MSGMERGE) $(PODIR)/$$l.po $(POTFILE) > $(PODIR)/$$l-tmp ; then \
45                        mv -f $(PODIR)/$$l-tmp $(PODIR)/$$l.po ; \
46                        echo "$(MSGMERGE) of $$l.po succeeded" ; \
47                else \
48                        echo "$(MSGMERGE) of $$l.po failed" ; \
49                        rm -f $(PODIR)/$$l-tmp ; \
50                fi \
51        done
52
53%.mo: %.po
54        $(MSGFMT) -c -o $@ $<
55
56.PHONY: install
57ifndef XEN_PYTHON_NATIVE_INSTALL
58install: LIBPATH=$(shell PYTHONPATH=xen/util python -c "import auxbin; print auxbin.libpath()")
59install: install-messages install-dtd
60        CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py install --home="$(DESTDIR)/usr" --prefix="" --force --install-lib="$(DESTDIR)$(LIBPATH)/python"
61else
62install: install-messages install-dtd
63        CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py install --root="$(DESTDIR)" --force
64endif
65
66install-dtd: all
67        $(INSTALL_DIR) $(DESTDIR)/usr/share/xen
68        $(INSTALL_DATA) xen/xm/create.dtd $(DESTDIR)/usr/share/xen
69
70install-messages: all
71        if which $(MSGFMT) >/dev/null ; then \
72                mkdir -p $(DESTDIR)$(NLSDIR); \
73                for l in $(LINGUAS); do \
74                        $(INSTALL_DIR) $(DESTDIR)$(NLSDIR)/$$l; \
75                        $(INSTALL_DIR) $(DESTDIR)$(NLSDIR)/$$l/LC_MESSAGES; \
76                        $(INSTALL_DATA) $(PODIR)/$$l.mo \
77                                $(DESTDIR)$(NLSDIR)/$$l/LC_MESSAGES/$(POPACKAGE).mo; \
78                done ; \
79        fi
80
81.PHONY: test
82test:
83        export LD_LIBRARY_PATH=$$(readlink -f ../libxc):$$(readlink -f ../xenstore); python test.py -b -u
84
85.PHONY: clean
86clean:
87        rm -rf build *.pyc *.pyo *.o *.a *~ $(CATALOGS)
Note: See TracBrowser for help on using the repository browser.