@@ -3,8 +3,9 @@ SHELL := /bin/bash
3
3
4
4
MOD_NAME := protected_class
5
5
PYX_SOURCE := src/cython/${MOD_NAME}.pyx
6
- C_SOURCE := src/c/${MOD_NAME}.c
7
- CYTHON_PROG := $(shell which cython3 2>/dev/null || which cython 2>/dev/null)
6
+ C_SOURCE_2 := src/c/2/${MOD_NAME}.c
7
+ C_SOURCE_3 := src/c/3/${MOD_NAME}.c
8
+ CYTHON_PROG := $(shell which cython 2>/dev/null || which cython3 2>/dev/null || which cython 2>/dev/null)
8
9
LS_CMD := ls -g --time-style="+%Y-%m-%d %H:%M:%S"
9
10
RUN_TEST_FILE := tests/run_tests.sh
10
11
@@ -17,10 +18,16 @@ help: ## Show this help
17
18
18
19
# ---------- Combined targets --------------------------------------------
19
20
20
- ${C_SOURCE } : ${PYX_SOURCE}
21
+ ${C_SOURCE_2 } : ${PYX_SOURCE}
21
22
@echo Building C source using ${CYTHON_PROG}
22
- ${CYTHON_PROG} ${PYX_SOURCE} -o ${C_SOURCE} 1> /dev/null
23
- ${LS_CMD} ${C_SOURCE}
23
+ ${CYTHON_PROG} -2 ${PYX_SOURCE} -o ${C_SOURCE_2} 1> /dev/null
24
+ ${LS_CMD} ${C_SOURCE_2}
25
+ @echo " "
26
+
27
+ ${C_SOURCE_3} : ${PYX_SOURCE}
28
+ @echo Building C source using ${CYTHON_PROG}
29
+ ${CYTHON_PROG} -3 ${PYX_SOURCE} -o ${C_SOURCE_3} 1> /dev/null
30
+ ${LS_CMD} ${C_SOURCE_3}
24
31
@echo " "
25
32
26
33
module : py3 py2 # # (PY2 and PY3) Build modules
@@ -36,7 +43,7 @@ clean: ## (PY2 and PY3) Remove built modules
36
43
37
44
# ---------- Python 3 targets --------------------------------------------
38
45
39
- protected_class.cpython-3*.so : ${C_SOURCE }
46
+ protected_class.cpython-3*.so : ${C_SOURCE_3 }
40
47
@echo Building Python 3 extension module
41
48
python3 setup.py build_ext --inplace 1> /dev/null && rm -rf build
42
49
${LS_CMD} protected_class.cpython-3* .so
@@ -55,7 +62,7 @@ vtest3: py3 ## PY3 Build and test module (VERBOSE)
55
62
56
63
# ---------- Python 2 targets --------------------------------------------
57
64
58
- protected_class.so : ${C_SOURCE }
65
+ protected_class.so : ${C_SOURCE_2 }
59
66
@echo Building Python 2 extension module
60
67
python2 setup.py build_ext --inplace 1> /dev/null && rm -rf build
61
68
${LS_CMD} protected_class.so
0 commit comments