-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
62 lines (46 loc) · 1.63 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
# make for Fortran Streamlines
# Deactivate implicit rules
.SUFFIXES:
# Directories
SRC_DIR = src
COM_DIR = common
BIN_DIR = bin
# List common files (ordered based on dependency)
COMMON_FILES = dislin.f90
COMMON_PATHS = $(addprefix $(COM_DIR)/, $(COMMON_FILES))
# List source files (ordered based on dependency)
SRC_FILES = plot.f90
SRC_PATHS = $(addprefix $(SRC_DIR)/, $(SRC_FILES))
# Main
MAIN_PATH = src/main.f90
# Compiler
COMPILER = gfortran
# Flags
DEBUG_FLAGS = -fbounds-check -fbacktrace -g
DISLIN_FLAGS = -luser32 -lgdi32 -lopengl32
# DISLIN Command
DISLIN_PATH = .\lib\dislin_win\dismg.a
DISLIN_LINUX = -I ./lib/dislin_linux/gf -L ./lib/dislin_linux/ -ldislin
# Program name
PROGRAM = main.exe
# Default make
default:
$(COMPILER) $(FLAGS) -o $(PROGRAM) $(COMMON_PATHS) $(SRC_PATHS) $(MAIN_PATH) $(DISLIN_PATH) $(DISLIN_FLAGS)
# Linux make
linux:
$(COMPILER) $(FLAGS) -o $(PROGRAM) $(COMMON_PATHS) $(SRC_PATHS) $(MAIN_PATH) $(DISLIN_LINUX)
# Debug option
debug:
$(COMPILER) $(FLAGS) $(DEBUG_FLAGS) -o $(PROGRAM) $(COMMON_PATHS) $(SRC_PATHS) $(MAIN_PATH) $(DISLIN_PATH) $(DISLIN_FLAGS)
# Debug with all warnings
wall:
$(COMPILER) $(FLAGS) $(DEBUG_FLAGS) -Wall -o $(PROGRAM) $(COMMON_PATHS) $(SRC_PATHS) $(MAIN_PATH) $(DISLIN_PATH) $(DISLIN_FLAGS)
# Debug with all warnings
debug-serial:
$(COMPILER) $(FLAGS) $(DEBUG_FLAGS) -o $(PROGRAM) $(COMMON_PATHS) $(SRC_PATHS) $(MAIN_PATH) $(DISLIN_PATH) $(DISLIN_FLAGS)
# Serial compilation (without OpenMP)
serial:
$(COMPILER) $(FLAGS) -o $(PROGRAM) $(COMMON_PATHS) $(SRC_PATHS) $(MAIN_PATH) $(DISLIN_PATH) $(DISLIN_FLAGS)
# Cleanup
clean:
rm -rf *.mod *.exe $(SRC_DIR)/*.mod $(COM_DIR)/*.mod