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