-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
74 lines (60 loc) · 1.8 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
63
64
65
66
67
68
69
70
71
72
73
## Makefile
##
## default variable setting
##
#
# exectuables
#
MAKE ?= $(shell which make)
CMAKE ?= $(shell which cmake)
PYTHON ?= $(shell which python)
SWIG ?= $(shell which swig)
PYTHONCONFIG ?= $(shell which python-config)
# compileres
CC ?= $(shell which mpicc)
CXX ?= $(shell which mpicxx)
CXXFLAGS ?= -std=gnu++11
#
# location of lib/include
#
PREFIX ?= /usr/local/lib
# MFEM lib/include directory
MFEM_LNK_DIR ?= ${PREFIX}/lib
MFEM_INC_DIR ?= ${PREFIX}/include
# HYPRE/Metis include
# There are needed for mfem.hpp
HYPRE_INC_DIR ?= ${PREFIX}/include
METIS_INC_DIR ?= ${PREFIX}/include
# the location of mpi4py.i (asking Python for the location usually works)
MPI4PYINCDIR = $(shell $(PYTHON) -c "import mpi4py;print mpi4py.get_include()")
UNAME := $(shell uname)
SUBDIRS = ext
export
default: so
.PHONEY: all install extension cxx so
##
extension:
mkdir -p $(PREFIX)
mkdir -p build_ext
cd build_ext; $(CMAKE) ../ext -DCMAKE_INSTALL_NAME_DIR=${PREFIX}/lib \
-DCMAKE_INSTALL_PREFIX=${PREFIX} \
-DMFEM_INC_DIR=${MFEM_INC_DIR} \
-DMFEM_LNK_DIR=${MFEM_LNK_DIR} \
-DMETIS_INCDIR=${METIS_INC_DIR} \
-DHYPRE_INC_DIR=${HYPRE_INC_DIR} \
-DCMAKE_C_COMPILER=${CC} \
-DCMAKE_CXX_COMPILER=${CXX}; \
$(MAKE) VERBOSE=1; \
$(MAKE) install
cxx:
$(MAKE) -C mfem_ext_sample cxx
so:
$(PYTHON) setup.py build
#_ext --inplace
# $(MAKE) -C mfem_ext_sample so
install:
$(PYTHON) setup.py install --prefix=$(PREFIX)
clean:
rm -rf build_ext
$(MAKE) -C mfem_ext_sample clean
rm -rf build/*