##// END OF EJS Templates
makefile: don't use system hgrc when running hg in-place...
Bryan O'Sullivan -
r17927:9796d543 default
parent child Browse files
Show More
@@ -1,118 +1,118
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 PYFILES:=$(shell find mercurial hgext doc -name '*.py')
11 PYFILES:=$(shell find mercurial hgext doc -name '*.py')
12 DOCFILES=mercurial/help/*.txt
12 DOCFILES=mercurial/help/*.txt
13
13
14 help:
14 help:
15 @echo 'Commonly used make targets:'
15 @echo 'Commonly used make targets:'
16 @echo ' all - build program and documentation'
16 @echo ' all - build program and documentation'
17 @echo ' install - install program and man pages to PREFIX ($(PREFIX))'
17 @echo ' install - install program and man pages to PREFIX ($(PREFIX))'
18 @echo ' install-home - install with setup.py install --home=HOME ($(HOME))'
18 @echo ' install-home - install with setup.py install --home=HOME ($(HOME))'
19 @echo ' local - build for inplace usage'
19 @echo ' local - build for inplace usage'
20 @echo ' tests - run all tests in the automatic test suite'
20 @echo ' tests - run all tests in the automatic test suite'
21 @echo ' test-foo - run only specified tests (e.g. test-merge1.t)'
21 @echo ' test-foo - run only specified tests (e.g. test-merge1.t)'
22 @echo ' dist - run all tests and create a source tarball in dist/'
22 @echo ' dist - run all tests and create a source tarball in dist/'
23 @echo ' clean - remove files created by other targets'
23 @echo ' clean - remove files created by other targets'
24 @echo ' (except installed files or dist source tarball)'
24 @echo ' (except installed files or dist source tarball)'
25 @echo ' update-pot - update i18n/hg.pot'
25 @echo ' update-pot - update i18n/hg.pot'
26 @echo
26 @echo
27 @echo 'Example for a system-wide installation under /usr/local:'
27 @echo 'Example for a system-wide installation under /usr/local:'
28 @echo ' make all && su -c "make install" && hg version'
28 @echo ' make all && su -c "make install" && hg version'
29 @echo
29 @echo
30 @echo 'Example for a local installation (usable in this directory):'
30 @echo 'Example for a local installation (usable in this directory):'
31 @echo ' make local && ./hg version'
31 @echo ' make local && ./hg version'
32
32
33 all: build doc
33 all: build doc
34
34
35 local:
35 local:
36 $(PYTHON) setup.py $(PURE) build_py -c -d . build_ext -i build_hgexe -i build_mo
36 $(PYTHON) setup.py $(PURE) build_py -c -d . build_ext -i build_hgexe -i build_mo
37 $(PYTHON) hg version
37 env HGRCPATH= $(PYTHON) hg version
38
38
39 build:
39 build:
40 $(PYTHON) setup.py $(PURE) build
40 $(PYTHON) setup.py $(PURE) build
41
41
42 doc:
42 doc:
43 $(MAKE) -C doc
43 $(MAKE) -C doc
44
44
45 clean:
45 clean:
46 -$(PYTHON) setup.py clean --all # ignore errors from this command
46 -$(PYTHON) setup.py clean --all # ignore errors from this command
47 find . \( -name '*.py[cdo]' -o -name '*.so' \) -exec rm -f '{}' ';'
47 find . \( -name '*.py[cdo]' -o -name '*.so' \) -exec rm -f '{}' ';'
48 rm -f $(addprefix mercurial/,$(notdir $(wildcard mercurial/pure/[a-z]*.py)))
48 rm -f $(addprefix mercurial/,$(notdir $(wildcard mercurial/pure/[a-z]*.py)))
49 rm -f MANIFEST MANIFEST.in mercurial/__version__.py tests/*.err
49 rm -f MANIFEST MANIFEST.in mercurial/__version__.py tests/*.err
50 rm -rf build mercurial/locale
50 rm -rf build mercurial/locale
51 $(MAKE) -C doc clean
51 $(MAKE) -C doc clean
52
52
53 install: install-bin install-doc
53 install: install-bin install-doc
54
54
55 install-bin: build
55 install-bin: build
56 $(PYTHON) setup.py $(PURE) install --root="$(DESTDIR)/" --prefix="$(PREFIX)" --force
56 $(PYTHON) setup.py $(PURE) install --root="$(DESTDIR)/" --prefix="$(PREFIX)" --force
57
57
58 install-doc: doc
58 install-doc: doc
59 cd doc && $(MAKE) $(MFLAGS) install
59 cd doc && $(MAKE) $(MFLAGS) install
60
60
61 install-home: install-home-bin install-home-doc
61 install-home: install-home-bin install-home-doc
62
62
63 install-home-bin: build
63 install-home-bin: build
64 $(PYTHON) setup.py $(PURE) install --home="$(HOME)" --force
64 $(PYTHON) setup.py $(PURE) install --home="$(HOME)" --force
65
65
66 install-home-doc: doc
66 install-home-doc: doc
67 cd doc && $(MAKE) $(MFLAGS) PREFIX="$(HOME)" install
67 cd doc && $(MAKE) $(MFLAGS) PREFIX="$(HOME)" install
68
68
69 MANIFEST-doc:
69 MANIFEST-doc:
70 $(MAKE) -C doc MANIFEST
70 $(MAKE) -C doc MANIFEST
71
71
72 MANIFEST.in: MANIFEST-doc
72 MANIFEST.in: MANIFEST-doc
73 hg manifest | sed -e 's/^/include /' > MANIFEST.in
73 hg manifest | sed -e 's/^/include /' > MANIFEST.in
74 echo include mercurial/__version__.py >> MANIFEST.in
74 echo include mercurial/__version__.py >> MANIFEST.in
75 sed -e 's/^/include /' < doc/MANIFEST >> MANIFEST.in
75 sed -e 's/^/include /' < doc/MANIFEST >> MANIFEST.in
76
76
77 dist: tests dist-notests
77 dist: tests dist-notests
78
78
79 dist-notests: doc MANIFEST.in
79 dist-notests: doc MANIFEST.in
80 TAR_OPTIONS="--owner=root --group=root --mode=u+w,go-w,a+rX-s" $(PYTHON) setup.py -q sdist
80 TAR_OPTIONS="--owner=root --group=root --mode=u+w,go-w,a+rX-s" $(PYTHON) setup.py -q sdist
81
81
82 check: tests
82 check: tests
83
83
84 tests:
84 tests:
85 cd tests && $(PYTHON) run-tests.py $(TESTFLAGS)
85 cd tests && $(PYTHON) run-tests.py $(TESTFLAGS)
86
86
87 test-%:
87 test-%:
88 cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) $@
88 cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) $@
89
89
90 update-pot: i18n/hg.pot
90 update-pot: i18n/hg.pot
91
91
92 i18n/hg.pot: $(PYFILES) $(DOCFILES)
92 i18n/hg.pot: $(PYFILES) $(DOCFILES)
93 $(PYTHON) i18n/hggettext mercurial/commands.py \
93 $(PYTHON) i18n/hggettext mercurial/commands.py \
94 hgext/*.py hgext/*/__init__.py \
94 hgext/*.py hgext/*/__init__.py \
95 mercurial/fileset.py mercurial/revset.py \
95 mercurial/fileset.py mercurial/revset.py \
96 mercurial/templatefilters.py mercurial/templatekw.py \
96 mercurial/templatefilters.py mercurial/templatekw.py \
97 mercurial/filemerge.py \
97 mercurial/filemerge.py \
98 $(DOCFILES) > i18n/hg.pot
98 $(DOCFILES) > i18n/hg.pot
99 # All strings marked for translation in Mercurial contain
99 # All strings marked for translation in Mercurial contain
100 # ASCII characters only. But some files contain string
100 # ASCII characters only. But some files contain string
101 # literals like this '\037\213'. xgettext thinks it has to
101 # literals like this '\037\213'. xgettext thinks it has to
102 # parse them even though they are not marked for translation.
102 # parse them even though they are not marked for translation.
103 # Extracting with an explicit encoding of ISO-8859-1 will make
103 # Extracting with an explicit encoding of ISO-8859-1 will make
104 # xgettext "parse" and ignore them.
104 # xgettext "parse" and ignore them.
105 echo $(PYFILES) | xargs \
105 echo $(PYFILES) | xargs \
106 xgettext --package-name "Mercurial" \
106 xgettext --package-name "Mercurial" \
107 --msgid-bugs-address "<mercurial-devel@selenic.com>" \
107 --msgid-bugs-address "<mercurial-devel@selenic.com>" \
108 --copyright-holder "Matt Mackall <mpm@selenic.com> and others" \
108 --copyright-holder "Matt Mackall <mpm@selenic.com> and others" \
109 --from-code ISO-8859-1 --join --sort-by-file --add-comments=i18n: \
109 --from-code ISO-8859-1 --join --sort-by-file --add-comments=i18n: \
110 -d hg -p i18n -o hg.pot
110 -d hg -p i18n -o hg.pot
111 $(PYTHON) i18n/posplit i18n/hg.pot
111 $(PYTHON) i18n/posplit i18n/hg.pot
112
112
113 %.po: i18n/hg.pot
113 %.po: i18n/hg.pot
114 msgmerge --no-location --update $@ $^
114 msgmerge --no-location --update $@ $^
115
115
116 .PHONY: help all local build doc clean install install-bin install-doc \
116 .PHONY: help all local build doc clean install install-bin install-doc \
117 install-home install-home-bin install-home-doc dist dist-notests tests \
117 install-home install-home-bin install-home-doc dist dist-notests tests \
118 update-pot
118 update-pot
General Comments 0
You need to be logged in to leave comments. Login now