-
Notifications
You must be signed in to change notification settings - Fork 52
/
Makefile
215 lines (214 loc) · 7.31 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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
#
# Makefile for Packmol: Read the comments if you have some
# problem while compiling.
#
# You may use the ./configure script to search automatically for
# some fortran compiler.
#
# This make file will try to compile packmol with the default
# fortran compiler, defined by the FC directive. For doing this,
# just type
#
# make
#
# If you want to compile with some specific fortran compiler, you must
# change the line below to the path of your fortran compiler.
#
FORTRAN=/usr/bin/gfortran
#
# Change the flags of the compilation if you want:
#
FLAGS= -O3 --fast-math -march=native -funroll-loops
SRCDIR= src
MAINDIR= app
###################################################################
# #
# Generally no modifications are required after this. #
# #
###################################################################
#
# Flags for compiling development version
#
GENCANFLAGS := $(FLAGS)
# Flags for the routines that signal with --fast-math
IEEE_SIGNAL_FLAGS := $(FLAGS)
ifeq ($(MAKECMDGOALS),devel)
FLAGS = -Wall -fcheck=bounds -g -fbacktrace -ffpe-trap=zero,overflow,underflow
GENCANFLAGS = -fcheck=bounds -g -fbacktrace -ffpe-trap=zero,overflow,underflow
endif
ifeq ($(MAKECMDGOALS),perf)
FLAGS = -g -pg
GENCANFLAGS = -g -pg
endif
ifeq ($(MAKECMDGOALS),static)
FLAGS = -O3 --fast-math -static
GENCANFLAGS = -O3 --fast-math -static
endif
#
# Files required
#
oall = cenmass.o \
gencan.o \
pgencan.o \
initial.o \
title.o \
setsizes.o \
exit_codes.o \
getinp.o \
strlength.o \
output.o \
checkpoint.o \
writesuccess.o \
fparc.o \
gparc.o \
gwalls.o \
comprest.o \
comparegrad.o \
packmol.o \
polartocart.o \
resetboxes.o \
tobar.o \
setijk.o \
setibox.o \
restmol.o \
swaptype.o \
swaptypemod.o \
ahestetic.o \
heuristics.o \
flashsort.o \
jacobi.o \
random.o \
sizes.o \
pbc.o \
usegencan.o \
compute_data.o \
flashmod.o \
computef.o \
computeg.o \
input.o \
gencan_ieee_signal_routines.o
#
# Linking
#
all : $(oall)
@echo " ------------------------------------------------------ "
@echo " Compiling packmol with $(FORTRAN) "
@echo " Flags: $(FLAGS) "
@echo " ------------------------------------------------------ "
@$(FORTRAN) -o packmol $(oall) $(FLAGS)
@\rm -f *.mod *.o
@echo " ------------------------------------------------------ "
@echo " Packmol succesfully built."
@echo " ------------------------------------------------------ "
#
# Compiling with flags for development
#
static : devel
perf : devel
devel : $(oall)
@echo " ------------------------------------------------------ "
@echo " Compiling packmol with $(FORTRAN) "
@echo " Flags: $(FLAGS)"
@echo " ------------------------------------------------------ "
@$(FORTRAN) -o packmol $(oall) $(FLAGS)
@echo " ------------------------------------------------------ "
@echo " Packmol succesfully built. "
@echo " ------------------------------------------------------ "
#
# Modules
#
modules = exit_codes.o sizes.o pbc.o compute_data.o usegencan.o input.o flashmod.o \
swaptypemod.o ahestetic.o
exit_codes.o : $(SRCDIR)/exit_codes.f90
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/exit_codes.f90
sizes.o : $(SRCDIR)/sizes.f90
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/sizes.f90
pbc.o : $(SRCDIR)/pbc.f90
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/pbc.f90
compute_data.o : $(SRCDIR)/compute_data.f90 sizes.o
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/compute_data.f90
input.o : $(SRCDIR)/input.f90 sizes.o
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/input.f90
flashmod.o : $(SRCDIR)/flashmod.f90 sizes.o
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/flashmod.f90
usegencan.o : $(SRCDIR)/usegencan.f90 sizes.o
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/usegencan.f90
swaptypemod.o : $(SRCDIR)/swaptypemod.f90
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/swaptypemod.f90
ahestetic.o : $(SRCDIR)/ahestetic.f90
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/ahestetic.f90
#
# Code compiled only for all versions
#
cenmass.o : $(SRCDIR)/cenmass.f90 $(modules)
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/cenmass.f90
initial.o : $(SRCDIR)/initial.f90 $(modules)
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/initial.f90
title.o : $(SRCDIR)/title.f90 $(modules)
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/title.f90
setsizes.o : $(SRCDIR)/setsizes.f90 $(modules)
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/setsizes.f90
getinp.o : $(SRCDIR)/getinp.f90 $(modules)
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/getinp.f90
strlength.o : $(SRCDIR)/strlength.f90 $(modules)
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/strlength.f90
output.o : $(SRCDIR)/output.f90 $(modules)
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/output.f90
checkpoint.o : $(SRCDIR)/checkpoint.f90 $(modules)
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/checkpoint.f90
writesuccess.o : $(SRCDIR)/writesuccess.f90 $(modules)
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/writesuccess.f90
fparc.o : $(SRCDIR)/fparc.f90 $(modules)
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/fparc.f90
gparc.o : $(SRCDIR)/gparc.f90 $(modules)
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/gparc.f90
gwalls.o : $(SRCDIR)/gwalls.f90 $(modules)
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/gwalls.f90
comprest.o : $(SRCDIR)/comprest.f90 $(modules)
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/comprest.f90
comparegrad.o : $(SRCDIR)/comparegrad.f90 $(modules)
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/comparegrad.f90
packmol.o : app/packmol.f90 $(modules)
@$(FORTRAN) $(FLAGS) -c app/packmol.f90
polartocart.o : $(SRCDIR)/polartocart.f90 $(modules)
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/polartocart.f90
resetboxes.o : $(SRCDIR)/resetboxes.f90 $(modules)
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/resetboxes.f90
tobar.o : $(SRCDIR)/tobar.f90 $(modules)
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/tobar.f90
setijk.o : $(SRCDIR)/setijk.f90 $(modules)
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/setijk.f90
setibox.o : $(SRCDIR)/setibox.f90 $(modules)
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/setibox.f90
restmol.o : $(SRCDIR)/restmol.f90 $(modules)
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/restmol.f90
swaptype.o : $(SRCDIR)/swaptype.f90 $(modules)
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/swaptype.f90
heuristics.o : $(SRCDIR)/heuristics.f90 $(modules)
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/heuristics.f90
flashsort.o : $(SRCDIR)/flashsort.f90 $(modules)
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/flashsort.f90
jacobi.o : $(SRCDIR)/jacobi.f90
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/jacobi.f90
pgencan.o : $(SRCDIR)/pgencan.f90 $(modules)
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/pgencan.f90
random.o : $(SRCDIR)/random.f90
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/random.f90
computef.o : $(SRCDIR)/computef.f90 $(modules)
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/computef.f90
computeg.o : $(SRCDIR)/computeg.f90 $(modules)
@$(FORTRAN) $(FLAGS) -c $(SRCDIR)/computeg.f90
gencan_ieee_signal_routines.o : $(SRCDIR)/gencan_ieee_signal_routines.f90
@$(FORTRAN) $(IEEE_SIGNAL_FLAGS) -c $(SRCDIR)/gencan_ieee_signal_routines.f90
gencan.o : $(SRCDIR)/gencan.f gencan_ieee_signal_routines.o
@$(FORTRAN) $(GENCANFLAGS) -c $(SRCDIR)/gencan.f
#
# Clean build files
#
clean:
@\rm -f ./*.o ./*.mod ./src/*.mod ./src/*.o
#
# Remove all build and executable files to upload to git
#
cleanall:
@\rm -f ./packmol ./*.o ./*.mod ./src/*.mod ./src/*.o