##// END OF EJS Templates
make: alter how we compute compiler flags for setup.py...
Augie Fackler -
r29003:c6b10855 stable
parent child Browse files
Show More
@@ -1,235 +1,239
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 $(eval HGROOT := $(shell pwd))
10 $(eval HGROOT := $(shell pwd))
11 HGPYTHONS ?= $(HGROOT)/build/pythons
11 HGPYTHONS ?= $(HGROOT)/build/pythons
12 PURE=
12 PURE=
13 PYFILES:=$(shell find mercurial hgext doc -name '*.py')
13 PYFILES:=$(shell find mercurial hgext doc -name '*.py')
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
18
19 # Set this to e.g. "mingw32" to use a non-default compiler.
19 # Set this to e.g. "mingw32" to use a non-default compiler.
20 COMPILER=
20 COMPILER=
21
21
22 COMPILERFLAG_tmp_ =
23 COMPILERFLAG_tmp_${COMPILER} ?= -c $(COMPILER)
24 COMPILERFLAG=${COMPILERFLAG_tmp_${COMPILER}}
25
22 help:
26 help:
23 @echo 'Commonly used make targets:'
27 @echo 'Commonly used make targets:'
24 @echo ' all - build program and documentation'
28 @echo ' all - build program and documentation'
25 @echo ' install - install program and man pages to $$PREFIX ($(PREFIX))'
29 @echo ' install - install program and man pages to $$PREFIX ($(PREFIX))'
26 @echo ' install-home - install with setup.py install --home=$$HOME ($(HOME))'
30 @echo ' install-home - install with setup.py install --home=$$HOME ($(HOME))'
27 @echo ' local - build for inplace usage'
31 @echo ' local - build for inplace usage'
28 @echo ' tests - run all tests in the automatic test suite'
32 @echo ' tests - run all tests in the automatic test suite'
29 @echo ' test-foo - run only specified tests (e.g. test-merge1.t)'
33 @echo ' test-foo - run only specified tests (e.g. test-merge1.t)'
30 @echo ' dist - run all tests and create a source tarball in dist/'
34 @echo ' dist - run all tests and create a source tarball in dist/'
31 @echo ' clean - remove files created by other targets'
35 @echo ' clean - remove files created by other targets'
32 @echo ' (except installed files or dist source tarball)'
36 @echo ' (except installed files or dist source tarball)'
33 @echo ' update-pot - update i18n/hg.pot'
37 @echo ' update-pot - update i18n/hg.pot'
34 @echo
38 @echo
35 @echo 'Example for a system-wide installation under /usr/local:'
39 @echo 'Example for a system-wide installation under /usr/local:'
36 @echo ' make all && su -c "make install" && hg version'
40 @echo ' make all && su -c "make install" && hg version'
37 @echo
41 @echo
38 @echo 'Example for a local installation (usable in this directory):'
42 @echo 'Example for a local installation (usable in this directory):'
39 @echo ' make local && ./hg version'
43 @echo ' make local && ./hg version'
40
44
41 all: build doc
45 all: build doc
42
46
43 local:
47 local:
44 $(PYTHON) setup.py $(PURE) \
48 $(PYTHON) setup.py $(PURE) \
45 build_py -c -d . \
49 build_py -c -d . \
46 build_ext $(COMPILER:%=-c %) -i \
50 build_ext $(COMPILERFLAG) -i \
47 build_hgexe $(COMPILER:%=-c %) -i \
51 build_hgexe $(COMPILERFLAG) -i \
48 build_mo
52 build_mo
49 env HGRCPATH= $(PYTHON) hg version
53 env HGRCPATH= $(PYTHON) hg version
50
54
51 build:
55 build:
52 $(PYTHON) setup.py $(PURE) build $(COMPILER:%=-c %)
56 $(PYTHON) setup.py $(PURE) build $(COMPILERFLAG)
53
57
54 wheel:
58 wheel:
55 FORCE_SETUPTOOLS=1 $(PYTHON) setup.py $(PURE) bdist_wheel $(COMPILER:%=-c %)
59 FORCE_SETUPTOOLS=1 $(PYTHON) setup.py $(PURE) bdist_wheel $(COMPILERFLAG)
56
60
57 doc:
61 doc:
58 $(MAKE) -C doc
62 $(MAKE) -C doc
59
63
60 clean:
64 clean:
61 -$(PYTHON) setup.py clean --all # ignore errors from this command
65 -$(PYTHON) setup.py clean --all # ignore errors from this command
62 find contrib doc hgext hgext3rd i18n mercurial tests \
66 find contrib doc hgext hgext3rd i18n mercurial tests \
63 \( -name '*.py[cdo]' -o -name '*.so' \) -exec rm -f '{}' ';'
67 \( -name '*.py[cdo]' -o -name '*.so' \) -exec rm -f '{}' ';'
64 rm -f $(addprefix mercurial/,$(notdir $(wildcard mercurial/pure/[a-z]*.py)))
68 rm -f $(addprefix mercurial/,$(notdir $(wildcard mercurial/pure/[a-z]*.py)))
65 rm -f MANIFEST MANIFEST.in hgext/__index__.py tests/*.err
69 rm -f MANIFEST MANIFEST.in hgext/__index__.py tests/*.err
66 rm -f mercurial/__modulepolicy__.py
70 rm -f mercurial/__modulepolicy__.py
67 if test -d .hg; then rm -f mercurial/__version__.py; fi
71 if test -d .hg; then rm -f mercurial/__version__.py; fi
68 rm -rf build packages mercurial/locale
72 rm -rf build packages mercurial/locale
69 $(MAKE) -C doc clean
73 $(MAKE) -C doc clean
70 $(MAKE) -C contrib/chg distclean
74 $(MAKE) -C contrib/chg distclean
71
75
72 install: install-bin install-doc
76 install: install-bin install-doc
73
77
74 install-bin: build
78 install-bin: build
75 $(PYTHON) setup.py $(PURE) install --root="$(DESTDIR)/" --prefix="$(PREFIX)" --force
79 $(PYTHON) setup.py $(PURE) install --root="$(DESTDIR)/" --prefix="$(PREFIX)" --force
76
80
77 install-doc: doc
81 install-doc: doc
78 cd doc && $(MAKE) $(MFLAGS) install
82 cd doc && $(MAKE) $(MFLAGS) install
79
83
80 install-home: install-home-bin install-home-doc
84 install-home: install-home-bin install-home-doc
81
85
82 install-home-bin: build
86 install-home-bin: build
83 $(PYTHON) setup.py $(PURE) install --home="$(HOME)" --prefix="" --force
87 $(PYTHON) setup.py $(PURE) install --home="$(HOME)" --prefix="" --force
84
88
85 install-home-doc: doc
89 install-home-doc: doc
86 cd doc && $(MAKE) $(MFLAGS) PREFIX="$(HOME)" install
90 cd doc && $(MAKE) $(MFLAGS) PREFIX="$(HOME)" install
87
91
88 MANIFEST-doc:
92 MANIFEST-doc:
89 $(MAKE) -C doc MANIFEST
93 $(MAKE) -C doc MANIFEST
90
94
91 MANIFEST.in: MANIFEST-doc
95 MANIFEST.in: MANIFEST-doc
92 hg manifest | sed -e 's/^/include /' > MANIFEST.in
96 hg manifest | sed -e 's/^/include /' > MANIFEST.in
93 echo include mercurial/__version__.py >> MANIFEST.in
97 echo include mercurial/__version__.py >> MANIFEST.in
94 sed -e 's/^/include /' < doc/MANIFEST >> MANIFEST.in
98 sed -e 's/^/include /' < doc/MANIFEST >> MANIFEST.in
95
99
96 dist: tests dist-notests
100 dist: tests dist-notests
97
101
98 dist-notests: doc MANIFEST.in
102 dist-notests: doc MANIFEST.in
99 TAR_OPTIONS="--owner=root --group=root --mode=u+w,go-w,a+rX-s" $(PYTHON) setup.py -q sdist
103 TAR_OPTIONS="--owner=root --group=root --mode=u+w,go-w,a+rX-s" $(PYTHON) setup.py -q sdist
100
104
101 check: tests
105 check: tests
102
106
103 tests:
107 tests:
104 cd tests && $(PYTHON) run-tests.py $(TESTFLAGS)
108 cd tests && $(PYTHON) run-tests.py $(TESTFLAGS)
105
109
106 test-%:
110 test-%:
107 cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) $@
111 cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) $@
108
112
109 testpy-%:
113 testpy-%:
110 @echo Looking for Python $* in $(HGPYTHONS)
114 @echo Looking for Python $* in $(HGPYTHONS)
111 [ -e $(HGPYTHONS)/$*/bin/python ] || ( \
115 [ -e $(HGPYTHONS)/$*/bin/python ] || ( \
112 cd $$(mktemp --directory --tmpdir) && \
116 cd $$(mktemp --directory --tmpdir) && \
113 $(MAKE) -f $(HGROOT)/contrib/Makefile.python PYTHONVER=$* PREFIX=$(HGPYTHONS)/$* python )
117 $(MAKE) -f $(HGROOT)/contrib/Makefile.python PYTHONVER=$* PREFIX=$(HGPYTHONS)/$* python )
114 cd tests && $(HGPYTHONS)/$*/bin/python run-tests.py $(TESTFLAGS)
118 cd tests && $(HGPYTHONS)/$*/bin/python run-tests.py $(TESTFLAGS)
115
119
116 check-code:
120 check-code:
117 hg manifest | xargs python contrib/check-code.py
121 hg manifest | xargs python contrib/check-code.py
118
122
119 update-pot: i18n/hg.pot
123 update-pot: i18n/hg.pot
120
124
121 i18n/hg.pot: $(PYFILES) $(DOCFILES) i18n/posplit i18n/hggettext
125 i18n/hg.pot: $(PYFILES) $(DOCFILES) i18n/posplit i18n/hggettext
122 $(PYTHON) i18n/hggettext mercurial/commands.py \
126 $(PYTHON) i18n/hggettext mercurial/commands.py \
123 hgext/*.py hgext/*/__init__.py \
127 hgext/*.py hgext/*/__init__.py \
124 mercurial/fileset.py mercurial/revset.py \
128 mercurial/fileset.py mercurial/revset.py \
125 mercurial/templatefilters.py mercurial/templatekw.py \
129 mercurial/templatefilters.py mercurial/templatekw.py \
126 mercurial/templater.py \
130 mercurial/templater.py \
127 mercurial/filemerge.py \
131 mercurial/filemerge.py \
128 mercurial/hgweb/webcommands.py \
132 mercurial/hgweb/webcommands.py \
129 $(DOCFILES) > i18n/hg.pot.tmp
133 $(DOCFILES) > i18n/hg.pot.tmp
130 # All strings marked for translation in Mercurial contain
134 # All strings marked for translation in Mercurial contain
131 # ASCII characters only. But some files contain string
135 # ASCII characters only. But some files contain string
132 # literals like this '\037\213'. xgettext thinks it has to
136 # literals like this '\037\213'. xgettext thinks it has to
133 # parse them even though they are not marked for translation.
137 # parse them even though they are not marked for translation.
134 # Extracting with an explicit encoding of ISO-8859-1 will make
138 # Extracting with an explicit encoding of ISO-8859-1 will make
135 # xgettext "parse" and ignore them.
139 # xgettext "parse" and ignore them.
136 echo $(PYFILES) | xargs \
140 echo $(PYFILES) | xargs \
137 xgettext --package-name "Mercurial" \
141 xgettext --package-name "Mercurial" \
138 --msgid-bugs-address "<mercurial-devel@selenic.com>" \
142 --msgid-bugs-address "<mercurial-devel@selenic.com>" \
139 --copyright-holder "Matt Mackall <mpm@selenic.com> and others" \
143 --copyright-holder "Matt Mackall <mpm@selenic.com> and others" \
140 --from-code ISO-8859-1 --join --sort-by-file --add-comments=i18n: \
144 --from-code ISO-8859-1 --join --sort-by-file --add-comments=i18n: \
141 -d hg -p i18n -o hg.pot.tmp
145 -d hg -p i18n -o hg.pot.tmp
142 $(PYTHON) i18n/posplit i18n/hg.pot.tmp
146 $(PYTHON) i18n/posplit i18n/hg.pot.tmp
143 # The target file is not created before the last step. So it never is in
147 # The target file is not created before the last step. So it never is in
144 # an intermediate state.
148 # an intermediate state.
145 mv -f i18n/hg.pot.tmp i18n/hg.pot
149 mv -f i18n/hg.pot.tmp i18n/hg.pot
146
150
147 %.po: i18n/hg.pot
151 %.po: i18n/hg.pot
148 # work on a temporary copy for never having a half completed target
152 # work on a temporary copy for never having a half completed target
149 cp $@ $@.tmp
153 cp $@ $@.tmp
150 msgmerge --no-location --update $@.tmp $^
154 msgmerge --no-location --update $@.tmp $^
151 mv -f $@.tmp $@
155 mv -f $@.tmp $@
152
156
153 # Packaging targets
157 # Packaging targets
154
158
155 osx:
159 osx:
156 python -c 'import bdist_mpkg.script_bdist_mpkg' || \
160 python -c 'import bdist_mpkg.script_bdist_mpkg' || \
157 (echo "Missing bdist_mpkg (easy_install bdist_mpkg)"; false)
161 (echo "Missing bdist_mpkg (easy_install bdist_mpkg)"; false)
158 rm -rf dist/mercurial-*.mpkg
162 rm -rf dist/mercurial-*.mpkg
159 python -m bdist_mpkg.script_bdist_mpkg setup.py --
163 python -m bdist_mpkg.script_bdist_mpkg setup.py --
160 python contrib/fixpax.py dist/mercurial-*.mpkg/Contents/Packages/*.pkg/Contents/Archive.pax.gz
164 python contrib/fixpax.py dist/mercurial-*.mpkg/Contents/Packages/*.pkg/Contents/Archive.pax.gz
161 mkdir -p packages/osx
165 mkdir -p packages/osx
162 N=`cd dist && echo mercurial-*.mpkg | sed 's,\.mpkg$$,,'` && hdiutil create -srcfolder dist/$$N.mpkg/ -scrub -volname "$$N" -ov packages/osx/$$N.dmg
166 N=`cd dist && echo mercurial-*.mpkg | sed 's,\.mpkg$$,,'` && hdiutil create -srcfolder dist/$$N.mpkg/ -scrub -volname "$$N" -ov packages/osx/$$N.dmg
163 rm -rf dist/mercurial-*.mpkg
167 rm -rf dist/mercurial-*.mpkg
164
168
165 deb:
169 deb:
166 contrib/builddeb
170 contrib/builddeb
167
171
168 ppa:
172 ppa:
169 contrib/builddeb --source-only
173 contrib/builddeb --source-only
170
174
171 docker-debian-jessie:
175 docker-debian-jessie:
172 mkdir -p packages/debian-jessie
176 mkdir -p packages/debian-jessie
173 contrib/dockerdeb debian jessie
177 contrib/dockerdeb debian jessie
174
178
175 docker-ubuntu-trusty:
179 docker-ubuntu-trusty:
176 mkdir -p packages/ubuntu-trusty
180 mkdir -p packages/ubuntu-trusty
177 contrib/dockerdeb ubuntu trusty
181 contrib/dockerdeb ubuntu trusty
178
182
179 fedora20:
183 fedora20:
180 mkdir -p packages/fedora20
184 mkdir -p packages/fedora20
181 contrib/buildrpm
185 contrib/buildrpm
182 cp rpmbuild/RPMS/*/* packages/fedora20
186 cp rpmbuild/RPMS/*/* packages/fedora20
183 cp rpmbuild/SRPMS/* packages/fedora20
187 cp rpmbuild/SRPMS/* packages/fedora20
184 rm -rf rpmbuild
188 rm -rf rpmbuild
185
189
186 docker-fedora20:
190 docker-fedora20:
187 mkdir -p packages/fedora20
191 mkdir -p packages/fedora20
188 contrib/dockerrpm fedora20
192 contrib/dockerrpm fedora20
189
193
190 fedora21:
194 fedora21:
191 mkdir -p packages/fedora21
195 mkdir -p packages/fedora21
192 contrib/buildrpm
196 contrib/buildrpm
193 cp rpmbuild/RPMS/*/* packages/fedora21
197 cp rpmbuild/RPMS/*/* packages/fedora21
194 cp rpmbuild/SRPMS/* packages/fedora21
198 cp rpmbuild/SRPMS/* packages/fedora21
195 rm -rf rpmbuild
199 rm -rf rpmbuild
196
200
197 docker-fedora21:
201 docker-fedora21:
198 mkdir -p packages/fedora21
202 mkdir -p packages/fedora21
199 contrib/dockerrpm fedora21
203 contrib/dockerrpm fedora21
200
204
201 centos5:
205 centos5:
202 mkdir -p packages/centos5
206 mkdir -p packages/centos5
203 contrib/buildrpm --withpython
207 contrib/buildrpm --withpython
204 cp rpmbuild/RPMS/*/* packages/centos5
208 cp rpmbuild/RPMS/*/* packages/centos5
205 cp rpmbuild/SRPMS/* packages/centos5
209 cp rpmbuild/SRPMS/* packages/centos5
206
210
207 docker-centos5:
211 docker-centos5:
208 mkdir -p packages/centos5
212 mkdir -p packages/centos5
209 contrib/dockerrpm centos5 --withpython
213 contrib/dockerrpm centos5 --withpython
210
214
211 centos6:
215 centos6:
212 mkdir -p packages/centos6
216 mkdir -p packages/centos6
213 contrib/buildrpm
217 contrib/buildrpm
214 cp rpmbuild/RPMS/*/* packages/centos6
218 cp rpmbuild/RPMS/*/* packages/centos6
215 cp rpmbuild/SRPMS/* packages/centos6
219 cp rpmbuild/SRPMS/* packages/centos6
216
220
217 docker-centos6:
221 docker-centos6:
218 mkdir -p packages/centos6
222 mkdir -p packages/centos6
219 contrib/dockerrpm centos6
223 contrib/dockerrpm centos6
220
224
221 centos7:
225 centos7:
222 mkdir -p packages/centos7
226 mkdir -p packages/centos7
223 contrib/buildrpm
227 contrib/buildrpm
224 cp rpmbuild/RPMS/*/* packages/centos7
228 cp rpmbuild/RPMS/*/* packages/centos7
225 cp rpmbuild/SRPMS/* packages/centos7
229 cp rpmbuild/SRPMS/* packages/centos7
226
230
227 docker-centos7:
231 docker-centos7:
228 mkdir -p packages/centos7
232 mkdir -p packages/centos7
229 contrib/dockerrpm centos7
233 contrib/dockerrpm centos7
230
234
231 .PHONY: help all local build doc clean install install-bin install-doc \
235 .PHONY: help all local build doc clean install install-bin install-doc \
232 install-home install-home-bin install-home-doc \
236 install-home install-home-bin install-home-doc \
233 dist dist-notests check tests check-code update-pot \
237 dist dist-notests check tests check-code update-pot \
234 osx fedora20 docker-fedora20 fedora21 docker-fedora21 \
238 osx fedora20 docker-fedora20 fedora21 docker-fedora21 \
235 centos5 docker-centos5 centos6 docker-centos6 centos7 docker-centos7
239 centos5 docker-centos5 centos6 docker-centos6 centos7 docker-centos7
General Comments 0
You need to be logged in to leave comments. Login now