-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.in
81 lines (62 loc) · 2 KB
/
Makefile.in
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
# Template for Athena++ Makefile
# The 'configure.py' python script uses this template to create the actual Makefile
# Files for conditional compilation
PROBLEM_FILE = @PROBLEM_FILE@
COORDINATES_FILE = @COORDINATES_FILE@
EOS_FILE = @EOS_FILE@
RSOLVER_FILE = @RSOLVER_FILE@
RSOLVER_DIR = @RSOLVER_DIR@
MPIFFT_FILE = @MPIFFT_FILE@
# General compiler specifications
CXX := @COMPILER_COMMAND@
CPPFLAGS := @PREPROCESSOR_FLAGS@
CXXFLAGS := @COMPILER_FLAGS@
LDFLAGS := @LINKER_FLAGS@
LDLIBS := @LIBRARY_FLAGS@
# Preliminary definitions
EXE_DIR := bin/
EXECUTABLE := $(EXE_DIR)athena
SRC_FILES := $(wildcard src/*.cpp) \
$(wildcard src/bvals/*.cpp) \
$(wildcard src/coordinates/*.cpp) \
src/eos/$(EOS_FILE) \
$(wildcard src/field/*.cpp) \
$(wildcard src/hydro/*.cpp) \
$(wildcard src/hydro/srcterms/*.cpp) \
$(wildcard src/hydro/hydro_diffusion/*.cpp) \
$(wildcard src/field/field_diffusion/*.cpp) \
src/hydro/rsolvers/$(RSOLVER_DIR)$(RSOLVER_FILE) \
$(wildcard src/mesh/*.cpp) \
$(wildcard src/outputs/*.cpp) \
$(wildcard src/reconstruct/*.cpp) \
$(wildcard src/task_list/*.cpp) \
$(wildcard src/utils/*.cpp) \
$(wildcard src/fft/*.cpp) \
$(wildcard src/multigrid/*.cpp) \
$(wildcard src/gravity/*.cpp) \
$(MPIFFT_FILE) \
src/pgen/$(PROBLEM_FILE) \
src/pgen/default_pgen.cpp
OBJ_DIR := obj/
OBJ_FILES := $(addprefix $(OBJ_DIR),$(notdir $(SRC_FILES:.cpp=.o)))
SRC_DIR := $(dir $(SRC_FILES) $(PROB_FILES))
VPATH := $(SRC_DIR)
# Generally useful targets
.PHONY : all dirs clean
all : dirs $(EXECUTABLE)
objs : dirs $(OBJ_FILES)
dirs : $(EXE_DIR) $(OBJ_DIR)
$(EXE_DIR):
mkdir -p $(EXE_DIR)
$(OBJ_DIR):
mkdir -p $(OBJ_DIR)
# Link objects into executable
$(EXECUTABLE) : $(OBJ_FILES)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ $(OBJ_FILES) $(LDFLAGS) $(LDLIBS)
# Create objects from source files
$(OBJ_DIR)%.o : %.cpp
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
# Cleanup
clean :
rm -rf $(OBJ_DIR)*
rm -rf $(EXECUTABLE)