Makefile 3.81 KB
Newer Older
thomas.forbriger's avatar
publish    
thomas.forbriger committed
1
2
# this is <Makefile>
# ----------------------------------------------------------------------------
thomas.forbriger's avatar
thomas.forbriger committed
3
# $Id$
thomas.forbriger's avatar
publish    
thomas.forbriger committed
4
5
# 
# Copyright (c) 2007 by Thomas Forbriger (BFO Schiltach) 
6
#
thomas.forbriger's avatar
publish    
thomas.forbriger committed
7
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
# ----
# 
# DISplay Fourier Bessel expansion coefficients
24
#
thomas.forbriger's avatar
publish    
thomas.forbriger committed
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# this directory contains the following programs:
#
# grepg:          display Fourier Bessel expansion coefficients
#                 like created by greda or syg
#
# libraries/packages needed to compile the code
# f2c:            Fortran to C converter from netlib
# PGPLOT:         libpgplot.a and g77 version libpgplot77.a
#                 they are called libf2cpgplot52.a and libpgplot52.a here
#                 source code can be obtained from
#                 www.astro.caltech.edu/~tjp/pgplot/
#
# libts:          package containing libts.a
# you can obtain the latter package from where you obtained the present code
# 
# REVISIONS and CHANGES 
#    05/06/2007   V1.0   Thomas Forbriger
thomas.forbriger's avatar
thomas.forbriger committed
42
#    15/09/2008   V1.1   moved to gfortran
43
44
45
46
#    08/10/2010   V1.2   migrate to new SVN environment
#                        discard f2c fallback option
#                        check environment
#                        discard package creation
thomas.forbriger's avatar
thomas.forbriger committed
47
#    15/11/2010   V1.3   replaced incdep by explicite rule
thomas.forbriger's avatar
publish    
thomas.forbriger committed
48
49
50
51
# 
# ============================================================================
#

52
53
54
55
56
57
58
59
60
61
PROGRAMS=grepg

.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
62

63
64
65
66
67
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)
thomas.forbriger's avatar
thomas.forbriger committed
68
69
70
71
72

FORTRANLIB=$(TF_LINK_FORTRAN)

FLAGS += $(MYFLAGS)
CFLAGS += -O2 $(FLAGS)
73
74
75
76
#FFLAGS += -ff2c -Wall -ffixed-line-length-none $(FLAGS) -frecord-marker=4
# setting binary markers to 4 for gfortran 4.1 prevents reading the PGPLOT
# FONT file
FFLAGS += -ff2c -Wall -ffixed-line-length-none $(FLAGS) 
thomas.forbriger's avatar
thomas.forbriger committed
77
78
79
80
81

# use STATIC=-static to produce statically linked binaries
STATIC=
LDFLAGS=-L$(LOCLIBDIR) $(STATIC)
CPPFLAGS=-I$(LOCINCLUDEDIR) $(FLAGS)
thomas.forbriger's avatar
publish    
thomas.forbriger committed
82

83
84
#----------------------------------------------------------------------
# standard edit targets
thomas.forbriger's avatar
publish    
thomas.forbriger committed
85
86
87
88
.PHONY: clean
clean: ; 
	-find . -name \*.bak | xargs --no-run-if-empty /bin/rm -v
	-/bin/rm -vf flist
thomas.forbriger's avatar
thomas.forbriger committed
89
	-/bin/rm -v *.o *.bak *.o77 flist *.f2.o *.d
thomas.forbriger's avatar
publish    
thomas.forbriger committed
90
91
92
93

.PHONY: edit
edit: flist ; vim flist
flist: *.f *.inc Makefile ; echo $^ | tr ' ' '\n' | sort > $@
94
#----------------------------------------------------------------------
95
96

GREBOBS=grepg.o grepg_message.o grepg_dopicks.o grepg_selstyle.o \
97
  grepg_phase.o grepg_phasewedg.o grepg_poly.o grepg_remavg.o \
98
  grepg_contr.o grepg_prepcol.o grepg_readfourier.o grepg_phasor.o
99

thomas.forbriger's avatar
thomas.forbriger committed
100
101
102
%.d: %.f
	echo $<: $(shell cat $< | egrep '^ +include' | cut -f 2 -d \' | sort | uniq) > $@
-include $(patsubst %.o,%.d,$(GREBOBS))
103

104
105
# only the original is in SVN
# so we can change the current dimensions without affecting the SVN
106
107
grepg_ardim.xxx.inc: grepg_ardim.inc; /bin/cp -v $< $@

thomas.forbriger's avatar
thomas.forbriger committed
108
109
%.o: %.f; $(FC) -c -o $@ $< $(FFLAGS)
grepg: $(GREBOBS)
110
	$(FC) $(FFLAGS) $^ -o $@ \
111
        -ltf $(TF_LINK_PGPLOT) $(LDFLAGS)
thomas.forbriger's avatar
publish    
thomas.forbriger committed
112
113

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