Makefile 5.79 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
thomas.forbriger's avatar
thomas.forbriger committed
71
72
# 
# ============================================================================
thomas.forbriger's avatar
thomas.forbriger committed
73
#
thomas.forbriger's avatar
thomas.forbriger committed
74
75
76
77
#  NOTICE: fallback solution (f2c is default) can be activated by the
#          environment variable TF_FALLBACK
#          This option will disappear somewhere in the future!
#
thomas.forbriger's avatar
thomas.forbriger committed
78

thomas.forbriger's avatar
thomas.forbriger committed
79
80
all: install
install: sehefi coma epi chaco sesoc offli sesot merse cooset
thomas.forbriger's avatar
thomas.forbriger committed
81

82
flist: Makefile $(wildcard *.f *.cc)
thomas.forbriger's avatar
thomas.forbriger committed
83
84
85
86
87
88
89
90
91
	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
92

thomas.forbriger's avatar
thomas.forbriger committed
93
FLAGS += $(MYFLAGS)
thomas.forbriger's avatar
thomas.forbriger committed
94
F2CLIB=-lf2c -lm -L${SERVERLIBDIR}
thomas.forbriger's avatar
thomas.forbriger committed
95
G2CLIB=-lg2c -lm -L${SERVERLIBDIR}
thomas.forbriger's avatar
thomas.forbriger committed
96
F2CFLAGS=-f -u
97
FCFLAGS=-Wall -ff2c -ffixed-line-length-0 -fno-backslash $(FLAGS)
thomas.forbriger's avatar
thomas.forbriger committed
98
CFLAGS=-O3 -I${SERVERINCLUDEDIR} -I${LOCINCLUDEDIR} $(FLAGS)
99
CXXFLAGS=-Wall $(FLAGS)
thomas.forbriger's avatar
thomas.forbriger committed
100
LDFLAGS=-L$(LOCLIBDIR) $(FLAGS)
101
102
CPPFLAGS=-I$(LOCINCLUDEDIR) $(FLAGS)

thomas.forbriger's avatar
thomas.forbriger committed
103
ifeq ($(TF_FALLBACK),yes)
thomas.forbriger's avatar
thomas.forbriger committed
104
105
106
107
.f.o:
	f2c $(F2CFLAGS) $<
	gcc $(CFLAGS) $(<:.f=.c) -c -I${SERVERINCLUDEDIR} -I${LOCINCLUDEDIR}
	@rm  $(<:.f=.c)
thomas.forbriger's avatar
thomas.forbriger committed
108
109
110
else
%.o: %.f; $(FC) -o $@ -c $(FCFLAGS) $<
endif
thomas.forbriger's avatar
thomas.forbriger committed
111

thomas.forbriger's avatar
thomas.forbriger committed
112
ifeq ($(TF_FALLBACK),yes)
thomas.forbriger's avatar
thomas.forbriger committed
113
sehefi coma epi chaco sesoc: %: %.o
thomas.forbriger's avatar
thomas.forbriger committed
114
115
	$(CC) -o $@ $< -ltf -lsff $(F2CLIB)
	/bin/mv -fv $@
116

117
offli sesot merse: %: %.o
thomas.forbriger's avatar
thomas.forbriger committed
118
119
	$(CC) -o $@ $< -ltf -lsffu -ltime_trad -lsff $(F2CLIB)
	/bin/mv -fv $@
thomas.forbriger's avatar
thomas.forbriger committed
120

121
122
123
cooset: %: %.o
	$(CXX) -o $@ $^ -I$(LOCINCLUDEDIR) -lsffxx -ltime++ -lgsexx -laff \
                  -ltfxx -L$(LOCLIBDIR) $(CXXFLAGS) $(FLAGS)
thomas.forbriger's avatar
thomas.forbriger committed
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
	/bin/mv -fv $@
else
sehefi coma epi chaco sesoc: %: %.o
	$(FC) -o $@ $< -ltf -lsff -L$(LOCLIBDIR)
	/bin/mv -fv $@ $(LOCBINDIR)

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

cooset: %: %.o
	$(CXX) -o $@ $^ -I$(LOCINCLUDEDIR) -lsffxx -ltime++ -lgsexx -laff \
                  -ltfxx -L$(LOCLIBDIR) $(CXXFLAGS) $(FLAGS)
	/bin/mv -fv $@ $(LOCBINDIR)
endif
139

thomas.forbriger's avatar
thomas.forbriger committed
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#======================================================================
# create package
# --------------
VERSIONCODE=$(shell date +'%Y%m%d')
PACKAGE=sffutilhd$(VERSIONCODE)
PUBLICATIONPATH=$(HOME)/public_html/download/software
TMPPATH=$(HOME)/tmp/$(PACKAGE)
package:
	/bin/rm -rfv $(TMPPATH); mkdir -pv $(TMPPATH)
	cd $(TMPPATH)/..; cvs export -l -r HEAD \
        -d $(PACKAGE) thof/src/conv/sff
	cd $(TMPPATH)/..; cvs export -r HEAD -d $(PACKAGE) thof/src/LICENSE.GPL
	cd $(TMPPATH)/..; cvs export -r HEAD \
        -d $(PACKAGE) thof/src/README.compile
thomas.forbriger's avatar
thomas.forbriger committed
154
155
	cd $(TMPPATH)/..; cvs export -r HEAD \
        -d $(PACKAGE) thof/src/README.1st
thomas.forbriger's avatar
thomas.forbriger committed
156
157
158
159
160
161
162
163
	/bin/bash -c 'cd $(TMPPATH); \
        export LOCBINDIR=bin; mkdir -v bin; \
        make all; make clean'
	cd $(TMPPATH)/..; tar cvf $(PUBLICATIONPATH)/$(PACKAGE).tar $(PACKAGE)
	gzip --force -9 $(PUBLICATIONPATH)/$(PACKAGE).tar
	cd $(TMPPATH)/..; tar cvf $(PUBLICATIONPATH)/$(PACKAGE).tar $(PACKAGE)
	bzip2 -f $(PUBLICATIONPATH)/$(PACKAGE).tar

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