Makefile 4.89 KB
Newer Older
thomas.forbriger's avatar
thomas.forbriger committed
1
2
# this is <Makefile>
# ----------------------------------------------------------------------------
thomas.forbriger's avatar
thomas.forbriger committed
3
# $Id: Makefile,v 1.8 2007-07-05 16:26:35 tforb Exp $
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
71
# 
# ============================================================================
thomas.forbriger's avatar
thomas.forbriger committed
72
#
thomas.forbriger's avatar
thomas.forbriger committed
73

thomas.forbriger's avatar
thomas.forbriger committed
74
all: sehefi coma epi chaco sesoc offli sesot merse cooset
thomas.forbriger's avatar
thomas.forbriger committed
75

76
flist: Makefile $(wildcard *.f *.cc)
thomas.forbriger's avatar
thomas.forbriger committed
77
78
79
80
81
82
83
84
85
	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
86
87

F2CLIB=-lf2c -lm -L${SERVERLIBDIR}
88
LIBSFF=-lsff -L$(SERVERLIBDIR)
thomas.forbriger's avatar
thomas.forbriger committed
89
90
91
92
LIBTF=-ltf -L$(LOCLIBDIR)
CC=gcc
CFLAGS=-O2
F2CFLAGS=-f -u
93
94
95
96
CXXFLAGS=-Wall $(FLAGS)
LDFLAGS=-L$(LOCLIBDIR)
CPPFLAGS=-I$(LOCINCLUDEDIR) $(FLAGS)

thomas.forbriger's avatar
thomas.forbriger committed
97
98
99
100
101
102

.f.o:
	f2c $(F2CFLAGS) $<
	gcc $(CFLAGS) $(<:.f=.c) -c -I${SERVERINCLUDEDIR} -I${LOCINCLUDEDIR}
	@rm  $(<:.f=.c)

thomas.forbriger's avatar
thomas.forbriger committed
103
sehefi coma epi chaco sesoc: %: %.o
104
105
106
	$(CC) -o $@ $< $(LIBTF) $(LIBSFF) $(F2CLIB)
	newprog $@

107
108
offli sesot merse: %: %.o
	$(CC) -o $@ $< $(LIBTF) -lsffu -ltime_trad $(LIBSFF) $(F2CLIB)
thomas.forbriger's avatar
thomas.forbriger committed
109
	newprog $@
thomas.forbriger's avatar
thomas.forbriger committed
110

111
112
113
114
115
cooset: %: %.o
	$(CXX) -o $@ $^ -I$(LOCINCLUDEDIR) -lsffxx -ltime++ -lgsexx -laff \
                  -ltfxx -L$(LOCLIBDIR) $(CXXFLAGS) $(FLAGS)
	newprog $@

thomas.forbriger's avatar
thomas.forbriger committed
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#======================================================================
# 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
	/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
138
# ----- END OF Makefile -----