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