-
Notifications
You must be signed in to change notification settings - Fork 39
/
Makefile_f90
211 lines (186 loc) · 11.1 KB
/
Makefile_f90
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
# |
# o---------------------------------------------------------------------o
# |
# | MAD makefile - Fortran files selection and dependencies
# |
# o---------------------------------------------------------------------o
# |
# | Methodical Accelerator Design
# |
# | Copyright (c) 2011+ CERN, [email protected]
# |
# | For more information, see http://cern.ch/mad
# |
# o---------------------------------------------------------------------o
# |
# | $Id$
# |
vpath %.inc src libs/ptc/src
vpath %.f90 src libs/ptc/src
vpath %.F90 src libs/ptc/src
FC_DIR_MAD := src
FC_SRC_MAD := $(notdir $(wildcard $(FC_DIR_MAD)/*.f90 $(FC_DIR_MAD)/*.F90))
FC_DIR_PTC := libs/ptc/src
FC_SRC_PTC := $(notdir $(wildcard $(FC_DIR_PTC)/*.f90 $(FC_DIR_PTC)/*.F90))
# x11 dependencies
ifeq ($(X11),yes)
FC_SRC_MAD += gxx11.f90
FC_SRC_RM += gxx11ps.f90
else
FC_SRC_MAD += gxx11ps.f90
FC_SRC_RM += gxx11.f90
endif
# ptc dependencies
FC_SRC_RM += Ss_fake_mad.f90 ptcinterface.f90
# ntpsa dependencies
ifeq ($(NTPSA),yes)
FC_SRC_RM += c_dabnew.f90
else
FC_SRC_RM += c_tpsa_interface.F90 c_dabnew_berz.o
endif
# set dirs and files, remove unwanted files
FC_DIR := $(FC_DIR_MAD) $(FC_DIR_PTC)
FC_SRC := $(filter-out $(FC_SRC_RM),$(FC_SRC_MAD) $(FC_SRC_PTC))
# files for OPENMP (only trrun.f90 has OMP directives)
OPENMPFILES += trrun.f90
# files specific compiler flag (i.e. "internal compiler error" message)
#l_complex_taylor.o: override NOPT := 2
#Sg_sagan_wiggler.o: override NOPT := 2
#ifeq ($(ARCH),32)
#c_dabnew_berz.o : override NOPT := 1
#endif
#matchlib2.o : override NOPT := 0
ifneq ($(FCNAME),nagfor)
Sg_sagan_wiggler.o: FFLAGS += $(if $(call eq,$(FCNAME),lf95),-dollar-ok,-fdollar-ok)
endif
# BOZ flag set at the end of this file, i.e. need gfortran version
# util.o: FFLAGS += $(if $(call search,$(FCVER1),$(FCBOZV)),-fallow-invalid-boz,)
#######################
# Fortran dependencies (case not automatic!)
ifeq ($(FDEP),)
# chain of dependencies (PTC)
a_scratch_size.o: $(FC_DIR_PTC)/a_scratch_size.f90
b_da_arrays_all.o: $(FC_DIR_PTC)/b_da_arrays_all.f90 a_scratch_size.o
cb_da_arrays_all.o: $(FC_DIR_PTC)/cb_da_arrays_all.f90 b_da_arrays_all.o
c_dabnew.o: $(FC_DIR_PTC)/c_dabnew.f90 b_da_arrays_all.o
cc_dabnew.o: $(FC_DIR_PTC)/cc_dabnew.f90 cb_da_arrays_all.o
c_dabnew_berz.o: $(FC_DIR_PTC)/c_dabnew_berz.f90 b_da_arrays_all.o
c_tpsa_interface.o: $(FC_DIR_PTC)/c_tpsa_interface.F90 c_dabnew_berz.o
d_lielib.o: $(FC_DIR_PTC)/d_lielib.f90 $(if $(call eq,$(NTPSA),yes),c_tpsa_interface.o,c_dabnew.o)
h_definition.o: $(FC_DIR_PTC)/h_definition.f90 cc_dabnew.o d_lielib.o
i_tpsa.o: $(FC_DIR_PTC)/i_tpsa.f90 h_definition.o
j_tpsalie.o: $(FC_DIR_PTC)/j_tpsalie.f90 i_tpsa.o
k_tpsalie_analysis.o: $(FC_DIR_PTC)/k_tpsalie_analysis.f90 j_tpsalie.o
l_complex_taylor.o: $(FC_DIR_PTC)/l_complex_taylor.f90 k_tpsalie_analysis.o
m_real_polymorph.o: $(FC_DIR_PTC)/m_real_polymorph.f90 l_complex_taylor.o
n_complex_polymorph.o: $(FC_DIR_PTC)/n_complex_polymorph.f90 m_real_polymorph.o
o_tree_element.o: $(FC_DIR_PTC)/o_tree_element.f90 n_complex_polymorph.o
Su_duan_zhe_map.o: $(FC_DIR_PTC)/Su_duan_zhe_map.f90
Ci_tpsa.o: $(FC_DIR_PTC)/Ci_tpsa.f90 h_definition.o o_tree_element.o Su_duan_zhe_map.o
Sa_extend_poly.o: $(FC_DIR_PTC)/Sa_extend_poly.f90 o_tree_element.o
Sb_sagan_pol_arbitrary.o: $(FC_DIR_PTC)/Sb_sagan_pol_arbitrary.f90 Sa_extend_poly.o
Sc_euclidean.o: $(FC_DIR_PTC)/Sc_euclidean.f90 Sb_sagan_pol_arbitrary.o
Sd_frame.o: $(FC_DIR_PTC)/Sd_frame.f90 Sc_euclidean.o
Se_status.o: $(FC_DIR_PTC)/Se_status.f90 Sd_frame.o Ci_tpsa.o
Sf_def_all_kinds.o: $(FC_DIR_PTC)/Sf_def_all_kinds.f90 Se_status.o
Sg_sagan_wiggler.o: $(FC_DIR_PTC)/Sg_sagan_wiggler.f90 Sf_def_all_kinds.o
Sh_def_kind.o: $(FC_DIR_PTC)/Sh_def_kind.f90 Sg_sagan_wiggler.o
Si_def_element.o: $(FC_DIR_PTC)/Si_def_element.f90 Sh_def_kind.o
Sk_link_list.o: $(FC_DIR_PTC)/Sk_link_list.f90 Si_def_element.o
Sl_family.o: $(FC_DIR_PTC)/Sl_family.f90 Sk_link_list.o
Sm_tracking.o: $(FC_DIR_PTC)/Sm_tracking.f90 Sl_family.o
Sma0_beam_beam_ptc.o: $(FC_DIR_PTC)/Sma0_beam_beam_ptc.f90 Sm_tracking.o
Sma_multiparticle.o: $(FC_DIR_PTC)/Sma_multiparticle.f90 Sma0_beam_beam_ptc.o
Sn_mad_like.o: $(FC_DIR_PTC)/Sn_mad_like.f90 Sma_multiparticle.o
So_fitting.o: $(FC_DIR_PTC)/So_fitting.f90 Sn_mad_like.o
Sp_keywords.o: $(FC_DIR_PTC)/Sp_keywords.f90 So_fitting.o
Spb_fake_gino_sub.o: $(FC_DIR_PTC)/Spb_fake_gino_sub.f90
Sq_orbit_ptc.o: $(FC_DIR_PTC)/Sq_orbit_ptc.f90 Sp_keywords.o
Sr_spin.o: $(FC_DIR_PTC)/Sr_spin.f90 Sq_orbit_ptc.o
Sra_fitting.o: $(FC_DIR_PTC)/Sra_fitting.f90 Sr_spin.o
St_pointers.o: $(FC_DIR_PTC)/St_pointers.f90 madx_ptc_module.o Sp_keywords.o Su_duan_zhe_map.o
h_definition.o: $(FC_DIR_PTC)/a_def_frame_patch_chart.inc $(FC_DIR_PTC)/a_def_all_kind.inc \
$(FC_DIR_PTC)/a_def_sagan.inc $(FC_DIR_PTC)/a_def_element_fibre_layout.inc
Sf_def_all_kinds.o: $(FC_DIR_PTC)/a_def_worm.inc
Sp_keywords.o: $(FC_DIR_PTC)/a_namelists.inc
# chain of dependencies (MAD-X PTC)
madx_ptc_distrib.o: $(FC_DIR_MAD)/madx_ptc_distrib.f90 util.o madx_ptc_module.o
madx_ptc_eplacement.o: $(FC_DIR_MAD)/madx_ptc_eplacement.f90 util.o madx_ptc_intstate.o madx_ptc_module.o Sp_keywords.o
madx_ptc_intstate.o: $(FC_DIR_MAD)/madx_ptc_intstate.f90 Sp_keywords.o
madx_ptc_knobs.o: $(FC_DIR_MAD)/madx_ptc_knobs.f90 util.o madx_ptc_intstate.o Sp_keywords.o
madx_ptc_module.o: $(FC_DIR_MAD)/madx_ptc_module.f90 util.o madx_ptc_setcavs.o madx_ptc_knobs.o Sra_fitting.o
madx_ptc_script.o: $(FC_DIR_MAD)/madx_ptc_script.f90 madx_ptc_module.o util.o Sp_keywords.o
madx_ptc_setcavs.o: $(FC_DIR_MAD)/madx_ptc_setcavs.f90 madx_ptc_intstate.o Sp_keywords.o
madx_ptc_trackcavs.o: $(FC_DIR_MAD)/madx_ptc_trackcavs.f90 util.o madx_ptc_intstate.o madx_ptc_module.o madx_ptc_setcavs.o Sp_keywords.o
madx_ptc_track_run.o: $(FC_DIR_MAD)/madx_ptc_track_run.f90 util.o madx_ptc_module.o Sp_keywords.o
madx_ptc_twiss.o: $(FC_DIR_MAD)/madx_ptc_twiss.f90 util.o madx_ptc_module.o madx_ptc_setcavs.o madx_ptc_knobs.o madx_ptc_distrib.o
madx_ptc_normal.o: $(FC_DIR_MAD)/madx_ptc_normal.f90 madx_ptc_module.o madx_ptc_twiss.o
ptc_export_xml.o: $(FC_DIR_MAD)/ptc_export_xml.f90 madx_ptc_module.o
user2_photon.o: $(FC_DIR_MAD)/user2_photon.f90 madx_ptc_track_run.o
ifneq ($(NOWRAP),yes) # wrap is long to compile, with little "true" dependencies
wrap.o: $(FC_DIR_MAD)/wrap.f90 madx_ptc_module.o madx_ptc_intstate.o \
madx_ptc_normal.o madx_ptc_twiss.o \
madx_ptc_distrib.o madx_ptc_setcavs.o \
madx_ptc_trackcavs.o madx_ptc_knobs.o \
madx_ptc_track_run.o madx_ptc_script.o \
St_pointers.o ptc_export_xml.o \
madx_ptc_eplacement.o
endif
madx_ptc_distrib.o: $(FC_DIR_MAD)/madx_ptc_distrib.inc
madx_ptc_knobs.o: $(FC_DIR_MAD)/madx_ptc_knobs.inc
madx_ptc_twiss.o: $(FC_DIR_MAD)/madx_ptc_knobs.inc $(FC_DIR_MAD)/madx_ptc_distrib.inc
user2_photon.o: $(FC_DIR_MAD)/photoni.inc
# chain of dependencies (MAD-X)
dynap.o: $(FC_DIR_MAD)/dynap.f90 util.o
emit.o: $(FC_DIR_MAD)/emit.f90 util.o madx_space_charge.o
gxx11.o: $(FC_DIR_MAD)/gxx11.f90 util.o
gxx11ps.o: $(FC_DIR_MAD)/gxx11ps.f90 util.o
ibsdb.o: $(FC_DIR_MAD)/ibsdb.f90 util.o
mad_inif_f.o: $(FC_DIR_MAD)/mad_inif_f.F90
match.o: $(FC_DIR_MAD)/match.f90 util.o
matchjc.o: $(FC_DIR_MAD)/matchjc.f90 util.o match.o matchlib.o
matchlib.o: $(FC_DIR_MAD)/matchlib.f90 matchlib2.o
matchlib2.o: $(FC_DIR_MAD)/matchlib2.f90
matchsa.o: $(FC_DIR_MAD)/matchsa.f90 util.o
orbf.o: $(FC_DIR_MAD)/orbf.f90 util.o
plot.o: $(FC_DIR_MAD)/plot.f90 util.o
poisson.o: $(FC_DIR_MAD)/poisson.f90
resindex.o: $(FC_DIR_MAD)/resindex.f90 util.o
sodd.o: $(FC_DIR_MAD)/sodd.f90 util.o
survey.o: $(FC_DIR_MAD)/survey.f90 util.o
taper.o: $(FC_DIR_MAD)/taper.f90 util.o
timest.o: $(FC_DIR_MAD)/timest.f90
timex.o: $(FC_DIR_MAD)/timex.f90
touschek.o: $(FC_DIR_MAD)/touschek.f90 util.o
trrun.o: $(FC_DIR_MAD)/trrun.f90 util.o madx_space_charge.o madx_beam_beam.o
twiss.o: $(FC_DIR_MAD)/twiss.f90 util.o madx_space_charge.o madx_beam_beam.o taper.o
madx_space_charge.o: $(FC_DIR_MAD)/madx_space_charge.f90 util.o
madx_beam_beam.o: $(FC_DIR_MAD)/madx_beam_beam.f90 util.o madx_space_charge.o
util.o: $(FC_DIR_MAD)/util.f90
endif
#######################
# check for gfortran version >= 4.4
#
ifneq ($(filter $(BUILDGOALS),$(MAKECMDGOALS)),)
ifeq ($(FCNAME),gfortran)
FCVER := $(strip $(shell $(FC) -dumpversion))
ifeq ($(findstring GNU Fortran (GCC),$(FCVER)),GNU Fortran (GCC))
FCVER := $(word 4,$(FCVER)) # gfortran -dumpversion bug
endif
FCVERL := $(subst ., ,$(FCVER))
FCVER1 := $(word 1,$(FCVERL))
FCVER2 := $(word 2,$(FCVERL))
FCVER3 := $(word 3,$(FCVERL))
FCVERS := 4 5 6 7 8 9 10 11 12 13 14 15 16 17 19 20
FCISOK := $(call search,$(FCVER1),$(FCVERS))
ifeq ($(FCISOK),4)
FCISOK := $(call search,$(FCVER2),$(FCVERS))
endif
ifeq ($(FCISOK),)
$(error MAD-X requires gfortran >= 4.4 ($(if $(FCVER),$(FCVER),none) detected))
endif # version
FCBOZV := 10 11 12 13 14 15 16 17 19 20
util.o: FFLAGS += $(if $(call search,$(FCVER1),$(FCBOZV)),-fallow-invalid-boz,)
endif # gfortran
endif # cmdgoal
# end of makefile