ia64/xen-unstable

view tools/python/Makefile @ 19813:b55070edb185

tools: don't require hardcoded firmware path in guest config file

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