[430] | 1 | # | |
---|
| 2 | # o---------------------------------------------------------------------o |
---|
| 3 | # | |
---|
| 4 | # | MAD makefile - Fortran files selection and dependencies |
---|
| 5 | # | |
---|
| 6 | # o---------------------------------------------------------------------o |
---|
| 7 | # | |
---|
| 8 | # | Methodical Accelerator Design |
---|
| 9 | # | |
---|
| 10 | # | Copyright (c) 2011+ CERN, mad@cern.ch |
---|
| 11 | # | |
---|
| 12 | # | For more information, see http://cern.ch/mad |
---|
| 13 | # | |
---|
| 14 | # o---------------------------------------------------------------------o |
---|
| 15 | # | |
---|
| 16 | # | $Id$ |
---|
| 17 | # | |
---|
| 18 | |
---|
| 19 | vpath %.inc src libs/ptc/src |
---|
| 20 | vpath %.f90 src libs/ptc/src |
---|
| 21 | vpath %.F90 src libs/ptc/src |
---|
| 22 | |
---|
| 23 | FC_DIR_MAD := src |
---|
| 24 | FC_SRC_MAD := $(notdir $(wildcard $(FC_DIR_MAD)/*.f90 $(FC_DIR_MAD)/*.F90)) |
---|
| 25 | |
---|
| 26 | FC_DIR_PTC := libs/ptc/src |
---|
| 27 | FC_SRC_PTC := $(notdir $(wildcard $(FC_DIR_PTC)/*.f90 $(FC_DIR_PTC)/*.F90)) |
---|
| 28 | |
---|
| 29 | # x11 dependencies |
---|
| 30 | ifneq ($(findstring $(OSTYPE),Cygwin Windows),) |
---|
| 31 | FC_SRC_MAD += gxx11ps.f90 |
---|
| 32 | FC_SRC_RM += gxx11.f90 |
---|
| 33 | else |
---|
| 34 | FC_SRC_MAD += gxx11.f90 |
---|
| 35 | FC_SRC_RM += gxx11ps.f90 |
---|
| 36 | endif |
---|
| 37 | |
---|
| 38 | # ptc dependencies |
---|
| 39 | FC_SRC_RM += Ss_fake_mad.f90 ptcinterface.f90 |
---|
| 40 | |
---|
| 41 | # ntpsa dependencies |
---|
| 42 | ifeq ($(NTPSA),yes) |
---|
| 43 | FC_SRC_RM += c_dabnew.f90 |
---|
| 44 | else |
---|
| 45 | FC_SRC_RM += c_tpsa_interface.F90 c_dabnew_berz.o |
---|
| 46 | endif |
---|
| 47 | |
---|
| 48 | # set dirs and files, remove unwanted files |
---|
| 49 | FC_DIR := src libs/ptc/src |
---|
| 50 | FC_SRC := $(filter-out $(FC_SRC_RM),$(FC_SRC_MAD) $(FC_SRC_PTC)) |
---|
| 51 | |
---|
| 52 | # files specific compiler flag (i.e. "internal compiler error" message) |
---|
| 53 | matchlib2.o: NOPT := 0 |
---|
| 54 | l_complex_taylor.o: NOPT := 2 |
---|
| 55 | |
---|
| 56 | ifeq ($(OSTYPE),Windows) |
---|
| 57 | c_dabnew_berz.o: NOPT := 1 |
---|
| 58 | endif |
---|
| 59 | |
---|
| 60 | ####################### |
---|
| 61 | # Fortran dependencies (case not automatic!) |
---|
| 62 | |
---|
| 63 | ifeq ($(FDEP),) |
---|
| 64 | |
---|
| 65 | # chain of dependencies (PTC) |
---|
| 66 | a_scratch_size.o: $(FC_DIR_PTC)/a_scratch_size.f90 |
---|
| 67 | b_da_arrays_all.o: $(FC_DIR_PTC)/b_da_arrays_all.f90 a_scratch_size.o |
---|
| 68 | c_dabnew.o: $(FC_DIR_PTC)/c_dabnew.f90 b_da_arrays_all.o |
---|
| 69 | c_dabnew_berz.o: $(FC_DIR_MAD)/c_dabnew_berz.f90 b_da_arrays_all.o |
---|
| 70 | c_tpsa_interface.o: $(FC_DIR_MAD)/c_tpsa_interface.F90 c_dabnew_berz.o |
---|
| 71 | d_lielib.o: $(FC_DIR_PTC)/d_lielib.f90 $(if $(call eq,$(NTPSA),yes),c_tpsa_interface.o,c_dabnew.o) |
---|
| 72 | h_definition.o: $(FC_DIR_PTC)/h_definition.f90 d_lielib.o |
---|
| 73 | i_tpsa.o: $(FC_DIR_PTC)/i_tpsa.f90 h_definition.o |
---|
| 74 | j_tpsalie.o: $(FC_DIR_PTC)/j_tpsalie.f90 i_tpsa.o |
---|
| 75 | k_tpsalie_analysis.o: $(FC_DIR_PTC)/k_tpsalie_analysis.f90 j_tpsalie.o |
---|
| 76 | l_complex_taylor.o: $(FC_DIR_PTC)/l_complex_taylor.f90 k_tpsalie_analysis.o |
---|
| 77 | m_real_polymorph.o: $(FC_DIR_PTC)/m_real_polymorph.f90 l_complex_taylor.o |
---|
| 78 | n_complex_polymorph.o: $(FC_DIR_PTC)/n_complex_polymorph.f90 m_real_polymorph.o |
---|
| 79 | o_tree_element.o: $(FC_DIR_PTC)/o_tree_element.f90 n_complex_polymorph.o |
---|
| 80 | |
---|
| 81 | Sa_extend_poly.o: $(FC_DIR_PTC)/Sa_extend_poly.f90 o_tree_element.o |
---|
| 82 | Sb_sagan_pol_arbitrary.o: $(FC_DIR_PTC)/Sb_sagan_pol_arbitrary.f90 Sa_extend_poly.o |
---|
| 83 | Sc_euclidean.o: $(FC_DIR_PTC)/Sc_euclidean.f90 Sb_sagan_pol_arbitrary.o |
---|
| 84 | Sd_frame.o: $(FC_DIR_PTC)/Sd_frame.f90 Sc_euclidean.o |
---|
| 85 | Se_status.o: $(FC_DIR_PTC)/Se_status.f90 Sd_frame.o |
---|
| 86 | Sf_def_all_kinds.o: $(FC_DIR_PTC)/Sf_def_all_kinds.f90 Se_status.o |
---|
| 87 | Sg_sagan_wiggler.o: $(FC_DIR_PTC)/Sg_sagan_wiggler.f90 Sf_def_all_kinds.o |
---|
| 88 | Sh_def_kind.o: $(FC_DIR_PTC)/Sh_def_kind.f90 Sg_sagan_wiggler.o |
---|
| 89 | Si_def_element.o: $(FC_DIR_PTC)/Si_def_element.f90 Sh_def_kind.o |
---|
| 90 | Sk_link_list.o: $(FC_DIR_PTC)/Sk_link_list.f90 Si_def_element.o |
---|
| 91 | Sl_family.o: $(FC_DIR_PTC)/Sl_family.f90 Sk_link_list.o |
---|
| 92 | Sm_tracking.o: $(FC_DIR_PTC)/Sm_tracking.f90 Sl_family.o |
---|
| 93 | Sma0_beam_beam_ptc.o: $(FC_DIR_PTC)/Sma0_beam_beam_ptc.f90 Sm_tracking.o |
---|
| 94 | Sma_multiparticle.o: $(FC_DIR_PTC)/Sma_multiparticle.f90 Sma0_beam_beam_ptc.o |
---|
| 95 | Sn_mad_like.o: $(FC_DIR_PTC)/Sn_mad_like.f90 Sma_multiparticle.o |
---|
| 96 | So_fitting.o: $(FC_DIR_PTC)/So_fitting.f90 Sn_mad_like.o |
---|
| 97 | Sp_keywords.o: $(FC_DIR_PTC)/Sp_keywords.f90 So_fitting.o |
---|
| 98 | Spb_fake_gino_sub.o: $(FC_DIR_PTC)/Spb_fake_gino_sub.f90 |
---|
| 99 | Sq_orbit_ptc.o: $(FC_DIR_PTC)/Sq_orbit_ptc.f90 Sp_keywords.o |
---|
| 100 | Sr_spin.o: $(FC_DIR_PTC)/Sr_spin.f90 Sq_orbit_ptc.o |
---|
| 101 | Sra_fitting.o: $(FC_DIR_PTC)/Sra_fitting.f90 Sr_spin.o |
---|
| 102 | St_pointers.o: $(FC_DIR_PTC)/St_pointers.f90 madx_ptc_module.o Sp_keywords.o |
---|
| 103 | |
---|
| 104 | h_definition.o: $(FC_DIR_PTC)/a_def_frame_patch_chart.inc $(FC_DIR_PTC)/a_def_all_kind.inc \ |
---|
| 105 | $(FC_DIR_PTC)/a_def_sagan.inc $(FC_DIR_PTC)/a_def_element_fibre_layout.inc |
---|
| 106 | Sf_def_all_kinds.o: $(FC_DIR_PTC)/a_def_worm.inc |
---|
| 107 | Sp_keywords.o: $(FC_DIR_PTC)/a_namelists.inc |
---|
| 108 | |
---|
| 109 | # chain of dependencies (MAD-X PTC) |
---|
| 110 | madx_ptc_distrib.o: $(FC_DIR_MAD)/madx_ptc_distrib.f90 util.o madx_ptc_module.o |
---|
| 111 | madx_ptc_eplacement.o: $(FC_DIR_MAD)/madx_ptc_eplacement.f90 util.o madx_ptc_intstate.o madx_ptc_module.o Sp_keywords.o |
---|
| 112 | madx_ptc_intstate.o: $(FC_DIR_MAD)/madx_ptc_intstate.f90 Sp_keywords.o |
---|
| 113 | madx_ptc_knobs.o: $(FC_DIR_MAD)/madx_ptc_knobs.f90 util.o madx_ptc_intstate.o Sp_keywords.o |
---|
| 114 | madx_ptc_module.o: $(FC_DIR_MAD)/madx_ptc_module.f90 util.o madx_ptc_setcavs.o madx_ptc_knobs.o Sra_fitting.o |
---|
| 115 | madx_ptc_normal.o: $(FC_DIR_MAD)/madx_ptc_normal.f90 madx_ptc_module.o |
---|
| 116 | madx_ptc_script.o: $(FC_DIR_MAD)/madx_ptc_script.f90 util.o Sp_keywords.o |
---|
| 117 | madx_ptc_setcavs.o: $(FC_DIR_MAD)/madx_ptc_setcavs.f90 madx_ptc_intstate.o Sp_keywords.o |
---|
| 118 | 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 |
---|
| 119 | madx_ptc_track_run.o: $(FC_DIR_MAD)/madx_ptc_track_run.f90 util.o madx_ptc_module.o Sp_keywords.o |
---|
| 120 | 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 |
---|
| 121 | ptc_export_xml.o: $(FC_DIR_MAD)/ptc_export_xml.f90 madx_ptc_module.o |
---|
| 122 | user2_photon.o: $(FC_DIR_MAD)/user2_photon.f90 madx_ptc_track_run.o |
---|
| 123 | ifneq ($(NOWRAP),yes) # wrap is long to compile, with little "true" dependencies |
---|
| 124 | wrap.o: $(FC_DIR_MAD)/wrap.f90 madx_ptc_module.o madx_ptc_intstate.o \ |
---|
| 125 | madx_ptc_normal.o madx_ptc_twiss.o \ |
---|
| 126 | madx_ptc_distrib.o madx_ptc_setcavs.o \ |
---|
| 127 | madx_ptc_trackcavs.o madx_ptc_knobs.o \ |
---|
| 128 | madx_ptc_track_run.o madx_ptc_script.o \ |
---|
| 129 | St_pointers.o ptc_export_xml.o \ |
---|
| 130 | madx_ptc_eplacement.o |
---|
| 131 | endif |
---|
| 132 | madx_ptc_distrib.o: $(FC_DIR_MAD)/madx_ptc_distrib.inc |
---|
| 133 | madx_ptc_knobs.o: $(FC_DIR_MAD)/madx_ptc_knobs.inc |
---|
| 134 | madx_ptc_twiss.o: $(FC_DIR_MAD)/madx_ptc_knobs.inc $(FC_DIR_MAD)/madx_ptc_distrib.inc |
---|
| 135 | user2_photon.o: $(FC_DIR_MAD)/photoni.inc |
---|
| 136 | |
---|
| 137 | # chain of dependencies (MAD-X) |
---|
| 138 | dynap.o: $(FC_DIR_MAD)/dynap.f90 util.o |
---|
| 139 | emit.o: $(FC_DIR_MAD)/emit.f90 util.o |
---|
| 140 | gxx11.o: $(FC_DIR_MAD)/gxx11.f90 util.o |
---|
| 141 | gxx11ps.o: $(FC_DIR_MAD)/gxx11ps.f90 util.o |
---|
| 142 | ibsdb.o: $(FC_DIR_MAD)/ibsdb.f90 util.o |
---|
| 143 | mad_inif_f.o: $(FC_DIR_MAD)/mad_inif_f.F90 |
---|
| 144 | match.o: $(FC_DIR_MAD)/match.f90 util.o |
---|
| 145 | matchjc.o: $(FC_DIR_MAD)/matchjc.f90 util.o match.o matchlib.o |
---|
| 146 | matchlib.o: $(FC_DIR_MAD)/matchlib.f90 matchlib2.o |
---|
| 147 | matchlib2.o: $(FC_DIR_MAD)/matchlib2.f90 |
---|
| 148 | matchsa.o: $(FC_DIR_MAD)/matchsa.f90 util.o |
---|
| 149 | orbf.o: $(FC_DIR_MAD)/orbf.f90 |
---|
| 150 | plot.o: $(FC_DIR_MAD)/plot.f90 util.o |
---|
| 151 | poisson.o: $(FC_DIR_MAD)/poisson.f90 |
---|
| 152 | resindex.o: $(FC_DIR_MAD)/resindex.f90 util.o |
---|
| 153 | sodd.o: $(FC_DIR_MAD)/sodd.f90 util.o |
---|
| 154 | survey.o: $(FC_DIR_MAD)/survey.f90 util.o |
---|
| 155 | timest.o: $(FC_DIR_MAD)/timest.f90 |
---|
| 156 | timex.o: $(FC_DIR_MAD)/timex.f90 |
---|
| 157 | touschek.o: $(FC_DIR_MAD)/touschek.f90 util.o |
---|
| 158 | trrun.o: $(FC_DIR_MAD)/trrun.f90 util.o |
---|
| 159 | trrun_acdip.o: $(FC_DIR_MAD)/trrun_acdip.f90 util.o |
---|
| 160 | trrun_bb.o: $(FC_DIR_MAD)/trrun_bb.f90 util.o |
---|
| 161 | trrun_coll.o: $(FC_DIR_MAD)/trrun_coll.f90 util.o |
---|
| 162 | trrun_phot.o: $(FC_DIR_MAD)/trrun_phot.f90 util.o |
---|
| 163 | twiss.o: $(FC_DIR_MAD)/twiss.f90 util.o |
---|
| 164 | util.o: $(FC_DIR_MAD)/util.f90 |
---|
| 165 | |
---|
| 166 | endif |
---|
| 167 | |
---|
| 168 | ####################### |
---|
| 169 | # check for gfortran version >= 4.4 |
---|
| 170 | # set to gfortran44 on lxplus |
---|
| 171 | # |
---|
| 172 | |
---|
| 173 | ifneq ($(filter $(BUILDGOALS),$(MAKECMDGOALS)),) |
---|
| 174 | ifeq ($(FC),gfortran) |
---|
| 175 | FCVER := $(shell $(FC) -dumpversion) |
---|
| 176 | FCVERL := $(subst ., ,$(FCVER)) |
---|
| 177 | FCVER1 := $(findstring $(word 1,$(FCVERL)),"456789") |
---|
| 178 | FCVER2 := 0 |
---|
| 179 | ifeq ($(FCVER1),4) |
---|
| 180 | FCVER2 := $(findstring $(word 2,$(FCVERL)),"456789") |
---|
| 181 | endif |
---|
| 182 | ifeq ($(and $(FCVER1),$(FCVER2)),) |
---|
| 183 | ifeq ($(findstring lxplus,$(HOST)),lxplus) |
---|
| 184 | $(warning MAD-X requires gfortran >= 4.4 ($(FCVER) detected), FC set to gfortran44) |
---|
| 185 | FC := gfortran44 |
---|
| 186 | FCNAME := gfortran |
---|
| 187 | else |
---|
| 188 | $(error MAD-X requires gfortran >= 4.4 ($(if $(FCVER),$(FCVER),none) detected)) |
---|
| 189 | endif # lxplus |
---|
| 190 | endif # version |
---|
| 191 | endif # gfortran |
---|
| 192 | endif # cmdgoal |
---|
| 193 | |
---|
| 194 | # end of makefile |
---|