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