-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile-resp-static
32 lines (25 loc) · 953 Bytes
/
Makefile-resp-static
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
# Fortran compiler. Only gfortran, specifically its invocation through gcc,
# correctly produces a static link on all tested platforms.
FC = $(or $(RESP_COMPILER),gcc)
FLAGS = -c -O2 -v
# -mcmodel=medium
# option for gfortran
# allows handling of a larger number of MEP on 64 bit system
# FLAGS = -c -mcmodel=medium -O2
OBJS= resp.o
SRCS= resp.f
LIB= shared_variables.h
# A trick to statically link selected libraries, which works on macOS, since
# the -Wl,Bstatic/dynamic and -l:libgfortran.a approaches only work with the
# GNU `ld`. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46539#c3
# and https://stackoverflow.com/a/5583245
vpath %.a $(RESP_VPATH)
.LIBPATTERNS = lib%.a lib%.dylib lib%.so
STATICLIBS = -lgfortran -lquadmath
resp: $(OBJS) $(STATICLIBS)
# -lm is needed on Linux per https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46539#c3
$(FC) $^ -lm -o resp
$(OBJS): $(SRCS) $(LIB)
$(FC) $(FLAGS) $(SRCS)
clean:
rm -rf $(OBJS) resp