Makefile 4.39 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
# 
# Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt) 
# 
7
# time series data 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
33
#    03/01/2014   V1.6   added package rules
thomas.forbriger's avatar
thomas.forbriger committed
34
35
# 
# ============================================================================
thomas.forbriger's avatar
thomas.forbriger committed
36
#
thomas.forbriger's avatar
thomas.forbriger committed
37

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

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

50
51
52
53
.PHONY: list-programs
list-programs:
	echo $(PROGRAMS) | tr ' ' '\n' | sort

thomas.forbriger's avatar
thomas.forbriger committed
54
#----------------------------------------------------------------------
thomas.forbriger's avatar
thomas.forbriger committed
55

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

58
59
flist: Makefile COPYING README $(wildcard *.f *.cc) $(TESTCASEMAKE) \
  $(TF_EDIT)
thomas.forbriger's avatar
thomas.forbriger committed
60
61
62
63
64
65
66
67
68
	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
69
	-/bin/rm -vf $(PROGRAMS)
thomas.forbriger's avatar
thomas.forbriger committed
70

thomas.forbriger's avatar
thomas.forbriger committed
71
#----------------------------------------------------------------------
thomas.forbriger's avatar
thomas.forbriger committed
72

thomas.forbriger's avatar
thomas.forbriger committed
73
74
# check mandatory environment variable settings
# ---------------------------------------------
75

thomas.forbriger's avatar
thomas.forbriger committed
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)
85
86
LDFLAGS+=-L$(SERVERLIBDIR) -L$(LOCLIBDIR)  
CPPFLAGS+=-I$(SERVERINCLUDEDIR) -I$(LOCINCLUDEDIR) $(FLAGS) 
thomas.forbriger's avatar
thomas.forbriger committed
87
88
89
90

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

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

thomas.forbriger's avatar
thomas.forbriger committed
92
sehefi coma epi chaco sesoc: %: %.o
93
	$(FC) -o $@ $< -ltf -lsff -L$(SERVERLIBDIR) -L$(LOCLIBDIR)
thomas.forbriger's avatar
thomas.forbriger committed
94
95

offli sesot merse: %: %.o
96
97
	$(FC) -o $@ $< -ltf -lsffu -ltime_trad -lsff\
	  -L$(SERVERLIBDIR) -L$(LOCLIBDIR)
thomas.forbriger's avatar
thomas.forbriger committed
98
99
100

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

103
104
chacox: %x: %.o
	$(FC) -o $@ $< -ltf \
105
106
	  -lfapidxx -ldatrwxx -lsffxx -lgsexx -ltime++ -laff\
	  -L$(SERVERLIBDIR) -L$(LOCLIBDIR)
107

thomas.forbriger's avatar
thomas.forbriger committed
108
109
offlix: %x: %.o
	$(FC) -o $@ $< -ltf -lsffu -ltime_trad \
110
111
	  -lfapidxx -ldatrwxx -lsffxx -lgsexx -ltime++ -laff\
	  -L$(SERVERLIBDIR) -L$(LOCLIBDIR)
112

thomas.forbriger's avatar
thomas.forbriger committed
113
sehefixx tijerasxx: %: %.o
114
115
	$(CXX) -o $@ $^ -I$(LOCINCLUDEDIR) -ldatrwxx \
            -lsffxx -ltime++ -lgsexx -laff -ltfxx \
116
            -L$(SERVERLIBDIR) -L$(LOCLIBDIR) $(CXXFLAGS) $(FLAGS) $(LDFLAGS)
117
118
119
120
121
122


.PHONY: list-libraries
list-libraries:
	grep ' -l' Makefile | tr ' ' '\n' | egrep '^-l' | sort | uniq

thomas.forbriger's avatar
thomas.forbriger committed
123
124
125
#======================================================================
# create package
# --------------
126
127
128
129
130
131
132
133
134
135
136
137
# is delegated to Makefile.packages
ifdef TF_MAKEPKG
.PHONY: package
package: $(TF_MAKEPKG)
	$(MAKE) -f $< \
	  PACKAGE=tshd \
	  PACKAGEEXPORT="trunk/src/ts/hd:src" \
	  PACKAGETARGETS="src:all" \
	  PACKAGELIBS="-"
.PHONY: fullpackage
fullpackage: $(TF_MAKEPKG)
	$(MAKE) -f $< \
138
	  PACKAGE=tshdwithlibs \
139
140
141
142
	  PACKAGEEXPORT="trunk/src/ts/hd:src" \
	  PACKAGETARGETS="src:all" \
	  PACKAGELIBS="libsff libtf libsffu libaff libtime libgsexx libsffxx libdatrwxx libfapidxx libtfxx"
endif
thomas.forbriger's avatar
thomas.forbriger committed
143

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