Makefile 2.77 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) 2007 by Thomas Forbriger (BFO Schiltach) 
# 
# waveform plot programs
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 
#    30/01/2007   V1.0   Thomas Forbriger
thomas.forbriger's avatar
thomas.forbriger committed
27
#    07/12/2007   V1.1   default Fortran compiler now is g77
28
#    17/12/2007   V1.2   moved to gfortran
thomas.forbriger's avatar
thomas.forbriger committed
29
30
#    08/10/2010   V1.3   migrate to SVN environment
#                        - discard f2c option
thomas.forbriger's avatar
thomas.forbriger committed
31
32
# 
# ============================================================================
thomas.forbriger's avatar
thomas.forbriger committed
33
#
thomas.forbriger's avatar
thomas.forbriger committed
34

thomas.forbriger's avatar
thomas.forbriger committed
35
PROGRAMS=damplo pamo polplot splot stuplo susplo
thomas.forbriger's avatar
thomas.forbriger committed
36

thomas.forbriger's avatar
thomas.forbriger committed
37
38
39
40
41
42
43
44
45
all: $(PROGRAMS)

#----------------------------------------------------------------------
# check environment
CHECKVAR=$(if $($(1)),,$(error ERROR: missing variable $(1)))
CHECKVARS=$(foreach var,$(1),$(call CHECKVAR,$(var)))

$(call CHECKVARS,LOCINCLUDEDIR LOCLIBDIR LOCBINDIR)
$(call CHECKVARS,TF_LINK_PGPLOT TF_LINK_FORTRAN)
thomas.forbriger's avatar
thomas.forbriger committed
46

thomas.forbriger's avatar
thomas.forbriger committed
47
PGPLOTLIB=$(TF_LINK_PGPLOT) $(TF_LINK_FORTRAN)
thomas.forbriger's avatar
thomas.forbriger committed
48
49

FLAGS += $(MYFLAGS)
50
CFLAGS += -O2 $(FLAGS)
thomas.forbriger's avatar
thomas.forbriger committed
51

thomas.forbriger's avatar
thomas.forbriger committed
52
53
# use STATIC=-static to produce statically linked binaries
STATIC=
54
55
56
57
58
#CXXFLAGS += -fhonor-std -Wall $(FLAGS)
CXXFLAGS += -Wall $(FLAGS)
LDFLAGS += -L$(LOCLIBDIR) $(STATIC)
CPPFLAGS += -I$(LOCINCLUDEDIR) $(FLAGS)
FFLAGS += -ff2c -Wall -ffixed-line-length-0 -fno-backslash $(FLAGS)
thomas.forbriger's avatar
thomas.forbriger committed
59
60

DIRS=-L$(SERVERLIBDIR) -L$(LOCLIBDIR) -I$(SERVERINCLUDEDIR) -I$(LOCINCLUDEDIR)
thomas.forbriger's avatar
thomas.forbriger committed
61

thomas.forbriger's avatar
thomas.forbriger committed
62
63
#----------------------------------------------------------------------
# standard edit targets
thomas.forbriger's avatar
thomas.forbriger committed
64
65
66
67
68
69
70
71
72
73
74
flist: Makefile $(wildcard *.f *.cc)
	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
	-/bin/rm *.o *.bak *.o77 
thomas.forbriger's avatar
thomas.forbriger committed
75
76
#----------------------------------------------------------------------
# pattern rules
thomas.forbriger's avatar
thomas.forbriger committed
77

thomas.forbriger's avatar
thomas.forbriger committed
78
%.o: %.f
79
	$(FC) -o $@ -c $< $(FFLAGS)
thomas.forbriger's avatar
thomas.forbriger committed
80

thomas.forbriger's avatar
thomas.forbriger committed
81
# targets
thomas.forbriger's avatar
thomas.forbriger committed
82
83
84
85
86
87
stuplo splot susplo: %: %.o
	$(FC) $< -o $@ -ltf -lsff $(PGPLOTLIB) -L$(LOCLIBDIR)
	/bin/mv -fv $@ $(LOCBINDIR)
pamo damplo: %: %.o
	$(FC) $< -o $@ -ltf -lsffu -ltime -lsff $(PGPLOTLIB) -L$(LOCLIBDIR)
	/bin/mv -fv $@ $(LOCBINDIR)
thomas.forbriger's avatar
thomas.forbriger committed
88
89
90


# ----- END OF Makefile -----