Makefile 4.25 KB
Newer Older
thomas.forbriger's avatar
thomas.forbriger committed
1 2 3 4 5
# this is <Makefile>
# ----------------------------------------------------------------------------
# 
# Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt) 
# 
6
# time series data header manipulation
thomas.forbriger's avatar
thomas.forbriger committed
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
#
# ----
# 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
23 24 25
# 
# REVISIONS and CHANGES 
#    14/03/2002   V1.0   Thomas Forbriger
thomas.forbriger's avatar
thomas.forbriger committed
26
#    05/07/2007   V1.1   prepared for package creation
thomas.forbriger's avatar
thomas.forbriger committed
27
#    13/12/2007   V1.2   g77 is the standard Fortran compiler now
28 29
#    17/01/2011   V1.3   migrated to new SVN scheme
#                        implemented offlix and chacox
30
#    03/03/2012   V1.4   added tijerasxx (damb)
thomas.forbriger's avatar
thomas.forbriger committed
31
#    07/01/2013   V1.5   added sehefixx
32
#    03/01/2014   V1.6   added package rules
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 50 51 52
.PHONY: list-programs
list-programs:
	echo $(PROGRAMS) | tr ' ' '\n' | sort

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

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

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

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

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

thomas.forbriger's avatar
thomas.forbriger committed
75 76 77 78 79 80 81 82 83
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)
84 85 86
LDFLAGS=$(addprefix -L,$(LOCLIBDIR) $(subst :, ,$(SERVERLIBDIR)))
CPPFLAGS=$(addprefix -I,$(LOCINCLUDEDIR) $(subst :, ,$(SERVERINCLUDEDIR))) \
  $(FLAGS)
thomas.forbriger's avatar
thomas.forbriger committed
87 88 89

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

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

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

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

99 100
chacox: %x: %.o
	$(FC) -o $@ $< -ltf \
uqchw's avatar
uqchw committed
101 102
	  -lfapidxx -ldatrwxx -lsffxx -lgsexx -ltime++ -laff \
	  $(LDFLAGS) -L$(LOCLIBDIR)
103

thomas.forbriger's avatar
thomas.forbriger committed
104 105
offlix: %x: %.o
	$(FC) -o $@ $< -ltf -lsffu -ltime_trad \
uqchw's avatar
uqchw committed
106 107
	  -lfapidxx -ldatrwxx -lsffxx -lgsexx -ltime++ -laff \
	  $(LDFLAGS) -L$(LOCLIBDIR)
108

109
cooset sehefixx tijerasxx: %: %.o
110 111
	$(CXX) -o $@ $^ -I$(LOCINCLUDEDIR) -ldatrwxx \
            -lsffxx -ltime++ -lgsexx -laff -ltfxx \
uqchw's avatar
uqchw committed
112
            $(LDFLAGS) $(CXXFLAGS) $(FLAGS) $(LDFLAGS) -L$(LOCLIBDIR)
113 114 115 116 117 118


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

thomas.forbriger's avatar
thomas.forbriger committed
119 120 121
#======================================================================
# create package
# --------------
122 123 124 125 126 127 128 129 130 131 132 133
# 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 $< \
134
	  PACKAGE=tshdwithlibs \
135 136
	  PACKAGEEXPORT="trunk/src/ts/hd:src" \
	  PACKAGETARGETS="src:all" \
uqchw's avatar
uqchw committed
137
	  PACKAGELIBS="libsff libtf libsffu libaff libtime libgsexx libsffxx libdatrwxx libfapidxx libtfxx libtsxx libseife"
138
endif
thomas.forbriger's avatar
thomas.forbriger committed
139

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