ia64/xen-unstable

view tools/python/Makefile @ 19809:71c67be96ef6

tools: consistently use $(PYTHON)

Signed-off-by: Christoph Egger <Christoph. Egger@amd.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Jun 23 11:13:29 2009 +0100 (2009-06-23)
parents a3125a83e40b
children b55070edb185
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 = $(SHAREDIR)/locale
16 xenpath = "xen/util/path.py"
18 .PHONY: build buildpy genpath
19 genpath:
20 rm -f ${xenpath}
21 echo "SBINDIR=\"$(SBINDIR)\"" >> ${xenpath}
22 echo "BINDIR=\"$(BINDIR)\"" >> ${xenpath}
23 echo "LIBEXEC=\"$(LIBEXEC)\"" >> ${xenpath}
24 echo "LIBDIR=\"$(LIBDIR)\"" >> ${xenpath}
25 echo "SHAREDIR=\"$(SHAREDIR)\"" >> ${xenpath}
26 echo "PRIVATE_BINDIR=\"$(PRIVATE_BINDIR)\"" >> ${xenpath}
27 echo "XEN_CONFIG_DIR=\"$(XEN_CONFIG_DIR)\"" >> ${xenpath}
28 echo "XEN_SCRIPT_DIR=\"$(XEN_SCRIPT_DIR)\"" >> ${xenpath}
30 buildpy: genpath
31 CC="$(CC)" CFLAGS="$(CFLAGS)" $(PYTHON) setup.py build
33 build: buildpy refresh-pot refresh-po $(CATALOGS)
35 # NB we take care to only update the .pot file it strings have
36 # actually changed. This is complicated by the embedded date
37 # string, hence the sed black magic. This avoids the expensive
38 # re-generation of .po files on every single build
39 refresh-pot: $(I18NSRCFILES)
40 xgettext --default-domain=$(POPACKAGE) \
41 --keyword=N_ \
42 --keyword=_ \
43 -o $(POTFILE)-tmp \
44 $(I18NSRCFILES)
45 sed -f remove-potcdate.sed < $(POTFILE) > $(POTFILE)-1
46 sed -f remove-potcdate.sed < $(POTFILE)-tmp > $(POTFILE)-2
47 set -e; if cmp -s $(POTFILE)-1 $(POTFILE)-2; then \
48 rm -f $(POTFILE)-tmp $(POTFILE)-1 $(POTFILE)-2; \
49 else \
50 mv $(POTFILE)-tmp $(POTFILE); \
51 rm -f $(POTFILE)-1 $(POTFILE)-2; \
52 fi
54 refresh-po: $(POTFILE)
55 set -e; for l in $(LINGUAS); do \
56 if $(MSGMERGE) $(PODIR)/$$l.po $(POTFILE) > $(PODIR)/$$l-tmp ; then \
57 mv -f $(PODIR)/$$l-tmp $(PODIR)/$$l.po ; \
58 echo "$(MSGMERGE) of $$l.po succeeded" ; \
59 else \
60 echo "$(MSGMERGE) of $$l.po failed" ; \
61 rm -f $(PODIR)/$$l-tmp ; \
62 fi \
63 done
65 %.mo: %.po
66 $(MSGFMT) -c -o $@ $<
68 .PHONY: install
69 install: install-messages install-dtd
70 CC="$(CC)" CFLAGS="$(CFLAGS)" $(PYTHON) setup.py install \
71 $(PYTHON_PREFIX_ARG) --root="$(DESTDIR)" --force
73 install-dtd: all
74 $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR)
75 $(INSTALL_DATA) xen/xm/create.dtd $(DESTDIR)$(SHAREDIR)
77 install-messages: all
78 set -e; if which $(MSGFMT) >/dev/null ; then \
79 $(INSTALL_DIR) $(DESTDIR)$(NLSDIR); \
80 for l in $(LINGUAS); do \
81 $(INSTALL_DIR) $(DESTDIR)$(NLSDIR)/$$l; \
82 $(INSTALL_DIR) $(DESTDIR)$(NLSDIR)/$$l/LC_MESSAGES; \
83 $(INSTALL_DATA) $(PODIR)/$$l.mo \
84 $(DESTDIR)$(NLSDIR)/$$l/LC_MESSAGES/$(POPACKAGE).mo; \
85 done ; \
86 fi
88 .PHONY: test
89 test:
90 export LD_LIBRARY_PATH=$$(readlink -f ../libxc):$$(readlink -f ../xenstore); $(PYTHON) test.py -b -u
92 .PHONY: clean
93 clean:
94 rm -rf build *.pyc *.pyo *.o *.a *~ $(CATALOGS) xen/util/auxbin.pyc
95 rm -f $(DEPS)
97 -include $(DEPS)