forked from tvrusso/SPICE-2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
88 lines (69 loc) · 1.86 KB
/
Makefile
File metadata and controls
88 lines (69 loc) · 1.86 KB
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
CC = gcc
# -----------------------------
# Defaults
# -----------------------------
BUILD ?= debug
COMPILER ?= gfortran
# -----------------------------
# C flags
# -----------------------------
CFLAGS = -Wno-error
ifeq ($(BUILD),debug)
CFLAGS += -g -O0
else
CFLAGS += -O2
endif
# -----------------------------
# Fortran compiler + flags
# -----------------------------
ifeq ($(COMPILER),ifx)
#ifx (prep.: source /opt/intel/oneapi/setvars.sh)
FC = ifx
FFLAGS_COMMON = -i8 -save -nogen-interfaces
ifeq ($(BUILD),debug)
FFLAGS = -g -O0 $(FFLAGS_COMMON) \
-warn all,nointerfaces,noexternals,nounused,nodeclarations \
-debug all -traceback \
# -check uninit
# -check bounds
else
FFLAGS = -O1 $(FFLAGS_COMMON)
endif
else
# -------- gfortran (default) --------
FC = gfortran
FFLAGS_COMMON = -finteger-4-integer-8 -std=legacy -fno-automatic
ifeq ($(BUILD),debug)
FFLAGS = -g -O0 $(FFLAGS_COMMON) \
-Wall -Wextra -Wuninitialized -Wno-argument-mismatch
# -fcheck=all \
# -fbacktrace \
# -ffpe-trap=invalid,zero,overflow \
# -finit-real=snan -finit-integer=-999999
else
FFLAGS = -O1 $(FFLAGS_COMMON) \
-Wno-argument-mismatch
# -fno-strict-aliasing \
# -fno-aggressive-loop-optimizations
endif
endif
# -----------------------------
# Objects & targets
# -----------------------------
OBJS = spice.o unix.o
.PHONY: all debug release clean
all: spice
# Convenience targets
debug:
$(MAKE) BUILD=debug
release:
$(MAKE) BUILD=release
spice: $(OBJS)
$(FC) $(OBJS) -o spice
# $(FC) $(OBJS) -check uninit -o spice
%.o: %.f
$(FC) -c $(FFLAGS) $< -o $@
%.o: %.c
$(CC) -c $(CFLAGS) $< -o $@
clean:
rm -f $(OBJS) spice