Makefile 5.5 KB
Newer Older
1
2
# this is <Makefile>
# ----------------------------------------------------------------------------
thomas.forbriger's avatar
thomas.forbriger committed
3
# $Id$
4
5
6
7
# 
# Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt) 
# 
# refmet and refread library
thomas.forbriger's avatar
gpled    
thomas.forbriger committed
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
# ----
24
25
26
# 
# REVISIONS and CHANGES 
#    15/03/2002   V1.0   Thomas Forbriger
thomas.forbriger's avatar
thomas.forbriger committed
27
#    14/09/2008   V1.1   use gfortran
thomas.forbriger's avatar
package    
thomas.forbriger committed
28
#    23/02/2009   V1.2   support creation of package
thomas.forbriger's avatar
thomas.forbriger committed
29
30
31
32
#    08/10/2010   V1.3   migrate to SVN environment
#                        discard f2c fallback option
#                        check environment
#                        discard package creation
33
#    14/01/2011   V1.4   implemented refmetx with libfapidxx interface
34
35
# 
# ============================================================================
36
#
37

38
PROGRAMS=refmet refmetx grema matbau refmat resus
39
40
LIBRARIES=librefread.a

41
42
43
.PHONY: all
all: install 

44
.PHONY: install
45
46
47
48
49
install: libraries programs

.PHONY: programs
programs: $(addprefix $(LOCBINDIR)/,$(PROGRAMS))
$(LOCBINDIR)/%: %
thomas.forbriger's avatar
thomas.forbriger committed
50
51
	mkdir -pv $(dir $@)
	/bin/mv -fv $< $@
52
53
54
55

.PHONY: libraries
libraries: $(addprefix $(LOCLIBDIR)/,$(LIBRARIES))
$(LOCLIBDIR)/%: install-include %
thomas.forbriger's avatar
thomas.forbriger committed
56
57
	mkdir -pv $(dir $@)
	/bin/mv -fv $(word 2,$^) $@
58

thomas.forbriger's avatar
thomas.forbriger committed
59
60
#----------------------------------------------------------------------
# standard edit targets
61
flist: Makefile $(wildcard */*.f */Makefile sub/lmath.c) COPYING \
thomas.forbriger's avatar
thomas.forbriger committed
62
63
       $(wildcard examples/*.cfg) $(wildcard docu/*.tex) \
	 $(wildcard */README) README
64
65
66
67
68
69
	echo $^ | tr ' ' '\n' | sort > $@

.PHONY: edit
edit: flist; vim $<

.PHONY: clean
thomas.forbriger's avatar
thomas.forbriger committed
70
clean: subclean 
71
	-find . -name \*.bak | xargs --no-run-if-empty /bin/rm -v
72
73
	-/bin/rm -vf flist $(PROGRAMS) $(LIBRARIES)

thomas.forbriger's avatar
thomas.forbriger committed
74
#----------------------------------------------------------------------
75

thomas.forbriger's avatar
thomas.forbriger committed
76
77
CHECKVAR=$(if $($(1)),,$(error ERROR: missing variable $(1)))
CHECKVARS=$(foreach var,$(1),$(call CHECKVAR,$(var)))
thomas.forbriger's avatar
thomas.forbriger committed
78

thomas.forbriger's avatar
thomas.forbriger committed
79
$(call CHECKVARS,LOCINCLUDEDIR LOCLIBDIR LOCBINDIR)
thomas.forbriger's avatar
thomas.forbriger committed
80
81
82

FLAGS += $(MYFLAGS)
CFLAGS += -O2 $(FLAGS)
thomas.forbriger's avatar
thomas.forbriger committed
83
84
FFLAGS += -ff2c -Wall -ffixed-line-length-none $(FLAGS) \
  -fimplicit-none -pedantic -std=legacy
thomas.forbriger's avatar
thomas.forbriger committed
85
86
87

# use STATIC=-static to produce statically linked binaries
STATIC=
thomas.forbriger's avatar
thomas.forbriger committed
88
89
90
LDFLAGS=$(addprefix -L,$(LOCLIBDIR) $(subst :, ,$(SERVERLIBDIR))) $(STATIC)
CPPFLAGS=$(addprefix -I,$(LOCINCLUDEDIR) $(subst :, ,$(SERVERINCLUDEDIR))) \
  $(FLAGS)
91
92
93
94
95

REAMPOBS=refmet_basinf.o refmet_rmod.o refmet_rmain.o refmet_rsource.o refmet_rrcv.o
REFMETOBS=refmet_output.o refmet_preptrace.o refmet_wtrace.o lmath.o\
   refmet_basinf.o refmet_rmain.o refmet_rmod.o refmet_rsource.o refmet_rrcv.o\
   refmet_intro.o refmet_comments.o
96
REFMUOBS=main/ref2mu.o
97
98
99
100
101
REFMATOBS=refmat_basinf.o refmet_rmain.o refmet_rmod.o\
  refmet_rsource.o refmet_intro.o refmet_comments.o
