Makefile 5.4 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) 2002 by Thomas Forbriger (IMG Frankfurt) 
# 
# SFF header manipulation
thomas.forbriger's avatar
thomas.forbriger committed
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
# ----
thomas.forbriger's avatar
thomas.forbriger committed
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#
# This is a collection of tools that support SFF (Stuttgart File Format)
# header manipulation.
#
# You will find the following targets:
#
# sehefi    sets the fields station, channel, auxid and instype in the WID2
#           lines of an SFF data file to explicite values
# coma      creates a table of equidistant receiver coordinates
# chaco     uses a tabel produced by coma to set receiver and source
#           coordinates in an SFF data file
# cooset    this program sets receiver and source coordinates for global
#           seismic data; receiver coordinates are obtained from a table of
#           seismic stations
# epi       prints a list of receiver offsets contained in an SFF file
# offli     prints a list of receiver offsets contained in an SFF file
#           this program provied different output formats to craete control
#           files for refmet, chaco, or wolle info files
# merse     combines all traces from several different SFF input data files
#           within one single SFF data file (does no waveform stacking); use
#           fidase if you want to manipulate the waveform to and if you want
#           to stack data at identical offsets
# sesoc     set the source coordinate in an SFF data file
# sesot     set the source time in an SFF data file
48
# tijerasxx extract portions of time series (windowing - not tapering)
thomas.forbriger's avatar
thomas.forbriger committed
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#
# To compile this code with the rules given below, you need the f2c compiler
# from Netlib.
#
# To link the programs, you need libraries provided in packages that can be
# downloaded from the place, you obtained this package from. You will need the
# following additional packages:
#
#   libsff        provides libsff.a
#   libtf         provides libtf.a
#   libsffu       provides libsffu.a
#   libtime       provides libtime_trad.a and libtime++.a
#   libgsexx      provides libgsexx.a
#   libsffxx      provides libsffxx.a
#   libtfxx       provides libtfxx.a
#   libaff        provides libaff.a
#
# See README.compile for further information
thomas.forbriger's avatar
thomas.forbriger committed
67
68
69
# 
# REVISIONS and CHANGES 
#    14/03/2002   V1.0   Thomas Forbriger
thomas.forbriger's avatar
thomas.forbriger committed
70
#    05/07/2007   V1.1   prepared for package creation
thomas.forbriger's avatar
thomas.forbriger committed
71
#    13/12/2007   V1.2   g77 is the standard Fortran compiler now
72
73
#    17/01/2011   V1.3   migrated to new SVN scheme
#                        implemented offlix and chacox
74
#    03/03/2012   V1.4   added tijerasxx (damb)
thomas.forbriger's avatar
thomas.forbriger committed
75
76
# 
# ============================================================================
thomas.forbriger's avatar
thomas.forbriger committed
77
#
thomas.forbriger's avatar
thomas.forbriger committed
78

79
PROGRAMS=sehefi coma epi chaco sesoc offli sesot merse cooset \
80
	   offlix chacox tijerasxx
thomas.forbriger's avatar
thomas.forbriger committed
81

82
83
84
85
86
87
88
89
.PHONY: all
all: install

.PHONY: install
install: $(addprefix $(LOCBINDIR)/,$(PROGRAMS))
$(LOCBINDIR)/%: %
	mkdir -pv $(LOCBINDIR)
	/bin/mv -fv $< $(LOCBINDIR)
thomas.forbriger's avatar
thomas.forbriger committed
90
91

#----------------------------------------------------------------------
thomas.forbriger's avatar
thomas.forbriger committed
92

93
94
95
TESTCASEMAKE=$(filter-out %.bak,$(wildcard testcases/Makefile*))

flist: Makefile $(wildcard *.f *.cc) $(TESTCASEMAKE)
thomas.forbriger's avatar
thomas.forbriger committed
96
97
98
99
100
101
102
103
104
	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 *.o
thomas.forbriger's avatar
thomas.forbriger committed
105
	-/bin/rm -vf $(PROGRAMS)
thomas.forbriger's avatar
thomas.forbriger committed
106

thomas.forbriger's avatar
thomas.forbriger committed
107
#----------------------------------------------------------------------
thomas.forbriger's avatar
thomas.forbriger committed
108

thomas.forbriger's avatar
thomas.forbriger committed
109
110
# check mandatory environment variable settings
# ---------------------------------------------
111

thomas.forbriger's avatar
thomas.forbriger committed
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
CHECKVAR=$(if $($(1)),,$(error ERROR: missing variable $(1)))
CHECKVARS=$(foreach var,$(1),$(call CHECKVAR,$(var)))

$(call CHECKVARS,LOCINCLUDEDIR LOCLIBDIR LOCBINDIR)

FLAGS += $(MYFLAGS) -fPIC
FFLAGS += -ff2c -Wall -ffixed-line-length-0 -fno-backslash $(FLAGS)
CFLAGS += $(FLAGS)
CXXFLAGS+=-Wall $(FLAGS)
LDFLAGS+=-L$(LOCLIBDIR)
CPPFLAGS+=-I$(LOCINCLUDEDIR) $(FLAGS)

#----------------------------------------------------------------------

%.o: %.f; $(FC) -o $@ -c $(FCFLAGS) $<
thomas.forbriger's avatar
thomas.forbriger committed
127

thomas.forbriger's avatar
thomas.forbriger committed
128
129
130
131
132
133
134
135
136
sehefi coma epi chaco sesoc: %: %.o
	$(FC) -o $@ $< -ltf -lsff -L$(LOCLIBDIR)

offli sesot merse: %: %.o
	$(FC) -o $@ $< -ltf -lsffu -ltime_trad -lsff -L$(LOCLIBDIR)

cooset: %: %.o
	$(CXX) -o $@ $^ -I$(LOCINCLUDEDIR) -lsffxx -ltime++ -lgsexx -laff \
                  -ltfxx -L$(LOCLIBDIR) $(CXXFLAGS) $(FLAGS)
thomas.forbriger's avatar
thomas.forbriger committed
137

138
139
140
141
chacox: %x: %.o
	$(FC) -o $@ $< -ltf \
	  -lfapidxx -ldatrwxx -lsffxx -lgsexx -ltime++ -laff -L$(LOCLIBDIR)

thomas.forbriger's avatar
thomas.forbriger committed
142
143
144
offlix: %x: %.o
	$(FC) -o $@ $< -ltf -lsffu -ltime_trad \
	  -lfapidxx -ldatrwxx -lsffxx -lgsexx -ltime++ -laff -L$(LOCLIBDIR)
145

146
147
148
149
tijerasxx: %: %.o
	$(CXX) -o $@ $^ -I$(LOCINCLUDEDIR) -ldatrwxx \
            -lsffxx -ltime++ -lgsexx -laff -ltfxx \
            -L$(LOCLIBDIR) $(CXXFLAGS) $(FLAGS) $(LDFLAGS)
thomas.forbriger's avatar
thomas.forbriger committed
150
151
152
153
#======================================================================
# create package
# --------------

thomas.forbriger's avatar
thomas.forbriger committed
154
# ----- END OF Makefile -----