Makefile 5.13 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: Makefile,v 1.10 2008-09-15 15:17:01 tforb Exp $
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
42
43
# this directory contains the following programs:
#
# grepg:          display Fourier Bessel expansion coefficients
#                 like created by greda or syg
# grepg77:        second make target linked againts g77 version of
#                 PGPLOT which may contain additional drivers (e.g.GIF)
#
# 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
44
#    15/09/2008   V1.1   moved to gfortran
thomas.forbriger's avatar
publish    
thomas.forbriger committed
45
46
47
# 
# ============================================================================
#
thomas.forbriger's avatar
thomas.forbriger committed
48
49
50
#  NOTICE: fallback solution (f2c is default) can be activated by the
#          environment variable TF_FALLBACK
#          This option will disappear somewhere in the future!
thomas.forbriger's avatar
publish    
thomas.forbriger committed
51

thomas.forbriger's avatar
thomas.forbriger committed
52
ifeq ($(TF_FALLBACK),yes)
thomas.forbriger's avatar
publish    
thomas.forbriger committed
53
all: grepg grepg77
thomas.forbriger's avatar
thomas.forbriger committed
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
else
all: grepg
endif

F2CLIB=-lf2c -lm -L${SERVERLIBDIR}
F2CFLAGS=-f -u

PGPLOTF2CLIB=-l$(TF_f2c_PGPLOT) $(TF_LINK_PGPLOT)
PGPLOT77LIB=-l$(TF_g77_PGPLOT) $(TF_LINK_PGPLOT)
FORTRANLIB=$(TF_LINK_FORTRAN)

FLAGS += $(MYFLAGS)
CFLAGS += -O2 $(FLAGS)
FFLAGS += -ff2c -Wall -ffixed-line-length-none $(FLAGS)

# use STATIC=-static to produce statically linked binaries
STATIC=
CXXFLAGS=-fhonor-std -Wall $(FLAGS)
CXXFLAGS=-Wall $(FLAGS)
LDFLAGS=-L$(LOCLIBDIR) $(STATIC)
CPPFLAGS=-I$(LOCINCLUDEDIR) $(FLAGS)
thomas.forbriger's avatar
publish    
thomas.forbriger committed
75
76
77
78
79

.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
80
	-/bin/rm -v *.o *.bak *.o77 flist *.f2.o
thomas.forbriger's avatar
publish    
thomas.forbriger committed
81
82
83
84

.PHONY: edit
edit: flist ; vim flist
flist: *.f *.inc Makefile ; echo $^ | tr ' ' '\n' | sort > $@
85

thomas.forbriger's avatar
thomas.forbriger committed
86
ifeq ($(TF_FALLBACK),yes)
87
88
89
90
91
92
F2CLIB=-lf2c -lm -L${SERVERLIBDIR}
PGPLOTLIB=-lf2cpgplot52 -lX11 -L/usr/X11/lib -L$(SERVERLIBDIR)
#PGPLOTLIB=-lpg -lgrx20 
#CC=gcc
F2CFLAGS=-f -u
CFLAGS=-O2
thomas.forbriger's avatar
thomas.forbriger committed
93
endif
94
95

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

make.incdep: *.f
	incdep > make.incdep

include make.incdep

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

thomas.forbriger's avatar
thomas.forbriger committed
108
ifeq ($(TF_FALLBACK),yes)
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
.f.o:
	f2c $(F2CFLAGS) $<
	$(CC) $(CFLAGS) $(FLAGS) \
        $(<:.f=.c) -c -I${SERVERINCLUDEDIR} -I$(LOCINCLUDEDIR)
	@rm  $(<:.f=.c)

%.o77: %.f
	g77 -O2 -o $@ -c $< -Wall -ffixed-line-length-0 -fno-backslash

grepg77: $(GREBOBS:.o=.o77)
	g77 $(FLAGS) $^ -o $@ -ltf77 -lpgplot52 -lX11 \
        -L$(SERVERLIBDIR) -L$(LOCLIBDIR) -L/usr/X11/lib
	newprog $@

grepg: $(GREBOBS)
	$(CC) $(FLAGS) $(GREBOBS) -o grepg -ltf \
        $(PGPLOTLIB) $(F2CLIB) -L$(LOCLIBDIR)
	newprog grepg
thomas.forbriger's avatar
thomas.forbriger committed
127
128
129
130
131
132
133
134
135
136
137
else
%.f2c.o: %.f
	f2c $(F2CFLAGS) $<
	gcc $(CFLAGS) $(<:.f=.c) -c -I${SERVERINCLUDEDIR} -I${LOCINCLUDEDIR}
	@rm  $(<:.f=.c)
%.o: %.f; $(FC) -c -o $@ $< $(FFLAGS)
grepg: $(GREBOBS)
	$(FC) $(FFLAGS) $(LDFLAGS) $^ -o $@ \
        -ltf $(PGPLOT77LIB)
	/bin/mv -fv $@ $(LOCBINDIR)
endif
thomas.forbriger's avatar
publish    
thomas.forbriger committed
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161

#======================================================================
# create package
# --------------
VERSIONCODE=$(shell date +'%Y%m%d')
PACKAGE=grepg$(VERSIONCODE)
PUBLICATIONPATH=$(HOME)/public_html/download/software
TMPPATH=$(HOME)/tmp/$(PACKAGE)
package:
	/bin/rm -rfv $(TMPPATH); mkdir -pv $(TMPPATH)
	cd $(TMPPATH)/..; cvs export -l -r HEAD \
        -d $(PACKAGE) thof/src/green/grepg
	cd $(TMPPATH)/..; cvs export -r HEAD -d $(PACKAGE) thof/src/LICENSE.GPL
	cd $(TMPPATH)/..; cvs export -r HEAD \
        -d $(PACKAGE) thof/src/README.compile
	/bin/bash -c 'cd $(TMPPATH); \
        export LOCBINDIR=bin; mkdir -v bin; \
        make all; make clean'
	cd $(TMPPATH)/..; tar cvf $(PUBLICATIONPATH)/$(PACKAGE).tar $(PACKAGE)
	gzip --force -9 $(PUBLICATIONPATH)/$(PACKAGE).tar
	cd $(TMPPATH)/..; tar cvf $(PUBLICATIONPATH)/$(PACKAGE).tar $(PACKAGE)
	bzip2 -f $(PUBLICATIONPATH)/$(PACKAGE).tar

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