-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
105 lines (86 loc) · 2.82 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# General variables
NAME:=AlphaAGH
VERSION:= $(shell git rev-parse --short HEAD)
SUBVERSION:=0
PROGRAM:=$(NAME)$(VERSION).$(SUBVERSION)
# Set the default compiler to iFort
FC:=ifort
FFLAGS:=-O3 -DVERS=""commit-$(VERSION)""
# Hello friends,
# If compiling with MKL fails -- or succeeds and running the binary fails --
# try running
# source /opt/intel/composer_xe_2015.3.187/mkl/bin/mklvars.sh intel64
# with the path replace as necessary...
# If -D WEB is specified, stops will be put into AlphaAGH.
# MS Windows
ifeq ($(OS), Windows_NT)
SRCDIR := src/
BUILDDIR :=
TARGETDIR :=
OSFLAG := "OS_WIN"
# TODO: What is the MKL path on Windoze?
MKLROOT := #???
MKLLIB := -L$(MKLROOT)/lib -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread -lm
MKLINC := -I$(MKLROOT)/include
## see also https://software.intel.com/en-us/compiler_winapp_f (2014-12-03)
FFLAGS := $(FFLAGS) /static /fpp /Qmkl /D $(OSFLAG) $(MKLLIB) $(MKLINC)
obj := .obj
MAKEDIR :=
exe := .exe
CC := cl
CFLAGS := /EHsc
DEL := del
else
# Linux or Mac OSX
SRCDIR := src/
BUILDDIR := objs/
TARGETDIR := bin/
obj := .o
OSFLAG := "OS_UNIX"
# TODO: can we make this generic?
MKLROOT := /opt/intel/mkl
# On Eddie
# MKLROOT:=/exports/applications/apps/intel/ClusterStudio2013/mkl
MKLLIB := -L$(MKLROOT)/lib -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread -lm
MKLINC := -I$(MKLROOT)/include
exe :=
FFLAGS:= $(FFLAGS) -mkl -static-intel -fpp -openmp-link=static -module $(BUILDDIR) -D $(OSFLAG) $(MKLLIB) $(MKLINC)
uname := $(shell uname)
MAKEDIR := @mkdir -p
DEL := rm -rf
# Linux only
ifeq ($(uname), Linux)
FFLAGS := $(FFLAGS) -static -static-libgcc -static-libstdc++
endif
endif
# Compile everything
all: directories $(TARGETDIR)$(NAME)$(exe) $(TARGETDIR)AlphaAGH$(exe)
directories:
$(MAKEDIR) $(TARGETDIR)
$(MAKEDIR) $(BUILDDIR)
# Compilation options for debugging
# With warnings about not used variables
debuglong: FFLAGS := $(FFLAGS) -traceback -g -debug all -ftrapuv -fpe0 -warn -check all
debuglong: all
# With memory checks
debug: FFLAGS := $(FFLAGS) -traceback -g -debug all -warn -check bounds -check format \
-check output_conversion -check pointers -check uninit
debug: all
web: FFLAGS := $(FFLAGS) -D "WEB"
web: all
# If binary is made, intermediate files will be binary
binary: FFLAGS := $(FFLAGS) -D "BINARY"
binary: all
# Compile AlphaAGH
$(TARGETDIR)AlphaAGH$(exe): $(SRCDIR)AlphaAGH.f90
@echo "Compiling AlphaAGH..."
$(FC) $(SRCDIR)AlphaAGH.f90 $(FFLAGS) -o $(TARGETDIR)AlphaAGH$(exe)
@echo
# Cleaning
sparklinglyclean: veryclean
$(DEL) TARGETDIR
veryclean: clean
$(DEL) $(TARGETDIR)AlphaAGH$(exe)
clean:
$(DEL) $(BUILDDIR) *$(obj) *.mod *.dwarf *.i90 *__genmod* *~
.PHONY: make veryclean all