forked from darrencroton/sage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
76 lines (61 loc) · 2.2 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
EXEC = sage
OBJS = ./code/main.o \
./code/core_read_parameter_file.o \
./code/core_init.o \
./code/core_io_tree.o \
./code/core_cool_func.o \
./code/core_build_model.o \
./code/core_save.o \
./code/core_mymalloc.o \
./code/core_allvars.o \
./code/model_infall.o \
./code/model_cooling_heating.o \
./code/model_starformation_and_feedback.o \
./code/model_disk_instability.o \
./code/model_reincorporation.o \
./code/model_mergers.o \
./code/model_misc.o \
./code/model_trackBHgrowth.o \
./code/model_quasars.o \
./code/model_BHaccretion.o
INCL = ./code/core_allvars.h \
./code/core_proto.h \
./code/core_simulation.h \
./Makefile
# USE-MPI = yes # set this if you want to run in embarrassingly parallel
# OPT += -DDEBUG
ifdef USE-MPI
OPT += -DMPI # This creates an MPI version that can be used to process files in parallel
CC = mpicc # sets the C-compiler
else
CC = cc # sets the C-compiler
endif
# GSL automatic detection
GSL_FOUND := $(shell gsl-config --version 2>/dev/null)
ifndef GSL_FOUND
$(warning GSL not found in path - please install GSL before installing SAGE (or, update the PATH environment variable such that "gsl-config" is found))
# if the automatic detection fails, set GSL_DIR appropriately
GSL_DIR := /opt/local
GSL_INCL := -I$(GSL_DIR)/include
GSL_LIBDIR := $(GSL_DIR)/lib
# since GSL is not in PATH, the runtime environment might not be setup correctly either
# therefore, adding the compiletime library path is even more important (the -Xlinker bit)
GSL_LIBS := -L$(GSL_LIBDIR) -lgsl -lgslcblas -Xlinker -rpath -Xlinker $(GSL_LIBDIR)
else
# GSL is probably configured correctly, pick up the locations automatically
GSL_INCL := $(shell gsl-config --cflags)
GSL_LIBDIR := $(shell gsl-config --prefix)/lib
GSL_LIBS := $(shell gsl-config --libs) -Xlinker -rpath -Xlinker $(GSL_LIBDIR)
endif
OPTIMIZE = -g -O0 -Wall # optimization and warning flags
LIBS = -g -lm $(GSL_LIBS)
CFLAGS = $(OPTIONS) $(OPT) $(OPTIMIZE) $(GSL_INCL)
default: all
$(EXEC): $(OBJS)
$(CC) $(OPTIMIZE) $(OBJS) $(LIBS) -o $(EXEC)
$(OBJS): $(INCL)
clean:
rm -f $(OBJS)
tidy:
rm -f $(OBJS) ./$(EXEC)
all: tidy $(EXEC) clean