-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
62 lines (48 loc) · 1.83 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
PYTHON?=python
VERSION?=$(shell sed -ne "s|^__version__\s*=\s*'\([^']*\)'.*|\1|p" src/quicktions.pyx)
PACKAGE=quicktions
WITH_CYTHON := $(shell python -c 'from Cython.Build import cythonize' 2>/dev/null && echo "--with-cython")
PYTHON_WHEEL_BUILD_VERSION := "cp*"
MANYLINUX_IMAGES= \
manylinux1_x86_64 \
manylinux1_i686 \
manylinux_2_24_x86_64 \
manylinux_2_24_i686 \
manylinux_2_24_aarch64 \
manylinux_2_28_x86_64 \
manylinux_2_28_aarch64 \
musllinux_1_1_x86_64
.PHONY: all local sdist test clean realclean wheel_manylinux
all: local
local:
${PYTHON} setup.py build_ext --inplace $(WITH_CYTHON)
sdist: dist/$(PACKAGE)-$(VERSION).tar.gz
dist/$(PACKAGE)-$(VERSION).tar.gz:
$(PYTHON) setup.py sdist $(WITH_CYTHON)
testslow: local
PYTHONPATH=src $(PYTHON) src/test_fractions.py
test: local
PYTHONPATH=src $(PYTHON) src/test_fractions.py --fast
clean:
rm -fr build src/*.so
realclean: clean
rm -fr src/*.c src/*.html
qemu-user-static:
docker run --rm --privileged hypriot/qemu-register
wheel:
$(PYTHON) setup.py bdist_wheel
wheel_manylinux: sdist $(addprefix wheel_,$(MANYLINUX_IMAGES))
$(addprefix wheel_,$(filter-out %_x86_64, $(filter-out %_i686, $(MANYLINUX_IMAGES)))): qemu-user-static
wheel_%: dist/$(PACKAGE)-$(VERSION).tar.gz
echo "Building wheels for $(PACKAGE) $(VERSION)"
time docker run --rm -t \
-v $(shell pwd):/io \
-e CFLAGS="-O3 -g0 -mtune=generic -pipe -fPIC" \
-e LDFLAGS="$(LDFLAGS) -fPIC" \
-e WHEELHOUSE=wheelhouse$(subst wheel_manylinux,,$@) \
quay.io/pypa/$(subst wheel_,,$@) \
bash -c 'for PYBIN in /opt/python/$(PYTHON_WHEEL_BUILD_VERSION)/bin; do \
$$PYBIN/python -V; \
{ $$PYBIN/pip wheel -w /io/$$WHEELHOUSE /io/$< & } ; \
done; wait; \
for whl in /io/$$WHEELHOUSE/$(PACKAGE)-$(VERSION)-*-linux_*.whl; do auditwheel repair $$whl -w /io/$$WHEELHOUSE; done'