-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
58 lines (39 loc) · 1.77 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
DEBUG =
ifeq (,$(DEBUG))
CXXFLAGS = -std=c++11 -g -O3 -ffast-math -fopenmp -fdata-sections -ffunction-sections
CXXFLAGS = -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE
F90FLAGS = -g -O3 -ffast-math -fopenmp -Jobj/ -ffree-line-length-none -fdata-sections -ffunction-sections
FCFLAGS = -g -O3 -ffast-math -Iinclude/ -fdata-sections -ffunction-sections
LDFLAGS = -Xcompiler=-fopenmp -Xlinker=--gc-sections
NVCCFLAGS = -std=c++11 -g -O3 -Xcompiler=-ffast-math -Xcompiler=-fopenmp -Iinclude/ -Xcompiler=-fdata-sections -Xcompiler=-ffunction-sections
else
CXXFLAGS = -std=c++11 -g -O0
F90FLAGS = -g -O0 -Jobj/ -ffree-line-length-none
FCFLAGS = -g -O0 -Iinclude/
LDFLAGS =
NVCCFLAGS = -std=c++11 -g -O0 -G -Iinclude/
endif
GPUARCH += -gencode=arch=compute_35,code=sm_35 # Kepler GK110 CC 3.5
GPUARCH += -gencode=arch=compute_61,code=sm_61 # Pascal GP106 CC 6.1
.SUFFIXES: .cpp .f .f90 .cu .cpp.o .f.o .f90.o .cu.o
all: bin/phase_track
SRCS := $(wildcard src/*.cpp) $(wildcard src/*.f) $(wildcard src/*.f90) $(wildcard src/*.cu)
OBJS := $(addsuffix .o, $(patsubst src/%,obj/%,$(SRCS)))
bin/phase_track: $(OBJS)
mkdir -p bin && nvcc $(LDFLAGS) $^ -o $@ -lgfortran -lpgplot
obj/DE_Fortran90.f90.o: obj/param.f90.o
obj/math_lib.f90.o: obj/lib_array.f90.o
obj/module10.f90.o: obj/ftn.f90.o obj/lib_array.f90.o obj/math_lib.f90.o obj/param.f90.o obj/plot_module.f90.o obj/utilmod.f90.o
obj/phase.f90.o: obj/module10.f90.o
obj/read_driv.f90.o: obj/param.f90.o
obj/utilmod.f90.o: obj/param.f90.o
obj/%.cpp.o: src/%.cpp
mkdir -p obj && g++ $(CXXFLAGS) -c $< -o $@
obj/%.f90.o: src/%.f90
mkdir -p obj && gfortran $(F90FLAGS) -c $< -o $@
obj/%.f.o: src/%.f
mkdir -p obj && gfortran $(FCFLAGS) -c $< -o $@
obj/%.cu.o: src/%.cu
mkdir -p obj && nvcc $(GPUARCH) $(NVCCFLAGS) -c $< -o $@
clean:
rm -rf bin obj