debuggers.hg

view tools/python/Makefile @ 0:7d21f7218375

Exact replica of unstable on 051908 + README-this
author Mukesh Rathor
date Mon May 19 15:34:57 2008 -0700 (2008-05-19)
parents
children f875aaa791f0
line source
1 XEN_ROOT = ../..
2 include $(XEN_ROOT)/tools/Rules.mk
4 XEN_SECURITY_MODULE = dummy
5 ifeq ($(FLASK_ENABLE),y)
6 XEN_SECURITY_MODULE = flask
7 endif
8 ifeq ($(ACM_SECURITY),y)
9 XEN_SECURITY_MODULE = acm
10 endif
12 .PHONY: all
13 all: build
15 # For each new supported translation, add its name here, eg 'fr_FR'
16 # to cause the .po file to be built & installed, eg
17 LINGUAS :=
18 POPACKAGE := xen-xm
19 PODIR := xen/xm/messages
20 POTFILE := $(PODIR)/xen-xm.pot
21 I18NSRCFILES = $(shell find xen/xm/ -name '*.py')
22 CATALOGS = $(patsubst %,xen/xm/messages/%.mo,$(LINGUAS))
23 NLSDIR = /usr/share/locale
25 .PHONY: build buildpy
26 buildpy: xsm.py
27 CC="$(CC)" CFLAGS="$(CFLAGS)" XEN_SECURITY_MODULE="$(XEN_SECURITY_MODULE)" python setup.py build
29 build: buildpy refresh-pot refresh-po $(CATALOGS)
31 # NB we take care to only update the .pot file it strings have
32 # actually changed. This is complicated by the embedded date
33 # string, hence the sed black magic. This avoids the expensive
34 # re-generation of .po files on every single build
35 refresh-pot: $(I18NSRCFILES)
36 xgettext --default-domain=$(POPACAKGE) \
37 --keyword=N_ \
38 --keyword=_ \
39 -o $(POTFILE)-tmp \
40 $(I18NSRCFILES)
41 sed -f remove-potcdate.sed < $(POTFILE) > $(POTFILE)-1
42 sed -f remove-potcdate.sed < $(POTFILE)-tmp > $(POTFILE)-2
43 set -e; if cmp -s $(POTFILE)-1 $(POTFILE)-2; then \
44 rm -f $(POTFILE)-tmp $(POTFILE)-1 $(POTFILE)-2; \
45 else \
46 mv $(POTFILE)-tmp $(POTFILE); \
47 rm -f $(POTFILE)-1 $(POTFILE)-2; \
48 fi
50 refresh-po: $(POTFILE)
51 set -e; for l in $(LINGUAS); do \
52 if $(MSGMERGE) $(PODIR)/$$l.po $(POTFILE) > $(PODIR)/$$l-tmp ; then \
53 mv -f $(PODIR)/$$l-tmp $(PODIR)/$$l.po ; \
54 echo "$(MSGMERGE) of $$l.po succeeded" ; \
55 else \
56 echo "$(MSGMERGE) of $$l.po failed" ; \
57 rm -f $(PODIR)/$$l-tmp ; \
58 fi \
59 done
61 %.mo: %.po
62 $(MSGFMT) -c -o $@ $<
64 xsm.py:
65 @(set -e; \
66 echo "XEN_SECURITY_MODULE = \""$(XEN_SECURITY_MODULE)"\""; \
67 echo "from xsm_core import *"; \
68 echo ""; \
69 echo "import xen.util.xsm."$(XEN_SECURITY_MODULE)"."$(XEN_SECURITY_MODULE)" as xsm_module"; \
70 echo ""; \
71 echo "xsm_init(xsm_module)"; \
72 echo "from xen.util.xsm."$(XEN_SECURITY_MODULE)"."$(XEN_SECURITY_MODULE)" import *"; \
73 echo "del xsm_module"; \
74 echo "") >xen/util/xsm/$@
76 .PHONY: install
77 ifndef XEN_PYTHON_NATIVE_INSTALL
78 install: LIBPATH=$(shell PYTHONPATH=xen/util python -c "import auxbin; print auxbin.libpath()")
79 install: install-messages install-dtd
80 CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py install --home="$(DESTDIR)/usr" --prefix="" --force --install-lib="$(DESTDIR)$(LIBPATH)/python"
81 else
82 install: install-messages install-dtd
83 CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py install --root="$(DESTDIR)" --force
84 endif
86 install-dtd: all
87 $(INSTALL_DIR) $(DESTDIR)/usr/share/xen
88 $(INSTALL_DATA) xen/xm/create.dtd $(DESTDIR)/usr/share/xen
90 install-messages: all
91 set -e; if which $(MSGFMT) >/dev/null ; then \
92 mkdir -p $(DESTDIR)$(NLSDIR); \
93 for l in $(LINGUAS); do \
94 $(INSTALL_DIR) $(DESTDIR)$(NLSDIR)/$$l; \
95 $(INSTALL_DIR) $(DESTDIR)$(NLSDIR)/$$l/LC_MESSAGES; \
96 $(INSTALL_DATA) $(PODIR)/$$l.mo \
97 $(DESTDIR)$(NLSDIR)/$$l/LC_MESSAGES/$(POPACKAGE).mo; \
98 done ; \
99 fi
101 .PHONY: test
102 test:
103 export LD_LIBRARY_PATH=$$(readlink -f ../libxc):$$(readlink -f ../xenstore); python test.py -b -u
105 .PHONY: clean
106 clean:
107 rm -rf build *.pyc *.pyo *.o *.a *~ $(CATALOGS) xen/util/xsm/xsm.py xen/util/auxbin.pyc