-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.rules
51 lines (43 loc) · 1.38 KB
/
Makefile.rules
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
# vim: set ft=make:
#
AR ?= ar
MPICC ?= mpic++
LOW_PRECISION ?= double
OPTIMIZE ?= -O2 -g -fopenmp -Wall
#Explicitly set C++ standard
OPTIMIZE += -std=gnu++20
GSL_INCL ?= $(shell pkg-config --cflags gsl)
GSL_LIBS ?= $(shell pkg-config --libs gsl)
BOOST_INCL ?=
BOOST_LIBS ?=
ifneq ($(findstring -DUSE_CFITSIO, $(OPT)),)
# If found, set FITSIO_INCL with the cfitsio flags
FITSIO_INCL ?= $(shell pkg-config --cflags cfitsio)
FITSIO_LIBS ?= $(shell pkg-config --libs cfitsio)
endif
ifneq ($(findstring -DUSE_CUDA, $(OPT)),)
CUDA_INCL ?=
CUDA_LIBS ?= -lcudart
NVCC ?= nvcc
NVOPTIMIZE ?= -O3
endif
OPTIONS = $(OPTIMIZE) $(OPT)
GADGET_TESTDATA_ROOT = $(CURDIR)/../
CFLAGS = $(OPTIONS) $(GSL_INCL) $(BOOST_INCL) $(FITSIO_INCL) $(CUDA_INCL)
CFLAGS += -I../depends/include
CFLAGS += -I../
CFLAGS += "-DLOW_PRECISION=$(LOW_PRECISION)"
#For tests
TCFLAGS = $(CFLAGS) -DGADGET_TESTDATA_ROOT=\"$(GADGET_TESTDATA_ROOT)\"
BUNDLEDLIBS = -lbigfile-mpi -lbigfile -lpfft_omp -lfftw3_mpi -lfftw3_omp -lfftw3
LIBS = -lm $(BOOST_LIBS) $(GSL_LIBS) $(FITSIO_LIBS) $(CUDA_LIBS)
LIBS += -L../depends/lib $(BUNDLEDLIBS)
V ?= 0
.objs/%.o: %.c Makefile $(CONFIG)
@cmd="$(MPICC) -MMD -c -o $@ $(CFLAGS) $<"; \
if test "x$(V)" = "x1" ; then echo $$cmd; fi; \
mkdir -p `dirname $@`; \
echo Compiling $<; $$cmd
# Rule to compile .cu files (using nvcc)
.objs/%.o: %.cu
$(NVCC) $(NVOPTIMIZE) -c $< -o $@