Skip to content

Commit c37bf3d

Browse files
Improve building compiled extensions using Makefile (#5059)
* Improve building compiled extensions using Makefile setuptools doesn't provide a way to clean up compiled extensions if they are built inplace. make clean was therefore a best-guess, highly bitrotted removal of the inplace extensions. It was removing many files that no longer exist and failing to remove others. Instead of this approach here we just provide a way to force a rebuild of all extensions. The end result is the same but robust to future file changes. --------- Co-authored-by: Josh Hope-Collins <jhc.jss@gmail.com>
1 parent 8d92204 commit c37bf3d

1 file changed

Lines changed: 8 additions & 39 deletions

File tree

Makefile

Lines changed: 8 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
.PHONY: all
2-
all: modules
3-
4-
.PHONY: modules
5-
modules:
1+
.PHONY: ext
2+
ext:
63
@echo " Building extension modules"
7-
@python setup.py build_ext --inplace > build.log 2>&1 || cat build.log
4+
@python setup.py build_ext --inplace 2>&1 | tee cat build.log
5+
6+
.PHONY: extforce
7+
extforce:
8+
@echo " Force building all extension modules"
9+
@python setup.py build_ext --inplace --force 2>&1 | tee cat build.log
810

911
.PHONY: lint
1012
lint: srclint actionlint dockerlint
@@ -55,39 +57,6 @@ dockerlint:
5557
|| exit 1; \
5658
done
5759

58-
.PHONY: clean
59-
clean:
60-
@echo " Cleaning extension modules"
61-
@python setup.py clean > /dev/null 2>&1
62-
@echo " RM firedrake/cython/dmplex.*.so"
63-
-@rm -f firedrake/cython/dmplex.so > /dev/null 2>&1
64-
@echo " RM firedrake/cython/dmplex.c"
65-
-@rm -f firedrake/cython/dmplex.c > /dev/null 2>&1
66-
@echo " RM firedrake/cython/extrusion_numbering.*.so"
67-
-@rm -f firedrake/cython/extrusion_numbering.so > /dev/null 2>&1
68-
@echo " RM firedrake/cython/extrusion_numbering.c"
69-
-@rm -f firedrake/cython/extrusion_numbering.c > /dev/null 2>&1
70-
@echo " RM firedrake/cython/hdf5interface.*.so"
71-
-@rm -f firedrake/cython/hdf5interface.so > /dev/null 2>&1
72-
@echo " RM firedrake/cython/hdf5interface.c"
73-
-@rm -f firedrake/cython/hdf5interface.c > /dev/null 2>&1
74-
@echo " RM firedrake/cython/spatialindex.*.so"
75-
-@rm -f firedrake/cython/spatialindex.so > /dev/null 2>&1
76-
@echo " RM firedrake/cython/spatialindex.c"
77-
-@rm -f firedrake/cython/spatialindex.c > /dev/null 2>&1
78-
@echo " RM firedrake/cython/supermeshimpl.*.so"
79-
-@rm -f firedrake/cython/supermeshimpl.so > /dev/null 2>&1
80-
@echo " RM firedrake/cython/supermeshimpl.c"
81-
-@rm -f firedrake/cython/supermeshimpl.c > /dev/null 2>&1
82-
@echo " RM firedrake/cython/mg/impl.*.so"
83-
-@rm -f firedrake/cython/mg/impl.so > /dev/null 2>&1
84-
@echo " RM firedrake/cython/mg/impl.c"
85-
-@rm -f firedrake/cython/mg/impl.c > /dev/null 2>&1
86-
@echo " RM pyop2/*.so"
87-
-@rm -f pyop2/*.so > /dev/null 2>&1
88-
@echo " RM tinyasm/*.so"
89-
-@rm -f tinyasm/*.so > /dev/null 2>&1
90-
9160
# NOTE: It is recommended to run this command from inside the 'firedrake'
9261
# Docker image to reduce the likelihood of test failures.
9362
.PHONY: test_durations

0 commit comments

Comments
 (0)