forked from mjlaine/mcmcf90
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
196 lines (169 loc) · 4.78 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# $Id: Makefile,v 1.58 2017/08/10 07:18:33 mjlaine Exp $
## MCMC f90 library Makefile
## Uses (and needs) GNU make
##
## make newversion vesion.h
## updates the version.h and the library minor version number
##
## Marko Laine 2001 <[email protected]>
## Copyrights licensed under a MIT License.
## See the accompanying LICENSE.txt file for terms.
MCMC_MAJOR_VERSION=1
MCMC_MINOR_VERSION=2
MCMC_VERSION=$(MCMC_MAJOR_VERSION).$(MCMC_MINOR_VERSION)
# Try to guess the system
sys := $(shell uname)$(shell uname -m)
# sys := aix
# sys := win32
# default is Linux64 (or win32) with gfortran
system=win32
system=linux64
f90compiler=gfortran
ifeq ($(sys),Linuxi686)
system=linux
f90compiler=gfortran
endif
ifeq ($(sys),Linuxx86_64)
system=linux64
# f90compiler=gfortran
# f90compiler=intel
endif
ifeq ($(sys),Linuxia64)
system=linux
# f90compiler=intel
endif
ifeq ($(sys),Darwini386)
system=maci
f90compiler=gfortran
endif
ifeq ($(sys),Darwinx86_64)
system=maci
f90compiler=gfortran
endif
ifeq ($(sys),Darwinppc)
system=mac
f90compiler=gfortran
endif
ifeq ($(sys),Darwinppc64)
system=mac
f90compiler=gfortran
endif
ifeq ($(sys),aix)
system=aix
f90compiler=xlf90
endif
# produce debug code?
DEBUG := no
debug=${DEBUG}
#debug=yes
### no user modification below this, but check *.mk files ###
# read system specific compiler flags from a separate file
ifeq ($(system),win32)
include win32.mk
endif
ifeq ($(system),mac)
include mac.mk
endif
ifeq ($(system),maci)
include maci.mk
endif
ifeq ($(system),linux)
include linux.mk
endif
ifeq ($(system),linux64)
include linux64.mk
endif
ifeq ($(system),aix)
include aix.mk
endif
# main source files
LIBSRC1 = mcmc_main.F90 mcmc.F90 mcmcinit.F90 matutils.F90 mcmcprec.F90 \
mcmcrand.F90 matfiles.F90 priorfun.f90 ssfunction0.f90 checkbounds0.f90 \
mcmcrun1.F90 signalqq.c dchud.f dchdd.f initialize.F90 dump.F90 \
ssfunction_er0.f90
# files included in mcmc.F90
LIBSRC2 = MCMC_DRAM.F90 MCMC_aux.F90 MCMC_init.F90 MCMC_userfun.F90 \
MCMC_adapt.F90 MCMC_run.F90 MCMC_run1.F90 \
MCMC_run_scam.F90 MCMC_run_ram.F90 MCMC_run_er.F90 MCMC_run1_er.F90 \
MCMC_signal_handler.F90 MCMC_dump.F90
# for the src zip file
ALLSRC = $(LIBSRC1) $(LIBSRC2)
LIBOBJ := $(patsubst %.f,%.$(O),$(filter %.f,$(LIBSRC1))) \
$(patsubst %.F,%.$(O),$(filter %.F,$(LIBSRC1))) \
$(patsubst %.f90,%.$(O),$(filter %.f90,$(LIBSRC1))) \
$(patsubst %.F90,%.$(O),$(filter %.F90,$(LIBSRC1))) \
$(patsubst %.c,%.$(O),$(filter %.c,$(LIBSRC1)))
# Test files
TSTFILES=testcases/Makefile testcases/mcmcrun.f90 \
testcases/mcmcinit.nml testcases/data.dat testcases/mcmcpar.dat \
testcases/mcmccov.dat testcases/mcmcsigma2.dat testcases/README.txt
# Matlab files
MFILES =
# source code and other files needed
SRC = $(ALLSRC) lapack_inc.h external_inc.h \
version.h .version mkversion.sh mcmcinit.nml \
Makefile linux.mk linux64.mk win32.mk mac.mk maci.mk aix.mk \
$(MFILES) Readme.txt Readme_code.txt INSTALL.txt LICENSE.txt \
$(TSTFILES)
.SUFFIXES: .a .$(O) .l$(O) .mod .f90 .F90 .F .f
all: libmcmcrun.a
zip: mcmcf90src.zip
mcmcf90src.zip: $(SRC)
$(ZIP) -9 mcmcf90src.zip $(SRC)
clean:
$(RM) *.$(O) *.l$(O) core *~ *.mod
realclean: clean
$(RM) *.o *.obj *.lo *.il *.lobj *.a *.lib *.mod
standalone: libmcmcrun.a
libmcmcrun.a: $(LIBOBJ)
$(AR) ruv libmcmcrun.a $(LIBOBJ)
$(RANLIB) libmcmcrun.a
install: libmcmcrun.a
install -d /usr/local/lib
install -p -m644 libmcmcrun.a /usr/local/lib
ifeq ($(system),aix)
defines_aix = $(defines:-D%=-WF,-D%)
.f90.$(O):
$(F90) $(F90FLAGS) $(defines_aix) -c $<
.F90.$(O):
$(F90) $(F90FLAGS) $(defines_aix) -c $<
.f.$(O):
$(F77) $(F77FLAGS) $(defines_aix) -c $<
.F.$(O):
$(F77) $(F77FLAGS) $(defines_aix) -c $<
.c.$(O):
$(CC) $(CCFLAGS) $(defines_aix) -c $<
else
.f90.$(O):
$(F90) $(F90FLAGS) $(defines) -c $<
.F90.$(O):
$(F90) $(F90FLAGS) $(defines) -c $<
.f.$(O):
$(F77) $(F77FLAGS) $(defines) -c $<
.F.$(O):
$(F77) $(F77FLAGS) $(defines) -c $<
.c.$(O):
$(CC) $(CCFLAGS) $(defines) -c $<
endif
# Cancel .mod.o rule
%.o : %.mod
#
newversion:
@. mkversion.sh > .ver
@mv -f .ver .version
version.h: .version
@/bin/echo -n "character(len=*), parameter :: " > .ver
@/bin/echo -n Mcmc_Code_Version = \"$(MCMC_VERSION).`cat .version` >> .ver
@/bin/echo ' -- '`date +%Y-%m-%d`'"' >> .ver
@/bin/echo "character(len=*), parameter :: Mcmc_Lib_Compile_Date = __DATE__" >> .ver
@mv -f .ver $@
# dependencies
mcmc_main.$(O): mcmc.$(O)
mdstmcmc.$(O): matutils.$(O) mcmc.$(O)
matutils.$(O): mcmcprec.$(O) mcmcrand.$(O) matfiles.$(O)
mcmc.$(O): mcmcinit.$(O) matutils.$(O) mcmcprec.$(O) mcmcrand.$(O) version.h $(LIBSRC2) mcmcrun1.$(O)
mdstexpanneal.$(O): mcmc.$(O) matutils.$(O) version.h
priorfun.$(O): mcmc.$(O)
mcmcrun1.$(O): matutils.$(O)
mcmcrand.$(O): mcmcprec.$(O)
mcmcinit.$(O): mcmcprec.$(O)