-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmakefile
78 lines (57 loc) · 2.01 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
77
78
source = src
obj = ModIntVec.o ModVec.o ModMtrx.o MerTwist.o ModMonte.o ModSparse.o ModAppr.o ModRecon.o Main.o
incfiles = $(wildcard $(source)/incfiles/*.f90)
all: intel
run: intel_run
compiler_intel = ifort
opt_intel = -module ./obj_intel -O3 -xHost -no-wrap-margin
#-static -parallel
obj_intel = $(addprefix obj_intel/, $(obj))
exe_intel = Main.exe
intel_run: intel
@./$(exe_intel)
intel: $(exe_intel)
$(exe_intel): $(obj_intel)
$(compiler_intel) $(opt_intel) -o $(exe_intel) $(obj_intel) -Wl,--start-group ${MKLROOT}/lib/libmkl_intel_lp64.a ${MKLROOT}/lib/libmkl_sequential.a ${MKLROOT}/lib/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl
#-lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl
obj_intel/%.o: $(source)/%.f90
$(compiler_intel) $(opt_intel) -c $< -o $@
$(obj_intel): | obj_intel
obj_intel:
mkdir obj_intel
obj_intel/Main.o: $(source)/Main.f90 $(incfiles)
$(compiler_intel) $(opt_intel) -c $< -o $@
compiler_gnu = gfortran
opt_gnu = -J./obj_gnu -I./obj_gnu -O3 -march=native -Wall -Wno-uninitialized -Wno-unused-function -Wno-unused-dummy-argument -fimplicit-none
#-Ofast -ftree-vectorize -flto=auto -fuse-linker-plugin -floop-parallelize-all
obj_gnu = $(addprefix obj_gnu/, $(obj))
exe_gnu = Main_gnu.exe
gnu_run: gnu
@./$(exe_gnu)
gnu: $(exe_gnu)
obj_gnu/%.o: $(source)/%.f90
$(compiler_gnu) $(opt_gnu) -c $< -o $@
$(exe_gnu): $(obj_gnu)
$(compiler_gnu) $(opt_gnu) -o $(exe_gnu) $(obj_gnu) -llapack -lblas
$(obj_gnu): | obj_gnu
obj_gnu:
mkdir obj_gnu
obj_gnu/Main.o: $(source)/Main.f90 $(incfiles)
$(compiler_gnu) $(opt_gnu) -c $< -o $@
help:
@ echo ""
@ echo "Use 'make gnu' for gfortran (requires BLAS and LAPACK)"
@ echo "then run '$(exe_gnu)'"
@ echo "Or use 'make gnu_run' to compile and run"
@ echo ""
@ echo "Use 'make'/'make intel' for ifort (requires mkl)"
@ echo "then run '$(exe_intel)'"
@ echo "Or use 'make run'/'make intel_run' to compile and run"
@ echo ""
clean: clear
clear:
rm -rf obj_gnu
rm -rf obj_intel
rm -f *.exe
#lib: compile
# @ ar cr ./obj/*.o