Makefile 5.25 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#
# 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
#
# 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
66
67
68
# 
# REVISIONS and CHANGES 
#    14/03/2002   V1.0   Thomas Forbriger
thomas.forbriger's avatar
thomas.forbriger committed
69
#    05/07/2007   V1.1   prepared for package creation
thomas.forbriger's avatar
thomas.forbriger committed
70
#    13/12/2007   V1.2   g77 is the standard Fortran compiler now
71
72
#    17/01/2011   V1.3   migrated to new SVN scheme
#                        implemented offlix and chacox
73
#    03/03/2012   V1.4   added tijerasxx (damb)
thomas.forbriger's avatar
thomas.forbriger committed
74
75
# 
# ============================================================================
thomas.forbriger's avatar
thomas.forbriger committed
76
#
thomas.forbriger's avatar
thomas.forbriger committed
77

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

81
82
83
84
85
86
87
88
.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
89
90

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

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

thomas.forbriger's avatar
thomas.forbriger committed
104
#----------------------------------------------------------------------
thomas.forbriger's avatar
thomas.forbriger committed
105

thomas.forbriger's avatar
thomas.forbriger committed
106
107
# check mandatory environment variable settings
# ---------------------------------------------
108

thomas.forbriger's avatar
thomas.forbriger committed
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
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
124

thomas.forbriger's avatar
thomas.forbriger committed
125
126
127
128
129
130
131
132
133
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
134

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

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

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

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