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