##// END OF EJS Templates
enhance Makefile for language translators...
Tobias Bell -
r7893:606723f4 default
parent child Browse files
Show More
@@ -1,95 +1,101
1 1 PREFIX=/usr/local
2 2 export PREFIX
3 3 PYTHON=python
4 4 PURE=
5 PYTHON_FILES:=$(shell find mercurial hgext doc -name '*.py')
5 6
6 7 help:
7 8 @echo 'Commonly used make targets:'
8 9 @echo ' all - build program and documentation'
9 10 @echo ' install - install program and man pages to PREFIX ($(PREFIX))'
10 11 @echo ' install-home - install with setup.py install --home=HOME ($(HOME))'
11 12 @echo ' local - build for inplace usage'
12 13 @echo ' tests - run all tests in the automatic test suite'
13 14 @echo ' test-foo - run only specified tests (e.g. test-merge1)'
14 15 @echo ' dist - run all tests and create a source tarball in dist/'
15 16 @echo ' clean - remove files created by other targets'
16 17 @echo ' (except installed files or dist source tarball)'
17 18 @echo ' update-pot - update i18n/hg.pot'
18 19 @echo
19 20 @echo 'Example for a system-wide installation under /usr/local:'
20 21 @echo ' make all && su -c "make install" && hg version'
21 22 @echo
22 23 @echo 'Example for a local installation (usable in this directory):'
23 24 @echo ' make local && ./hg version'
24 25
25 26 all: build doc
26 27
27 28 local:
28 29 $(PYTHON) setup.py $(PURE) build_py -c -d . build_ext -i build_mo
29 30 $(PYTHON) hg version
30 31
31 32 build:
32 33 $(PYTHON) setup.py $(PURE) build
33 34
34 35 doc:
35 36 $(MAKE) -C doc
36 37
37 38 clean:
38 39 -$(PYTHON) setup.py clean --all # ignore errors of this command
39 40 find . -name '*.py[cdo]' -exec rm -f '{}' ';'
40 41 rm -f MANIFEST mercurial/__version__.py mercurial/*.so tests/*.err
41 42 rm -rf locale
42 43 $(MAKE) -C doc clean
43 44
44 45 install: install-bin install-doc
45 46
46 47 install-bin: build
47 48 $(PYTHON) setup.py $(PURE) install --prefix="$(PREFIX)" --force
48 49
49 50 install-doc: doc
50 51 cd doc && $(MAKE) $(MFLAGS) install
51 52
52 53 install-home: install-home-bin install-home-doc
53 54
54 55 install-home-bin: build
55 56 $(PYTHON) setup.py $(PURE) install --home="$(HOME)" --force
56 57
57 58 install-home-doc: doc
58 59 cd doc && $(MAKE) $(MFLAGS) PREFIX="$(HOME)" install
59 60
60 61 MANIFEST-doc:
61 62 $(MAKE) -C doc MANIFEST
62 63
63 64 MANIFEST: MANIFEST-doc
64 65 hg manifest > MANIFEST
65 66 echo mercurial/__version__.py >> MANIFEST
66 67 cat doc/MANIFEST >> MANIFEST
67 68
68 69 dist: tests dist-notests
69 70
70 71 dist-notests: doc MANIFEST
71 72 TAR_OPTIONS="--owner=root --group=root --mode=u+w,go-w,a+rX-s" $(PYTHON) setup.py -q sdist
72 73
73 74 tests:
74 75 cd tests && $(PYTHON) run-tests.py $(TESTFLAGS)
75 76
76 77 test-%:
77 78 cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) $@
78 79
79 update-pot:
80 update-pot: i18n/hg.pot
81
82 i18n/hg.pot: $(PYTHON_FILES)
80 83 mkdir -p i18n
81 84 pygettext -d hg -p i18n --docstrings \
82 85 mercurial/commands.py hgext/*.py hgext/*/__init__.py
83 86 # All strings marked for translation in Mercurial contain
84 87 # ASCII characters only. But some files contain string
85 88 # literals like this '\037\213'. xgettext thinks it has to
86 89 # parse these them even though they are not marked for
87 90 # translation. Extracting with an explicit encoding of
88 91 # ISO-8859-1 will make xgettext "parse" and ignore them.
89 find mercurial hgext doc -name '*.py' | xargs \
92 echo $^ | xargs \
90 93 xgettext --from-code ISO-8859-1 --join --sort-by-file \
91 94 -d hg -p i18n -o hg.pot
92 95
96 %.po: i18n/hg.pot
97 msgmerge --no-location --update $@ $^
98
93 99 .PHONY: help all local build doc clean install install-bin install-doc \
94 100 install-home install-home-bin install-home-doc dist dist-notests tests \
95 101 update-pot
General Comments 0
You need to be logged in to leave comments. Login now