Makefile 2.82 KB
Newer Older
1
2
3
4
5
6
7
8
9
# Makefile to build SPINS, generalized for multiple systemd

# The "system.mk" file in the current directory will contain
# system-specific make variables, most notably the
# C/C++ compiler/linker, 
include system.mk


# Compile with debugging flags
10
DEBUG?=false
11
# Compile with optimizations
12
OPTIM?=true
13
14
# Compile with extra optimizations that may require significantly
# longer for compilation
15
SLOW_OPTIM?=false
16

17
18
19
20
21
22
# If MPICXX isn't separately defined, then set it to be the same
# as CXX
ifeq ($(strip $(MPICXX)),)
   MPICXX:=$(CXX)
endif

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Assemble the CFLAGS
CFLAGS:=$(SYSTEM_CFLAGS)
LDFLAGS:=$(SYSTEM_LDFLAGS)
ifeq ($(DEBUG),true)
   CFLAGS:=$(CFLAGS) $(DEBUG_CFLAGS)
   LDFLAGS:=$(LDFLAGS) $(DEBUG_LDFLAGS)
endif
ifeq ($(OPTIM),true)
   CFLAGS:=$(CFLAGS) $(OPTIM_CFLAGS)
   LDFLAGS:=$(LDFLAGS) $(OPTIM_LDFLAGS)
   ifeq ($(SLOW_OPTIM),true)
      CFLAGS:=$(CFLAGS) $(EXTRA_OPTIM_CFLAGS)
      LDFLAGS:=$(LDFLAGS) $(EXTRA_OPTIM_LDFLAGS)
   endif
endif

INCLUDE_DIRS := $(MPI_INCDIR) $(LAPACK_INCDIR) $(BLITZ_INCDIR) $(FFTW_INCDIR) $(UMF_INCDIR) -I../include
CFLAGS := $(CFLAGS) $(INCLUDE_DIRS)

42
LIB_DIRS := $(MPI_LIBDIR) $(LAPACK_LIBDIR) $(BLITZ_LIBDIR) $(FFTW_LIBDIR) $(UMF_LIBDIR) -L../lib
43
44
LDLIBS := $(MPI_LIB) $(LAPACK_LIB) -lfftw3 -lblitz -lm -lstdc++ -lumfpack -lamd
LDFLAGS := $(LDFLAGS) $(LIB_DIRS) 
Christopher Subich's avatar
Christopher Subich committed
45
46
47
48
49
50
51
52
53
54
55
56
57

.PHONY: all 
all: tests/test_deriv_x tests/test_write_x tests/test_esolve_x tests/test_heat_x tests/test_ode_x tests/test_ns_x

.PHONY: clean
clean:
	rm -f *.o tests/*.o cases/*.o

objfiles: $(shell ls *.cpp | sed -e 's/cpp/o/g')

NSIntegrator.o: NSIntegrator.cpp NSIntegrator_impl.cc

tests/test%.o: tests/tests%.cpp
58
	$(MPICXX) $(CFLAGS) -o $@ -c $<
Christopher Subich's avatar
Christopher Subich committed
59
60
61
62
63

tests/test%_x: tests/test%.o TArray.o Parformer.o T_util.o  ESolver.o Timestep.o NSIntegrator.o BaseCase.o Science.o Splits.o Par_util.o Split_reader.o gmres.o gmres_1d_solver.o gmres_2d_solver.o grad.o multigrid.o
	$(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS) 

cases/%.o: cases/%.cpp NSIntegrator_impl.cc NSIntegrator.hpp
64
	$(MPICXX) $(CFLAGS) -o $@ -c  $<
Christopher Subich's avatar
Christopher Subich committed
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79


nonhydro_x: nonhydro_sw.o TArray.o T_util.o Parformer.o Splits.o Par_util.o Split_reader.o 
	$(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)

derek_x: derek.o TArray.o T_util.o Parformer.o ESolver.o Timestep.o Splits.o Par_util.o Split_reader.o gmres.o gmres_1d_solver.o gmres_2d_solver.o grad.o multigrid.o 
	$(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)

cases/%.x: cases/%.o TArray.o T_util.o Parformer.o ESolver.o Timestep.o NSIntegrator.o BaseCase.o Science.o Splits.o Par_util.o Split_reader.o gmres.o gmres_1d_solver.o gmres_2d_solver.o grad.o multigrid.o
	$(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)

cases/%_x: cases/%.o TArray.o T_util.o Parformer.o ESolver.o Timestep.o NSIntegrator.o BaseCase.o Science.o Splits.o Par_util.o Split_reader.o gmres.o gmres_1d_solver.o gmres_2d_solver.o grad.o multigrid.o
	$(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)

%.o : %.cpp	*.hpp
80
	$(MPICXX) $(CFLAGS) -o $@ -c $< 
Christopher Subich's avatar
Christopher Subich committed
81