Makefile 2.45 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) 2002 by Thomas Forbriger (IMG Frankfurt) 
# 
# some tools to manipulate green files
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 
#    27/03/2002   V1.0   Thomas Forbriger
27
#    09/02/2010   V1.1   move to gfortran
28
#    17/11/2010   V1.2   migrated to SVN scheme
thomas.forbriger's avatar
thomas.forbriger committed
29
30
# 
# ============================================================================
31
#
thomas.forbriger's avatar
thomas.forbriger committed
32

33
34
35
36
37
38
39
40
41
42
PROGRAMS=gredi grenorm gretap greto magres

.PHONY: all
all: install

.PHONY: install
install: $(addprefix $(LOCBINDIR)/,$(PROGRAMS))
$(LOCBINDIR)/%: %
	mkdir -pv $(LOCBINDIR)
	/bin/mv -fv $< $(LOCBINDIR)
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
	
# check mandatory environment variable settings
# ---------------------------------------------
CHECKVAR=$(if $($(1)),,$(error ERROR: missing variable $(1)))
CHECKVARS=$(foreach var,$(1),$(call CHECKVAR,$(var)))

$(call CHECKVARS,LOCINCLUDEDIR LOCLIBDIR LOCBINDIR)

FLAGS += $(MYFLAGS)
FFLAGS += -ff2c -Wall -ffixed-line-length-0 -fno-backslash $(FLAGS)
CFLAGS += $(FLAGS)
CXXFLAGS+=-Wall $(FLAGS)
LDFLAGS+=-L$(LOCLIBDIR)
CPPFLAGS+=-I$(LOCINCLUDEDIR) $(FLAGS)

#----------------------------------------------------------------------
thomas.forbriger's avatar
thomas.forbriger committed
59

60
flist: Makefile README COPYING $(wildcard *.f *.inc)
thomas.forbriger's avatar
thomas.forbriger committed
61
62
63
64
65
66
67
68
	echo $^ | tr ' ' '\n' | sort > $@

.PHONY: edit
edit: flist; vim $<

.PHONY: clean
clean: ; 
	-find . -name \*.bak | xargs --no-run-if-empty /bin/rm -v
69
	-/bin/rm -vf flist *.o *.d
70

71
72
73
74
75
76
#----------------------------------------------------------------------
# Fortran dependencies
# --------------------
%.d: %.f
	echo $<: $(shell cat $< | egrep '^ +include' | cut -f 2 -d \' | sort | uniq) > $@
-include $(patsubst %.f,%.d,$(wildcard *.f))
77

78
$(PROGRAMS): %: %.f
79
	$(FC) $(FFLAGS) -o $@ $^ -ltf -lsff $(LDFLAGS)
80

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