##// END OF EJS Templates
makefile: run Rust tests if cargo is installed...
Raphaël Gomès -
r43073:7521e6d1 stable
parent child Browse files
Show More
@@ -1,248 +1,253 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 export PREFIX=/usr/local
7 export PREFIX=/usr/local
8 PYTHON?=python
8 PYTHON?=python
9 $(eval HGROOT := $(shell pwd))
9 $(eval HGROOT := $(shell pwd))
10 HGPYTHONS ?= $(HGROOT)/build/pythons
10 HGPYTHONS ?= $(HGROOT)/build/pythons
11 PURE=
11 PURE=
12 PYFILESCMD=find mercurial hgext doc -name '*.py'
12 PYFILESCMD=find mercurial hgext doc -name '*.py'
13 PYFILES:=$(shell $(PYFILESCMD))
13 PYFILES:=$(shell $(PYFILESCMD))
14 DOCFILES=mercurial/help/*.txt
14 DOCFILES=mercurial/help/*.txt
15 export LANGUAGE=C
15 export LANGUAGE=C
16 export LC_ALL=C
16 export LC_ALL=C
17 TESTFLAGS ?= $(shell echo $$HGTESTFLAGS)
17 TESTFLAGS ?= $(shell echo $$HGTESTFLAGS)
18 OSXVERSIONFLAGS ?= $(shell echo $$OSXVERSIONFLAGS)
18 OSXVERSIONFLAGS ?= $(shell echo $$OSXVERSIONFLAGS)
19 CARGO = cargo
19
20
20 # Set this to e.g. "mingw32" to use a non-default compiler.
21 # Set this to e.g. "mingw32" to use a non-default compiler.
21 COMPILER=
22 COMPILER=
22
23
23 COMPILERFLAG_tmp_ =
24 COMPILERFLAG_tmp_ =
24 COMPILERFLAG_tmp_${COMPILER} ?= -c $(COMPILER)
25 COMPILERFLAG_tmp_${COMPILER} ?= -c $(COMPILER)
25 COMPILERFLAG=${COMPILERFLAG_tmp_${COMPILER}}
26 COMPILERFLAG=${COMPILERFLAG_tmp_${COMPILER}}
26
27
27 help:
28 help:
28 @echo 'Commonly used make targets:'
29 @echo 'Commonly used make targets:'
29 @echo ' all - build program and documentation'
30 @echo ' all - build program and documentation'
30 @echo ' install - install program and man pages to $$PREFIX ($(PREFIX))'
31 @echo ' install - install program and man pages to $$PREFIX ($(PREFIX))'
31 @echo ' install-home - install with setup.py install --home=$$HOME ($(HOME))'
32 @echo ' install-home - install with setup.py install --home=$$HOME ($(HOME))'
32 @echo ' local - build for inplace usage'
33 @echo ' local - build for inplace usage'
33 @echo ' tests - run all tests in the automatic test suite'
34 @echo ' tests - run all tests in the automatic test suite'
34 @echo ' test-foo - run only specified tests (e.g. test-merge1.t)'
35 @echo ' test-foo - run only specified tests (e.g. test-merge1.t)'
35 @echo ' dist - run all tests and create a source tarball in dist/'
36 @echo ' dist - run all tests and create a source tarball in dist/'
36 @echo ' clean - remove files created by other targets'
37 @echo ' clean - remove files created by other targets'
37 @echo ' (except installed files or dist source tarball)'
38 @echo ' (except installed files or dist source tarball)'
38 @echo ' update-pot - update i18n/hg.pot'
39 @echo ' update-pot - update i18n/hg.pot'
39 @echo
40 @echo
40 @echo 'Example for a system-wide installation under /usr/local:'
41 @echo 'Example for a system-wide installation under /usr/local:'
41 @echo ' make all && su -c "make install" && hg version'
42 @echo ' make all && su -c "make install" && hg version'
42 @echo
43 @echo
43 @echo 'Example for a local installation (usable in this directory):'
44 @echo 'Example for a local installation (usable in this directory):'
44 @echo ' make local && ./hg version'
45 @echo ' make local && ./hg version'
45
46
46 all: build doc
47 all: build doc
47
48
48 local:
49 local:
49 $(PYTHON) setup.py $(PURE) \
50 $(PYTHON) setup.py $(PURE) \
50 build_py -c -d . \
51 build_py -c -d . \
51 build_ext $(COMPILERFLAG) -i \
52 build_ext $(COMPILERFLAG) -i \
52 build_hgexe $(COMPILERFLAG) -i \
53 build_hgexe $(COMPILERFLAG) -i \
53 build_mo
54 build_mo
54 env HGRCPATH= $(PYTHON) hg version
55 env HGRCPATH= $(PYTHON) hg version
55
56
56 build:
57 build:
57 $(PYTHON) setup.py $(PURE) build $(COMPILERFLAG)
58 $(PYTHON) setup.py $(PURE) build $(COMPILERFLAG)
58
59
59 wheel:
60 wheel:
60 FORCE_SETUPTOOLS=1 $(PYTHON) setup.py $(PURE) bdist_wheel $(COMPILERFLAG)
61 FORCE_SETUPTOOLS=1 $(PYTHON) setup.py $(PURE) bdist_wheel $(COMPILERFLAG)
61
62
62 doc:
63 doc:
63 $(MAKE) -C doc
64 $(MAKE) -C doc
64
65
65 cleanbutpackages:
66 cleanbutpackages:
66 -$(PYTHON) setup.py clean --all # ignore errors from this command
67 -$(PYTHON) setup.py clean --all # ignore errors from this command
67 find contrib doc hgext hgext3rd i18n mercurial tests hgdemandimport \
68 find contrib doc hgext hgext3rd i18n mercurial tests hgdemandimport \
68 \( -name '*.py[cdo]' -o -name '*.so' \) -exec rm -f '{}' ';'
69 \( -name '*.py[cdo]' -o -name '*.so' \) -exec rm -f '{}' ';'
69 rm -f MANIFEST MANIFEST.in hgext/__index__.py tests/*.err
70 rm -f MANIFEST MANIFEST.in hgext/__index__.py tests/*.err
70 rm -f mercurial/__modulepolicy__.py
71 rm -f mercurial/__modulepolicy__.py
71 if test -d .hg; then rm -f mercurial/__version__.py; fi
72 if test -d .hg; then rm -f mercurial/__version__.py; fi
72 rm -rf build mercurial/locale
73 rm -rf build mercurial/locale
73 $(MAKE) -C doc clean
74 $(MAKE) -C doc clean
74 $(MAKE) -C contrib/chg distclean
75 $(MAKE) -C contrib/chg distclean
75 rm -rf rust/target
76 rm -rf rust/target
76 rm -f mercurial/rustext.so
77 rm -f mercurial/rustext.so
77
78
78 clean: cleanbutpackages
79 clean: cleanbutpackages
79 rm -rf packages
80 rm -rf packages
80
81
81 install: install-bin install-doc
82 install: install-bin install-doc
82
83
83 install-bin: build
84 install-bin: build
84 $(PYTHON) setup.py $(PURE) install --root="$(DESTDIR)/" --prefix="$(PREFIX)" --force
85 $(PYTHON) setup.py $(PURE) install --root="$(DESTDIR)/" --prefix="$(PREFIX)" --force
85
86
86 install-doc: doc
87 install-doc: doc
87 cd doc && $(MAKE) $(MFLAGS) install
88 cd doc && $(MAKE) $(MFLAGS) install
88
89
89 install-home: install-home-bin install-home-doc
90 install-home: install-home-bin install-home-doc
90
91
91 install-home-bin: build
92 install-home-bin: build
92 $(PYTHON) setup.py $(PURE) install --home="$(HOME)" --prefix="" --force
93 $(PYTHON) setup.py $(PURE) install --home="$(HOME)" --prefix="" --force
93
94
94 install-home-doc: doc
95 install-home-doc: doc
95 cd doc && $(MAKE) $(MFLAGS) PREFIX="$(HOME)" install
96 cd doc && $(MAKE) $(MFLAGS) PREFIX="$(HOME)" install
96
97
97 MANIFEST-doc:
98 MANIFEST-doc:
98 $(MAKE) -C doc MANIFEST
99 $(MAKE) -C doc MANIFEST
99
100
100 MANIFEST.in: MANIFEST-doc
101 MANIFEST.in: MANIFEST-doc
101 hg manifest | sed -e 's/^/include /' > MANIFEST.in
102 hg manifest | sed -e 's/^/include /' > MANIFEST.in
102 echo include mercurial/__version__.py >> MANIFEST.in
103 echo include mercurial/__version__.py >> MANIFEST.in
103 sed -e 's/^/include /' < doc/MANIFEST >> MANIFEST.in
104 sed -e 's/^/include /' < doc/MANIFEST >> MANIFEST.in
104
105
105 dist: tests dist-notests
106 dist: tests dist-notests
106
107
107 dist-notests: doc MANIFEST.in
108 dist-notests: doc MANIFEST.in
108 TAR_OPTIONS="--owner=root --group=root --mode=u+w,go-w,a+rX-s" $(PYTHON) setup.py -q sdist
109 TAR_OPTIONS="--owner=root --group=root --mode=u+w,go-w,a+rX-s" $(PYTHON) setup.py -q sdist
109
110
110 check: tests
111 check: tests
111
112
112 tests:
113 tests:
114 # Run Rust tests if cargo is installed
115 if command -v $(CARGO) >/dev/null 2>&1; then \
116 cd $(HGROOT)/rust/hg-cpython && $(CARGO) test --quiet --all; \
117 fi
113 cd tests && $(PYTHON) run-tests.py $(TESTFLAGS)
118 cd tests && $(PYTHON) run-tests.py $(TESTFLAGS)
114
119
115 test-%:
120 test-%:
116 cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) $@
121 cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) $@
117
122
118 testpy-%:
123 testpy-%:
119 @echo Looking for Python $* in $(HGPYTHONS)
124 @echo Looking for Python $* in $(HGPYTHONS)
120 [ -e $(HGPYTHONS)/$*/bin/python ] || ( \
125 [ -e $(HGPYTHONS)/$*/bin/python ] || ( \
121 cd $$(mktemp --directory --tmpdir) && \
126 cd $$(mktemp --directory --tmpdir) && \
122 $(MAKE) -f $(HGROOT)/contrib/Makefile.python PYTHONVER=$* PREFIX=$(HGPYTHONS)/$* python )
127 $(MAKE) -f $(HGROOT)/contrib/Makefile.python PYTHONVER=$* PREFIX=$(HGPYTHONS)/$* python )
123 cd tests && $(HGPYTHONS)/$*/bin/python run-tests.py $(TESTFLAGS)
128 cd tests && $(HGPYTHONS)/$*/bin/python run-tests.py $(TESTFLAGS)
124
129
125 check-code:
130 check-code:
126 hg manifest | xargs python contrib/check-code.py
131 hg manifest | xargs python contrib/check-code.py
127
132
128 format-c:
133 format-c:
129 clang-format --style file -i \
134 clang-format --style file -i \
130 `hg files 'set:(**.c or **.cc or **.h) and not "listfile:contrib/clang-format-ignorelist"'`
135 `hg files 'set:(**.c or **.cc or **.h) and not "listfile:contrib/clang-format-ignorelist"'`
131
136
132 update-pot: i18n/hg.pot
137 update-pot: i18n/hg.pot
133
138
134 i18n/hg.pot: $(PYFILES) $(DOCFILES) i18n/posplit i18n/hggettext
139 i18n/hg.pot: $(PYFILES) $(DOCFILES) i18n/posplit i18n/hggettext
135 $(PYTHON) i18n/hggettext mercurial/commands.py \
140 $(PYTHON) i18n/hggettext mercurial/commands.py \
136 hgext/*.py hgext/*/__init__.py \
141 hgext/*.py hgext/*/__init__.py \
137 mercurial/fileset.py mercurial/revset.py \
142 mercurial/fileset.py mercurial/revset.py \
138 mercurial/templatefilters.py \
143 mercurial/templatefilters.py \
139 mercurial/templatefuncs.py \
144 mercurial/templatefuncs.py \
140 mercurial/templatekw.py \
145 mercurial/templatekw.py \
141 mercurial/filemerge.py \
146 mercurial/filemerge.py \
142 mercurial/hgweb/webcommands.py \
147 mercurial/hgweb/webcommands.py \
143 mercurial/util.py \
148 mercurial/util.py \
144 $(DOCFILES) > i18n/hg.pot.tmp
149 $(DOCFILES) > i18n/hg.pot.tmp
145 # All strings marked for translation in Mercurial contain
150 # All strings marked for translation in Mercurial contain
146 # ASCII characters only. But some files contain string
151 # ASCII characters only. But some files contain string
147 # literals like this '\037\213'. xgettext thinks it has to
152 # literals like this '\037\213'. xgettext thinks it has to
148 # parse them even though they are not marked for translation.
153 # parse them even though they are not marked for translation.
149 # Extracting with an explicit encoding of ISO-8859-1 will make
154 # Extracting with an explicit encoding of ISO-8859-1 will make
150 # xgettext "parse" and ignore them.
155 # xgettext "parse" and ignore them.
151 $(PYFILESCMD) | xargs \
156 $(PYFILESCMD) | xargs \
152 xgettext --package-name "Mercurial" \
157 xgettext --package-name "Mercurial" \
153 --msgid-bugs-address "<mercurial-devel@mercurial-scm.org>" \
158 --msgid-bugs-address "<mercurial-devel@mercurial-scm.org>" \
154 --copyright-holder "Matt Mackall <mpm@selenic.com> and others" \
159 --copyright-holder "Matt Mackall <mpm@selenic.com> and others" \
155 --from-code ISO-8859-1 --join --sort-by-file --add-comments=i18n: \
160 --from-code ISO-8859-1 --join --sort-by-file --add-comments=i18n: \
156 -d hg -p i18n -o hg.pot.tmp
161 -d hg -p i18n -o hg.pot.tmp
157 $(PYTHON) i18n/posplit i18n/hg.pot.tmp
162 $(PYTHON) i18n/posplit i18n/hg.pot.tmp
158 # The target file is not created before the last step. So it never is in
163 # The target file is not created before the last step. So it never is in
159 # an intermediate state.
164 # an intermediate state.
160 mv -f i18n/hg.pot.tmp i18n/hg.pot
165 mv -f i18n/hg.pot.tmp i18n/hg.pot
161
166
162 %.po: i18n/hg.pot
167 %.po: i18n/hg.pot
163 # work on a temporary copy for never having a half completed target
168 # work on a temporary copy for never having a half completed target
164 cp $@ $@.tmp
169 cp $@ $@.tmp
165 msgmerge --no-location --update $@.tmp $^
170 msgmerge --no-location --update $@.tmp $^
166 mv -f $@.tmp $@
171 mv -f $@.tmp $@
167
172
168 # Packaging targets
173 # Packaging targets
169
174
170 packaging_targets := \
175 packaging_targets := \
171 centos5 \
176 centos5 \
172 centos6 \
177 centos6 \
173 centos7 \
178 centos7 \
174 deb \
179 deb \
175 docker-centos5 \
180 docker-centos5 \
176 docker-centos6 \
181 docker-centos6 \
177 docker-centos7 \
182 docker-centos7 \
178 docker-debian-jessie \
183 docker-debian-jessie \
179 docker-debian-stretch \
184 docker-debian-stretch \
180 docker-fedora20 \
185 docker-fedora20 \
181 docker-fedora21 \
186 docker-fedora21 \
182 docker-fedora28 \
187 docker-fedora28 \
183 docker-fedora29 \
188 docker-fedora29 \
184 docker-ubuntu-trusty \
189 docker-ubuntu-trusty \
185 docker-ubuntu-trusty-ppa \
190 docker-ubuntu-trusty-ppa \
186 docker-ubuntu-xenial \
191 docker-ubuntu-xenial \
187 docker-ubuntu-xenial-ppa \
192 docker-ubuntu-xenial-ppa \
188 docker-ubuntu-artful \
193 docker-ubuntu-artful \
189 docker-ubuntu-artful-ppa \
194 docker-ubuntu-artful-ppa \
190 docker-ubuntu-bionic \
195 docker-ubuntu-bionic \
191 docker-ubuntu-bionic-ppa \
196 docker-ubuntu-bionic-ppa \
192 fedora20 \
197 fedora20 \
193 fedora21 \
198 fedora21 \
194 fedora28 \
199 fedora28 \
195 fedora29 \
200 fedora29 \
196 linux-wheels \
201 linux-wheels \
197 linux-wheels-x86_64 \
202 linux-wheels-x86_64 \
198 linux-wheels-i686 \
203 linux-wheels-i686 \
199 ppa
204 ppa
200
205
201 # Forward packaging targets for convenience.
206 # Forward packaging targets for convenience.
202 $(packaging_targets):
207 $(packaging_targets):
203 $(MAKE) -C contrib/packaging $@
208 $(MAKE) -C contrib/packaging $@
204
209
205 osx:
210 osx:
206 rm -rf build/mercurial
211 rm -rf build/mercurial
207 /usr/bin/python2.7 setup.py install --optimize=1 \
212 /usr/bin/python2.7 setup.py install --optimize=1 \
208 --root=build/mercurial/ --prefix=/usr/local/ \
213 --root=build/mercurial/ --prefix=/usr/local/ \
209 --install-lib=/Library/Python/2.7/site-packages/
214 --install-lib=/Library/Python/2.7/site-packages/
210 make -C doc all install DESTDIR="$(PWD)/build/mercurial/"
215 make -C doc all install DESTDIR="$(PWD)/build/mercurial/"
211 # Place a bogon .DS_Store file in the target dir so we can be
216 # Place a bogon .DS_Store file in the target dir so we can be
212 # sure it doesn't get included in the final package.
217 # sure it doesn't get included in the final package.
213 touch build/mercurial/.DS_Store
218 touch build/mercurial/.DS_Store
214 # install zsh completions - this location appears to be
219 # install zsh completions - this location appears to be
215 # searched by default as of macOS Sierra.
220 # searched by default as of macOS Sierra.
216 install -d build/mercurial/usr/local/share/zsh/site-functions/
221 install -d build/mercurial/usr/local/share/zsh/site-functions/
217 install -m 0644 contrib/zsh_completion build/mercurial/usr/local/share/zsh/site-functions/_hg
222 install -m 0644 contrib/zsh_completion build/mercurial/usr/local/share/zsh/site-functions/_hg
218 # install bash completions - there doesn't appear to be a
223 # install bash completions - there doesn't appear to be a
219 # place that's searched by default for bash, so we'll follow
224 # place that's searched by default for bash, so we'll follow
220 # the lead of Apple's git install and just put it in a
225 # the lead of Apple's git install and just put it in a
221 # location of our own.
226 # location of our own.
222 install -d build/mercurial/usr/local/hg/contrib/
227 install -d build/mercurial/usr/local/hg/contrib/
223 install -m 0644 contrib/bash_completion build/mercurial/usr/local/hg/contrib/hg-completion.bash
228 install -m 0644 contrib/bash_completion build/mercurial/usr/local/hg/contrib/hg-completion.bash
224 make -C contrib/chg \
229 make -C contrib/chg \
225 HGPATH=/usr/local/bin/hg \
230 HGPATH=/usr/local/bin/hg \
226 PYTHON=/usr/bin/python2.7 \
231 PYTHON=/usr/bin/python2.7 \
227 HGEXTDIR=/Library/Python/2.7/site-packages/hgext \
232 HGEXTDIR=/Library/Python/2.7/site-packages/hgext \
228 DESTDIR=../../build/mercurial \
233 DESTDIR=../../build/mercurial \
229 PREFIX=/usr/local \
234 PREFIX=/usr/local \
230 clean install
235 clean install
231 mkdir -p $${OUTPUTDIR:-dist}
236 mkdir -p $${OUTPUTDIR:-dist}
232 HGVER=$$(python contrib/genosxversion.py $(OSXVERSIONFLAGS) build/mercurial/Library/Python/2.7/site-packages/mercurial/__version__.py) && \
237 HGVER=$$(python contrib/genosxversion.py $(OSXVERSIONFLAGS) build/mercurial/Library/Python/2.7/site-packages/mercurial/__version__.py) && \
233 OSXVER=$$(sw_vers -productVersion | cut -d. -f1,2) && \
238 OSXVER=$$(sw_vers -productVersion | cut -d. -f1,2) && \
234 pkgbuild --filter \\.DS_Store --root build/mercurial/ \
239 pkgbuild --filter \\.DS_Store --root build/mercurial/ \
235 --identifier org.mercurial-scm.mercurial \
240 --identifier org.mercurial-scm.mercurial \
236 --version "$${HGVER}" \
241 --version "$${HGVER}" \
237 build/mercurial.pkg && \
242 build/mercurial.pkg && \
238 productbuild --distribution contrib/packaging/macosx/distribution.xml \
243 productbuild --distribution contrib/packaging/macosx/distribution.xml \
239 --package-path build/ \
244 --package-path build/ \
240 --version "$${HGVER}" \
245 --version "$${HGVER}" \
241 --resources contrib/packaging/macosx/ \
246 --resources contrib/packaging/macosx/ \
242 "$${OUTPUTDIR:-dist/}"/Mercurial-"$${HGVER}"-macosx"$${OSXVER}".pkg
247 "$${OUTPUTDIR:-dist/}"/Mercurial-"$${HGVER}"-macosx"$${OSXVER}".pkg
243
248
244 .PHONY: help all local build doc cleanbutpackages clean install install-bin \
249 .PHONY: help all local build doc cleanbutpackages clean install install-bin \
245 install-doc install-home install-home-bin install-home-doc \
250 install-doc install-home install-home-bin install-home-doc \
246 dist dist-notests check tests check-code format-c update-pot \
251 dist dist-notests check tests check-code format-c update-pot \
247 $(packaging_targets) \
252 $(packaging_targets) \
248 osx
253 osx
General Comments 0
You need to be logged in to leave comments. Login now