Makefile 3.8 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
24
# ----
# 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
# ----
# 
# REVISIONS and CHANGES 
#    05/06/2007   V1.0   Thomas Forbriger
thomas.forbriger's avatar
thomas.forbriger committed
25
#    15/09/2008   V1.1   moved to gfortran
26
27
28
29
#    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
30
#    15/11/2010   V1.3   replaced incdep by explicite rule
thomas.forbriger's avatar
publish    
thomas.forbriger committed
31
32
33
34
# 
# ============================================================================
#

35
36
37
38
39
40
41
42
43
44
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
45

46
47
48
49
50
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
51
52
53
54
55

FORTRANLIB=$(TF_LINK_FORTRAN)

FLAGS += $(MYFLAGS)
CFLAGS += -O2 $(FLAGS)
56
57
58
59
#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
60
61
62

# use STATIC=-static to produce statically linked binaries
STATIC=
thomas.forbriger's avatar
thomas.forbriger committed
63
64
65
LDFLAGS=$(addprefix -L,$(LOCLIBDIR) $(subst :, ,$(SERVERLIBDIR))) $(STATIC)
CPPFLAGS=$(addprefix -I,$(LOCINCLUDEDIR) $(subst :, ,$(SERVERINCLUDEDIR))) \
  $(FLAGS)
thomas.forbriger's avatar
publish    
thomas.forbriger committed
66

67
68
#----------------------------------------------------------------------
# standard edit targets
thomas.forbriger's avatar
publish    
thomas.forbriger committed
69
70
71
72
.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
73
	-/bin/rm -v *.o *.bak *.o77 flist *.f2.o *.d
thomas.forbriger's avatar
publish    
thomas.forbriger committed
74
75
76

.PHONY: edit
edit: flist ; vim flist
77
flist: *.f *.inc Makefile README COPYING\
thomas.forbriger's avatar
thomas.forbriger committed
78
79
  README.PGPLOT.copyright.notice
	echo $^ | tr ' ' '\n' | sort > $@
80
#----------------------------------------------------------------------
81
82

GREBOBS=grepg.o grepg_message.o grepg_dopicks.o grepg_selstyle.o \
83
  grepg_phase.o grepg_phasewedg.o grepg_poly.o grepg_remavg.o \
84
  grepg_contr.o grepg_prepcol.o grepg_readfourier.o grepg_phasor.o
85

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

90
91
# only the original is in SVN
# so we can change the current dimensions without affecting the SVN
92
93
grepg_ardim.xxx.inc: grepg_ardim.inc; /bin/cp -v $< $@

thomas.forbriger's avatar
thomas.forbriger committed
94
95
%.o: %.f; $(FC) -c -o $@ $< $(FFLAGS)
grepg: $(GREBOBS)
96
	$(FC) $(FFLAGS) $^ -o $@ \
97
        -ltf $(TF_LINK_PGPLOT) $(LDFLAGS)
thomas.forbriger's avatar
publish    
thomas.forbriger committed
98

thomas.forbriger's avatar
thomas.forbriger committed
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#======================================================================
# create package
# --------------
# is delegated to Makefile.packages
ifdef TF_MAKEPKG
.PHONY: package
package: $(TF_MAKEPKG)
	$(MAKE) -f $< \
	  PACKAGE=grepg \
	  PACKAGEEXPORT="trunk/src/green/grepg:src" \
	  PACKAGETARGETS="src:all" \
	  PACKAGELIBS="-"
.PHONY: fullpackage
fullpackage: $(TF_MAKEPKG)
	$(MAKE) -f $< \
	  PACKAGE=grepgwithlibs \
	  PACKAGEEXPORT="trunk/src/green/grepg:src" \
	  PACKAGETARGETS="src:all" \
	  PACKAGELIBS="libtf"
endif

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