Makefile 3.38 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
33
#
# 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:
#   stuplox
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
# 
# ============================================================================
thomas.forbriger's avatar
thomas.forbriger committed
46
#
thomas.forbriger's avatar
thomas.forbriger committed
47

48
PROGRAMS=damplo pamo splot stuplo susplo
thomas.forbriger's avatar
thomas.forbriger committed
49

thomas.forbriger's avatar
thomas.forbriger committed
50
51
52
53
54
55
56
57
58
all: $(PROGRAMS)

#----------------------------------------------------------------------
# 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
59

thomas.forbriger's avatar
thomas.forbriger committed
60
PGPLOTLIB=$(TF_LINK_PGPLOT) $(TF_LINK_FORTRAN)
thomas.forbriger's avatar
thomas.forbriger committed
61
62

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

thomas.forbriger's avatar
thomas.forbriger committed
65
66
# use STATIC=-static to produce statically linked binaries
STATIC=
67
68
69
70
71
#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
72
73

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

thomas.forbriger's avatar
thomas.forbriger committed
75
76
#----------------------------------------------------------------------
# standard edit targets
thomas.forbriger's avatar
thomas.forbriger committed
77
78
79
80
81
82
83
84
85
86
87
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
	-/bin/rm -vf flist
	-/bin/rm *.o *.bak *.o77 
thomas.forbriger's avatar
thomas.forbriger committed
88
89
#----------------------------------------------------------------------
# pattern rules
thomas.forbriger's avatar
thomas.forbriger committed
90

thomas.forbriger's avatar
thomas.forbriger committed
91
%.o: %.f
92
	$(FC) -o $@ -c $< $(FFLAGS)
thomas.forbriger's avatar
thomas.forbriger committed
93

thomas.forbriger's avatar
thomas.forbriger committed
94
# targets
thomas.forbriger's avatar
thomas.forbriger committed
95
96
97
98
99
100
stuplo splot susplo: %: %.o
	$(FC) $< -o $@ -ltf -lsff $(PGPLOTLIB) -L$(LOCLIBDIR)
	/bin/mv -fv $@ $(LOCBINDIR)
pamo damplo: %: %.o
	$(FC) $< -o $@ -ltf -lsffu -ltime -lsff $(PGPLOTLIB) -L$(LOCLIBDIR)
	/bin/mv -fv $@ $(LOCBINDIR)
101
102
103
104
stuplox: %x: %.o
	$(FC) $< -o $@ -ltf $(PGPLOTLIB) -L$(LOCLIBDIR) \
	  -lfapidxx -ldatrwxx -lsffxx -lgsexx -ltime++ -laff
	/bin/mv -fv $@ $(LOCBINDIR)
thomas.forbriger's avatar
thomas.forbriger committed
105
106
107


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