Skip to content

Commit 236f8af

Browse files
committed
Improve make logic
1 parent f1f9663 commit 236f8af

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

source-code/cython/Primes/Makefile

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
VERSION = $(shell python3-config --extension-suffix)
2-
PRIMES_LIBS = primes_cython.$(VERSION).so primes_cython3.$(VERSION).so \
3-
primes_pure_python.$(VERSION).so primes_pure_malloc.$(VERSION).so \
4-
primes_malloc.$(VERSION).so
2+
SRC_FILES = primes_cython.pyx \
3+
primes_malloc.pyx \
4+
primes_pure_python.py \
5+
primes_pure_malloc.py
6+
PRIMES_LIBS = $(addsuffix $(VERSION), $(basename $(SRC_FILES)))
7+
C_FILES = $(addsuffix .c, $(basename $(SRC_FILES)))
58

69
all: $(PRIMES_LIBS)
710

8-
$(PRIMES_LIBS): primes_cython.pyx primes_pure_python.py
11+
%$(VERSION): %.pyx
12+
python setup.py build_ext --inplace
13+
14+
%$(VERSION): %.py
915
python setup.py build_ext --inplace
1016

1117
clean:
1218
python setup.py clean
13-
$(RM) primes_cython.c primes_cython3.c primes_pure_python.c primes_malloc.c $(PRIMES_LIBS)
19+
$(RM) $(PRIMES_LIBS)
20+
$(RM) $(C_FILES)
1421
$(RM) -r build/

0 commit comments

Comments
 (0)