-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
128 lines (101 loc) · 3.88 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
## 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
MPICC ?= $(shell which mpicc)
MPICXX ?= $(shell which mpicxx)
CC ?= $(shell cc)
CXX ?= $(shell c++)
CXXFLAGS ?= -std=gnu++11
#
# location of lib/include
#
PREFIX ?= /usr/local/lib
PETRAM ?= ${PetraM}
# MFEM lib/include directory
MFEM_BASE ?= ${PREFIX}/mfem
MFEM_SER_INC = ${MFEM_BASE}/ser/include
MFEM_PAR_INC = ${MFEM_BASE}/par/include
# PyMFEM
PYMFEM_SRC ?= ${PREFIX}/src/PyMFEM
# 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: build_ext install_ext build_so build_py install_py
all: clean build_ext install_ext cxx build_so build_py install_py
.PHONEY: all install build_ext install_ext parcxx sercxx cxx so build_so
##
build_ext:
mkdir -p $(PREFIX)
mkdir -p ext/cmbuild_par
mkdir -p ext/cmbuild_ser
cd ext/cmbuild_ser; $(CMAKE) .. -DCMAKE_INSTALL_NAME_DIR=${MFEM_BASE}/ser/lib \
-DCMAKE_INSTALL_PREFIX=${MFEM_BASE}/ser \
-DMFEM_INC_DIR=${MFEM_SER_INC} \
-DMFEM_LNK_DIR=${MFEM_BASE}/ser/lib \
-DCMAKE_C_COMPILER=${CC} \
-DCMAKE_CXX_COMPILER=${CXX} \
-DCMAKE_INSTALL_RPATH=${MFEM_BASE}/ser/lib \
-DCMAKE_VERBOSE_MAKEFILE=1 \
-DPETRAM_PREFIX=${PREFIX}; \
$(MAKE) VERBOSE=1
cd ext/cmbuild_par; $(CMAKE) .. -DCMAKE_INSTALL_NAME_DIR=${MFEM_BASE}/par/lib \
-DCMAKE_INSTALL_PREFIX=${MFEM_BASE}/par \
-DMFEM_INC_DIR=${MFEM_PAR_INC} \
-DMFEM_LNK_DIR=${MFEM_BASE}/par/lib \
-DMFEM_USE_PARALLEL=1 \
-DMETIS_INC_DIR=${METIS_INC_DIR} \
-DHYPRE_INC_DIR=${HYPRE_INC_DIR} \
-DCMAKE_C_COMPILER=${MPICC} \
-DCMAKE_CXX_COMPILER=${MPICXX} \
-DCMAKE_VERBOSE_MAKEFILE=1 \
-DCMAKE_INSTALL_RPATH=${MFEM_BASE}/par/lib \
-DPETRAM_PREFIX=${PREFIX}; \
$(MAKE) VERBOSE=1
install_ext:
cd ext/cmbuild_ser;$(MAKE) install
cd ext/cmbuild_par;$(MAKE) install
parcxx:
$(MAKE) -C petram/ext/_base/_par cxx MFEM_PAR_INC=${MFEM_PAR_INC} \
PYMFEM_SRC=${PYMFEM_SRC}
sercxx:
$(MAKE) -C petram/ext/_base/_ser cxx MFEM_SER_INC=${MFEM_SER_INC} \
PYMFEM_SRC=${PYMFEM_SRC}
cxx:parcxx sercxx
parso:
$(MAKE) -C petram/ext/_base/_par so MFEM_PAR_INC=${MFEM_PAR_INC}
serso:
$(MAKE) -C petram/ext/_base/_ser so MFEM_SER_INC=${MFEM_SER_INC}
so:parso serso
build_so:parso serso
build_py:
$(PYTHON) setup.py build
install_py:
$(PYTHON) setup.py install --prefix=$(PETRAM)
#
#_ext --inplace
# $(MAKE) -C mfem_ext_sample so
clean_ext:
rm -rf ext/cmbuild_par
rm -rf ext/cmbuild_ser
clean_so:
$(MAKE) -C petram/ext/_base/_ser clean
$(MAKE) -C petram/ext/_base/_par clean
clean_build:
rm -rf build/*
clean:clean_ext clean_so clean_build