Makefile 3.51 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
# 
# REVISIONS and CHANGES 
#    14/03/2002   V1.0   Thomas Forbriger
thomas.forbriger's avatar
thomas.forbriger committed
27
#    05/07/2007   V1.1   prepared for package creation
thomas.forbriger's avatar
thomas.forbriger committed
28
#    13/12/2007   V1.2   g77 is the standard Fortran compiler now
29
30
#    17/01/2011   V1.3   migrated to new SVN scheme
#                        implemented offlix and chacox
31
#    03/03/2012   V1.4   added tijerasxx (damb)
thomas.forbriger's avatar
thomas.forbriger committed
32
#    07/01/2013   V1.5   added sehefixx
thomas.forbriger's avatar
thomas.forbriger committed
33
34
# 
# ============================================================================
thomas.forbriger's avatar
thomas.forbriger committed
35
#
thomas.forbriger's avatar
thomas.forbriger committed
36

37
PROGRAMS=sehefi coma epi chaco sesoc offli sesot merse cooset \
thomas.forbriger's avatar
thomas.forbriger committed
38
	   offlix chacox tijerasxx sehefixx
thomas.forbriger's avatar
thomas.forbriger committed
39

40
41
42
43
44
45
46
47
.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
48
49

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

51
52
TESTCASEMAKE=$(filter-out %.bak,$(wildcard testcases/Makefile*))

uqchw's avatar
uqchw committed
53
flist: Makefile COPYING README $(wildcard *.f *.cc) $(TESTCASEMAKE)
thomas.forbriger's avatar
thomas.forbriger committed
54
55
56
57
58
59
60
61
62
	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
63
	-/bin/rm -vf $(PROGRAMS)
thomas.forbriger's avatar
thomas.forbriger committed
64

thomas.forbriger's avatar
thomas.forbriger committed
65
#----------------------------------------------------------------------
thomas.forbriger's avatar
thomas.forbriger committed
66

thomas.forbriger's avatar
thomas.forbriger committed
67
68
# check mandatory environment variable settings
# ---------------------------------------------
69

thomas.forbriger's avatar
thomas.forbriger committed
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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
85

thomas.forbriger's avatar
thomas.forbriger committed
86
87
88
89
90
91
92
93
94
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
95

96
97
98
99
chacox: %x: %.o
	$(FC) -o $@ $< -ltf \
	  -lfapidxx -ldatrwxx -lsffxx -lgsexx -ltime++ -laff -L$(LOCLIBDIR)

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

thomas.forbriger's avatar
thomas.forbriger committed
104
sehefixx tijerasxx: %: %.o
105
106
107
	$(CXX) -o $@ $^ -I$(LOCINCLUDEDIR) -ldatrwxx \
            -lsffxx -ltime++ -lgsexx -laff -ltfxx \
            -L$(LOCLIBDIR) $(CXXFLAGS) $(FLAGS) $(LDFLAGS)
thomas.forbriger's avatar
thomas.forbriger committed
108
109
110
111
#======================================================================
# create package
# --------------

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