RESUSOBS=refmet_output.o refmet_preptrace.o refmet_wtrace.o lmath.o\
   resus_basinf.o refmet_rmain.o refmet_rsource.o refmet_rrcv.o\
   refmet_intro.o refmet_comments.o
thomas.forbriger's avatar
thomas.forbriger committed
102
103
104
RESUSNOBS=refmet_output.o refmet_preptrace.o refmet_wtrace.o lmath.o\
   resusnoise_basinf.o refmet_rmain.o refmet_rsource.o refmet_rrcv.o\
   refmet_intro.o refmet_comments.o
105
GRESYSUB=main/gresy.o sub/refmet_rrcv.o
thomas.forbriger's avatar
thomas.forbriger committed
106
107
LIBREFMETOBS=$(addprefix sub/,refmet_basinf.o refmet_rmain.o refmet_rmod.o \
   refmet_rsource.o refmet_rrcv.o refmet_intro.o refmet_comments.o)
108

thomas.forbriger's avatar
thomas.forbriger committed
109
%.o: %.f; cd $(dir $<); make $(notdir $@)
110
%.o: %.c; cd $(dir $<); make $(notdir $@)
111

112
113
114
.PHONY: install-include
install-include:

thomas.forbriger's avatar
thomas.forbriger committed
115
subclean:
thomas.forbriger's avatar
thomas.forbriger committed
116
	-/bin/rm *.o *.bak *.o77 *.f2c.o
117
118
	cd sub; make clean
	cd main; make clean
119

thomas.forbriger's avatar
thomas.forbriger committed
120
refmet: main/refmet.o $(addprefix sub/, $(REFMETOBS))
121
refmetx: main/refmet.o $(addprefix sub/, $(REFMETOBS))
thomas.forbriger's avatar
thomas.forbriger committed
122
123
124
125
126
127
resus: main/resus.o $(addprefix sub/, $(RESUSOBS))
resusnoise: main/resusnoise.o $(addprefix sub/, $(RESUSNOBS))
refmat: main/refmat.o $(addprefix sub/, $(REFMATOBS))
refmatsh: main/refmatsh.o $(addprefix sub/, $(REFMETOBS))

matbau: %: main/%.o
thomas.forbriger's avatar
thomas.forbriger committed
128
	$(FC) $< -o $@ $(LDFLAGS)
thomas.forbriger's avatar
thomas.forbriger committed
129
130
131

grema: %: main/%.o sub/refmet_rrcv.o
	$(FC) $(FFLAGS) $^ -o $@ -lrefread -ltf -lsff \
thomas.forbriger's avatar
thomas.forbriger committed
132
        $(LDFLAGS)
thomas.forbriger's avatar
thomas.forbriger committed
133
134
135

refmatsh refmat resus refmet: 
	$(FC) $^ -o $@ -lsff -lemod -ltf \
thomas.forbriger's avatar
thomas.forbriger committed
136
        $(LDFLAGS) $(FFLAGS)
thomas.forbriger's avatar
thomas.forbriger committed
137

138
139
140
refmetx: 
	$(FC) $^ -o $@ -lemod -ltf \
	  -lfapidxx -ldatrwxx -lsffxx -lgsexx -ltime++ -laff \
thomas.forbriger's avatar
thomas.forbriger committed
141
        $(LDFLAGS) $(FFLAGS)
142

thomas.forbriger's avatar
thomas.forbriger committed
143
144
resusnoise: 
	$(FC) $^ -o $@ -lsff -lemod -ltf -lgsl -lgslcblas \
thomas.forbriger's avatar
thomas.forbriger committed
145
        $(LDFLAGS) $(FFLAGS)
146
147
148
149

librefread.a: $(LIBREFMETOBS)
	ar rcv librefread.a $(LIBREFMETOBS)
	ranlib librefread.a
thomas.forbriger's avatar
thomas.forbriger committed
150

thomas.forbriger's avatar
thomas.forbriger committed
151
152
153
154
155
156
157
158
159
160
#======================================================================
# create package
# --------------
# is delegated to Makefile.packages
ifdef TF_MAKEPKG
.PHONY: package
package: $(TF_MAKEPKG)
	$(MAKE) -f $< \
	  PACKAGE=refmet \
	  PACKAGEEXPORT="trunk/src/synt/ref/refmet:src" \
thomas.forbriger's avatar
thomas.forbriger committed
161
	  PACKAGETARGETS="src:all" \
thomas.forbriger's avatar
thomas.forbriger committed
162
163
164
165
166
167
	  PACKAGELIBS="-"
.PHONY: fullpackage
fullpackage: $(TF_MAKEPKG)
	$(MAKE) -f $< \
	  PACKAGE=refmetwithlibs \
	  PACKAGEEXPORT="trunk/src/synt/ref/refmet:src" \
thomas.forbriger's avatar
thomas.forbriger committed
168
	  PACKAGETARGETS="src:all" \
thomas.forbriger's avatar
thomas.forbriger committed
169
170
	  PACKAGELIBS="libemod libsff libtf libsffu libts libaff libtime libgsexx libsffxx libdatrwxx libfapidxx"
endif
thomas.forbriger's avatar
package    
thomas.forbriger committed
171

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