forked from kfrancischen/MESH
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.comet
executable file
·82 lines (61 loc) · 2.72 KB
/
Makefile.comet
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
OBJDIR = build
SHLIB_EXT = so
SHLIB_FLAGS = -fPIC -shared
CFLAGS += -O3 -Wall -march=native -fcx-limited-range -fPIC -fopenmp
CXXFLAGS += -std=c++11 -O3 -Wall -march=native -fcx-limited-range -fPIC -fopenmp
MKL_INC = -I$(MKL_ROOT)/include
LA_LIBS = -L$(MKL_ROOT)/lib/intel64 -lmkl_intel_lp64 -lmkl_gnu_thread -lmkl_core -lpthread -lm
LUA_INC = -I../lua/install/include
LUA_LIB = -L../lua/install/lib -llua -ldl -lm
#### change to proper compilers
CC = gcc
CXX = g++
#### change to proper MPI compilers
MPICC = mpicc
MPICXX = mpicxx
CPPFLAGS += -Isrc/
ARMAFLAG = -Isrc/arma -DARMA_DONT_USE_WRAPPER -DARMA_NO_DEBUG
#### Compilation targets
MESH_LIBNAME = libmesh.a
all: $(OBJDIR)/$(MESH_LIBNAME) $(OBJDIR)/mesh $(OBJDIR)/meshMPI
objdir:
mkdir -p $(OBJDIR)
mkdir -p $(OBJDIR)/MESH_o
MESH_LIBOBJS = \
$(OBJDIR)/MESH_o/Rcwa.o \
$(OBJDIR)/MESH_o/Gsel.o \
$(OBJDIR)/MESH_o/Cubature.o \
$(OBJDIR)/MESH_o/System.o \
$(OBJDIR)/MESH_o/Fmm.o \
$(OBJDIR)/MESH_o/Mesh.o
$(OBJDIR)/libmesh.a: objdir $(MESH_LIBOBJS)
$(AR) crvs $@ $(MESH_LIBOBJS)
$(OBJDIR)/MESH_o/Rcwa.o: src/Rcwa.cpp
$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $(ARMAFLAG) $< -o $@
$(OBJDIR)/MESH_o/Gsel.o: src/Gsel.cpp
$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $(ARMAFLAG) $< -o $@
$(OBJDIR)/MESH_o/Cubature.o: src/Cubature.c
$(CC) -c $(CFLAGS) $(CPPFLAGS) $(ARMAFLAG) $< -o $@
$(OBJDIR)/MESH_o/System.o: src/System.cpp
$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $(ARMAFLAG) $< -o $@
$(OBJDIR)/MESH_o/Fmm.o: src/Fmm.cpp
$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $(ARMAFLAG) $< -o $@
$(OBJDIR)/MESH_o/Mesh.o: src/Mesh.cpp
$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $(ARMAFLAG) $< -o $@
#### Build Lua frontend
$(OBJDIR)/MESH_o/main_lua.o: src/main_lua.cpp objdir
$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $(LUA_INC) $(ARMAFLAG) $(MKL_INC) $< -o $@ $(LA_LIBS)
$(OBJDIR)/mesh: $(OBJDIR)/MESH_o/main_lua.o $(OBJDIR)/$(MESH_LIBNAME)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(ARMAFLAG) $(MKL_INC) $< -o $@ -L$(OBJDIR) -lmesh $(LA_LIBS) $(LUA_LIB)
### Build lua MPI frontend
$(OBJDIR)/MESH_o/buffer_mpi.o: src/luawrapper/buffer_mpi.c objdir
$(MPICC) -c -DHAVE_MPI $(CFLAGS) $(CPPFLAGS) $(LUA_INC) $(ARMAFLAG) $(MKL_INC) $< -o $@ $(LA_LIBS)
$(OBJDIR)/MESH_o/lua_mpi.o: src/luawrapper/lua_mpi.c src/luawrapper/funcs_mpi.c objdir
$(MPICC) -c -DHAVE_MPI $(CFLAGS) $(CPPFLAGS) $(LUA_INC) $(ARMAFLAG) $(MKL_INC) $< -o $@ $(LA_LIBS)
$(OBJDIR)/MESH_o/main_lua_mpi.o: src/main_lua.cpp objdir
$(MPICXX) -c -DHAVE_MPI $(CXXFLAGS) $(CPPFLAGS) $(LUA_INC) $(ARMAFLAG) $(MKL_INC) $< -o $@ $(LA_LIBS)
$(OBJDIR)/meshMPI: $(OBJDIR)/MESH_o/main_lua_mpi.o $(OBJDIR)/MESH_o/lua_mpi.o $(OBJDIR)/MESH_o/buffer_mpi.o $(OBJDIR)/$(MESH_LIBNAME)
$(MPICXX) $(CXXFLAGS) $(CPPFLAGS) $(ARMAFLAG) $(MKL_INC) $< -o $@ -L$(OBJDIR) -lmesh $(LA_LIBS) $(LUA_LIB)
clean:
rm -rf $(OBJDIR)
always: