Makefile 3.73 KB
Newer Older
thomas.forbriger's avatar
thomas.forbriger committed
1
2
# this is <Makefile>
# ----------------------------------------------------------------------------
thomas.forbriger's avatar
thomas.forbriger committed
3
# $Id$
thomas.forbriger's avatar
thomas.forbriger committed
4
5
6
7
# 
# Copyright (c) 2007 by Thomas Forbriger (BFO Schiltach) 
# 
# waveform plot programs
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#
# ----
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. 
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
# ----
24
25
26
27
28
29
30
31
32
#
# targets:
#   stuplo:		plot seismogram waveforms
#   splot:		simple spectral analysis (plot amplitude spectrum)
#   susplo:		plot stacked amplitude spectra
#   pamo:		plot particle motion 
#   damplo:		plot spatial decay of wave energy
#
# targets available with libfapidxx interface:
thomas.forbriger's avatar
thomas.forbriger committed
33
#   stuplox, damplox
thomas.forbriger's avatar
thomas.forbriger committed
34
35
36
# 
# REVISIONS and CHANGES 
#    30/01/2007   V1.0   Thomas Forbriger
thomas.forbriger's avatar
thomas.forbriger committed
37
#    07/12/2007   V1.1   default Fortran compiler now is g77
38
#    17/12/2007   V1.2   moved to gfortran
thomas.forbriger's avatar
thomas.forbriger committed
39
40
#    08/10/2010   V1.3   migrate to SVN environment
#                        - discard f2c option
41
42
43
#    13/01/2011   V1.4   - remove polplot from list of standard targets
#                          polplot has never been realized
#                        - add target stuplox
thomas.forbriger's avatar
thomas.forbriger committed
44
45
#                        - damplox was ready to be linked, since it uses
#                          libsffu simple read functions
thomas.forbriger's avatar
thomas.forbriger committed
46
47
# 
# ============================================================================
thomas.forbriger's avatar
thomas.forbriger committed
48
#
thomas.forbriger's avatar
thomas.forbriger committed
49

50
PROGRAMS=damplo pamo splot stuplo susplo stuplox damplox
thomas.forbriger's avatar
thomas.forbriger committed
51

52
53
54
55
.PHONY: all
all: install

.PHONY: install
56
57
58
59
install: $(addprefix $(LOCBINDIR)/,$(PROGRAMS))
$(LOCBINDIR)/%: %
	mkdir -pv $(LOCBINDIR)
	/bin/mv -fv $< $(LOCBINDIR)
thomas.forbriger's avatar
thomas.forbriger committed
60
61
62
63
64
65
66
67

#----------------------------------------------------------------------
# check environment
CHECKVAR=$(if $($(1)),,$(error ERROR: missing variable $(1)))
CHECKVARS=$(foreach var,$(1),$(call CHECKVAR,$(var)))

$(call CHECKVARS,LOCINCLUDEDIR LOCLIBDIR LOCBINDIR)
$(call CHECKVARS,TF_LINK_PGPLOT TF_LINK_FORTRAN)
thomas.forbriger's avatar
thomas.forbriger committed
68

thomas.forbriger's avatar
thomas.forbriger committed
69
PGPLOTLIB=$(TF_LINK_PGPLOT) $(TF_LINK_FORTRAN)
thomas.forbriger's avatar
thomas.forbriger committed
70
71

FLAGS += $(MYFLAGS)
72
CFLAGS += -O2 $(FLAGS)
thomas.forbriger's avatar
thomas.forbriger committed
73

thomas.forbriger's avatar
thomas.forbriger committed
74
75
# use STATIC=-static to produce statically linked binaries
STATIC=
76
77
78
79
80
#CXXFLAGS += -fhonor-std -Wall $(FLAGS)
CXXFLAGS += -Wall $(FLAGS)
LDFLAGS += -L$(LOCLIBDIR) $(STATIC)
CPPFLAGS += -I$(LOCINCLUDEDIR) $(FLAGS)
FFLAGS += -ff2c -Wall -ffixed-line-length-0 -fno-backslash $(FLAGS)
thomas.forbriger's avatar
thomas.forbriger committed
81
82

DIRS=-L$(SERVERLIBDIR) -L$(LOCLIBDIR) -I$(SERVERINCLUDEDIR) -I$(LOCINCLUDEDIR)
thomas.forbriger's avatar
thomas.forbriger committed
83

thomas.forbriger's avatar
thomas.forbriger committed
84
85
#----------------------------------------------------------------------
# standard edit targets
thomas.forbriger's avatar
thomas.forbriger committed
86
87
88
89
90
91
92
93
94
flist: Makefile $(wildcard *.f *.cc)
	echo $^ | tr ' ' '\n' | sort > $@

.PHONY: edit
edit: flist; vim $<

.PHONY: clean
clean: ; 
	-find . -name \*.bak | xargs --no-run-if-empty /bin/rm -v
95
	-/bin/rm -vf flist $(PROGRAMS)
thomas.forbriger's avatar
thomas.forbriger committed
96
	-/bin/rm *.o *.bak *.o77 
thomas.forbriger's avatar
thomas.forbriger committed
97
98
#----------------------------------------------------------------------
# pattern rules
thomas.forbriger's avatar
thomas.forbriger committed
99

thomas.forbriger's avatar
thomas.forbriger committed
100
%.o: %.f
101
	$(FC) -o $@ -c $< $(FFLAGS)
thomas.forbriger's avatar
thomas.forbriger committed
102

thomas.forbriger's avatar
thomas.forbriger committed
103
# targets
thomas.forbriger's avatar
thomas.forbriger committed
104
105
106
107
stuplo splot susplo: %: %.o
	$(FC) $< -o $@ -ltf -lsff $(PGPLOTLIB) -L$(LOCLIBDIR)
pamo damplo: %: %.o
	$(FC) $< -o $@ -ltf -lsffu -ltime -lsff $(PGPLOTLIB) -L$(LOCLIBDIR)
108
109
110
stuplox: %x: %.o
	$(FC) $< -o $@ -ltf $(PGPLOTLIB) -L$(LOCLIBDIR) \
	  -lfapidxx -ldatrwxx -lsffxx -lgsexx -ltime++ -laff
thomas.forbriger's avatar
thomas.forbriger committed
111
112
113
114
damplox: %x: %.o
	$(FC) $< -o $@ -ltf -lsffu -ltime \
	  -lfapidxx -ldatrwxx -lsffxx -lgsexx -ltime++ -laff \
	  $(PGPLOTLIB) -L$(LOCLIBDIR)
thomas.forbriger's avatar
thomas.forbriger committed
115
116
117


# ----- END OF Makefile -----