ia64/xen-unstable

view tools/python/Makefile @ 14873:7b391c27f410

tools: Use INSTALL_{DIR,DATA} to install stuff.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Tue Apr 17 12:21:33 2007 +0100 (2007-04-17)
parents 046fd974b4dc
children 993655d24b55
line source
1 XEN_ROOT = ../..
2 include $(XEN_ROOT)/tools/Rules.mk
4 .PHONY: all
5 all: build
7 # For each new supported translation, add its name here, eg 'fr_FR'
8 # to cause the .po file to be built & installed, eg
9 LINGUAS :=
10 POPACKAGE := xen-xm
11 PODIR := xen/xm/messages
12 POTFILE := $(PODIR)/xen-xm.pot
13 I18NSRCFILES = $(shell find xen/xm/ -name '*.py')
14 CATALOGS = $(patsubst %,xen/xm/messages/%.mo,$(LINGUAS))
15 NLSDIR = /usr/share/locale
17 .PHONY: build buildpy
18 buildpy:
19 CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py build
21 build: buildpy refresh-pot refresh-po $(CATALOGS)
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
27 refresh-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
42 refresh-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
53 %.mo: %.po
54 $(MSGFMT) -c -o $@ $<
56 .PHONY: install
57 ifndef XEN_PYTHON_NATIVE_INSTALL
58 install: LIBPATH=$(shell PYTHONPATH=xen/util python -c "import auxbin; print auxbin.libpath()")
59 install: install-messages install-dtd
60 CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py install --home="$(DESTDIR)/usr" --prefix="" --force --install-lib="$(DESTDIR)$(LIBPATH)/python"
61 else
62 install: install-messages install-dtd
63 CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py install --root="$(DESTDIR)" --force
64 endif
66 install-dtd: all
67 $(INSTALL_DIR) $(DESTDIR)/usr/share/xen
68 $(INSTALL_DATA) xen/xm/create.dtd $(DESTDIR)/usr/share/xen
70 install-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
81 .PHONY: test
82 test:
83 export LD_LIBRARY_PATH=$$(readlink -f ../libxc):$$(readlink -f ../xenstore); python test.py -b -u
85 .PHONY: clean
86 clean:
87 rm -rf build *.pyc *.pyo *.o *.a *~ $(CATALOGS)