forked from QuentinBrissaud/RW_atmos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
106 lines (82 loc) · 2.05 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
# Makefile for surface wave software
# gram: $(obj)
# gfortran $(obj) -O -o gram -L./grx -lgrx -lX11 \ -ffixed-line-length-none
# -lm /usr/local/sac2000/sunos/lib/libsac_old.a
#
#
EARTHSR = earthsr
SRGRAMF = srgramf
DSRGRAMF = dsrgramf
READ_EARTH = read_earth
#EXEC = $(EARTHSR) $(SRGRAMF) $(READ_EARTH) $(DSRGRAMF)
EXEC = $(EARTHSR)
DEFINC = -Iinclude
SACLIB = /usr/local/sac/lib/libsacio.a
BINDIR = ./bin
# Use gcc compiler
CC = gcc
# Fortran
FF = gfortran
FC = gfortran
FCOMP = gfortran
BITTYPE = -m64
CHKBNDS = -fbounds-check
FFLAGS = -ffixed-line-length-none -fdollar-ok $(BITTYPE) $(CHKBNDS) -O3
ARCH = $(shell uname).m64
all: $(EXEC)
# Subroutines for EARTHSR
FSRCA= earthsr.f \
earthsubs.f \
peripheral.f \
char_int.f
# Subroutines for SRGRAMF
FSRCB= srgramf.f \
mkhomogsrf.f \
fftl.f \
out_sac.f \
char_int.f \
udc.f \
srcget.f \
nchar.f \
minmax.f \
parseprogs_mac.f
# Subroutines for DSRGRAMF
FSRCC= dsrgramf.f \
mkhomogsrf.f \
fftl.f \
out_sac.f \
char_int.f \
udc.f \
srcget.f \
nchar.f \
minmax.f \
parseprogs_mac.f
FOBJS = $(FSRCS:%.f=$(ARCH)/%.o)
FOBJA = $(FSRCA:%.f=$(ARCH)/%.o)
FOBJG = $(FSRCG:%.f=$(ARCH)/%.o)
FOBJR = $(FSRCR:%.f=$(ARCH)/%.o)
FOBJB = $(FSRCB:%.f=$(ARCH)/%.o)
FOBJC = $(FSRCC:%.f=$(ARCH)/%.o)
$(EARTHSR):: $(FOBJA)
$(FF) $(FOBJA) $(FFLAGS) $(DEFINC) -o ${BINDIR}/$(EARTHSR) $(BITTYPE)
$(SRGRAMF):: $(FOBJB)
$(FF) $(FOBJB) $(FFLAGS) $(SACLIB) $(DEFINC) -o ${BINDIR}/$(SRGRAMF) $(BITTYPE)
$(DSRGRAMF):: $(FOBJC)
$(FF) $(FOBJC) $(FFLAGS) $(SACLIB) $(DEFINC) -o ${BINDIR}/$(DSRGRAMF) $(BITTYPE)
$(ARCH)/%.o: %.c
$(CC) $(CFLAGS) $(DEFINC) -c $(@F:.o=.c) -o $@ $(BITTYPE)
$(ARCH)/%.o: %.f
$(FF) $(FFLAGS) $(DEFINC) -c $(@F:.o=.f) -o $@ $(BITTYPE)
clean:
@$(RM) $(ARCH)/*.o ${BINDIR}/$(EXEC) *~ *.o
install:
@if [ ! -d ${BINDIR} ] ; then \
mkdir ${BINDIR}; fi
@if [ ! -d ${ARCH} ] ; then \
mkdir ${ARCH}; fi
@for i in ${EXEC}; do \
if [ -f $$i ] ; then \
echo "Moving $$i to ${BINDIR}"; \
mv $$i ${BINDIR}; \
fi; \
done