Makefile.am 8.86 KB
Newer Older
1
# This file is part of SWIFT.
2
# Copyright (c) 2012 Pedro Gonnet (pedro.gonnet@durham.ac.uk),
3
#                    Matthieu Schaller (matthieu.schaller@durham.ac.uk).
4
#
Pedro Gonnet's avatar
Pedro Gonnet committed
5
6
7
8
# 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 3 of the License, or
# (at your option) any later version.
9
#
Pedro Gonnet's avatar
Pedro Gonnet committed
10
11
12
13
# 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.
14
#
Pedro Gonnet's avatar
Pedro Gonnet committed
15
16
17
18
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Add the debug flag to the whole thing
19
AM_CFLAGS = $(HDF5_CPPFLAGS) $(GSL_INCS)
Pedro Gonnet's avatar
Pedro Gonnet committed
20
21

# Assign a "safe" version number
lhausamm's avatar
lhausamm committed
22
AM_LDFLAGS = $(HDF5_LDFLAGS) $(FFTW_LIBS) -version-info 0:0:0
Pedro Gonnet's avatar
Pedro Gonnet committed
23

24
25
26
# The git command, if available.
GIT_CMD = @GIT_CMD@

27
# Additional dependencies for shared libraries.
28
EXTRA_LIBS = $(HDF5_LIBS) $(PROFILER_LIBS) $(TCMALLOC_LIBS) $(JEMALLOC_LIBS) $(GRACKLE_LIB) $(GSL_LIBS)
29
30

# MPI libraries.
31
MPI_LIBS = $(METIS_LIBS) $(MPI_THREAD_LIBS)
lhausamm's avatar
lhausamm committed
32
MPI_FLAGS = -DWITH_MPI $(METIS_INCS)
33

34
35
# Build the libswiftsim library
lib_LTLIBRARIES = libswiftsim.la
36
37
38
39
# Build a MPI-enabled version too?
if HAVEMPI
lib_LTLIBRARIES += libswiftsim_mpi.la
endif
Pedro Gonnet's avatar
Pedro Gonnet committed
40
41

# List required headers
Pedro Gonnet's avatar
Pedro Gonnet committed
42
include_HEADERS = space.h runner.h queue.h task.h lock.h cell.h part.h const.h \
43
    engine.h swift.h serial_io.h timers.h debug.h scheduler.h proxy.h parallel_io.h \
44
    common_io.h single_io.h multipole.h map.h tools.h partition.h clocks.h parser.h \
45
    physical_constants.h physical_constants_cgs.h potential.h version.h \
46
    hydro_properties.h riemann.h threadpool.h cooling.h cooling_struct.h sourceterms.h \
47
    sourceterms_struct.h statistics.h memswap.h cache.h runner_doiact_vec.h profiler.h \
48
    dump.h logger.h active.h timeline.h xmf.h gravity_properties.h gravity_derivatives.h \
lhausamm's avatar
lhausamm committed
49
    gravity_softened_derivatives.h vector_power.h collectgroup.h hydro_space.h sort_part.h \
50
    chemistry.h chemistry_io.h chemistry_struct.h cosmology.h restart.h space_getsid.h
51
52
53

# Common source files
AM_SOURCES = space.c runner.c queue.c task.c cell.c engine.c \
54
    serial_io.c timers.c debug.c scheduler.c proxy.c parallel_io.c \
55
    units.c common_io.c single_io.c multipole.c version.c map.c \
Matthieu Schaller's avatar
Matthieu Schaller committed
56
    kernel_hydro.c tools.c part.c partition.c clocks.c parser.c \
57
    physical_constants.c potential.c hydro_properties.c \
58
    runner_doiact_fft.c threadpool.c cooling.c sourceterms.c \
59
    statistics.c runner_doiact_vec.c profiler.c dump.c logger.c \
60
    part_type.c xmf.c gravity_properties.c gravity.c \
lhausamm's avatar
lhausamm committed
61
    collectgroup.c hydro_space.c equation_of_state.c \
62
    chemistry.c cosmology.c restart.c
63
64

# Include files for distribution, not installation.
65
nobase_noinst_HEADERS = align.h approx_math.h atomic.h barrier.h cycle.h error.h inline.h kernel_hydro.h kernel_gravity.h \
66
		 kernel_long_gravity.h vector.h cache.h runner_doiact.h runner_doiact_vec.h runner_doiact_grav.h runner_doiact_fft.h \
67
                 runner_doiact_nosort.h units.h intrinsics.h minmax.h kick.h timestep.h drift.h adiabatic_index.h io_properties.h \
68
		 dimension.h part_type.h periodic.h memswap.h dump.h logger.h \
69
		 gravity.h gravity_io.h gravity_cache.h \
70
		 gravity/Default/gravity.h gravity/Default/gravity_iact.h gravity/Default/gravity_io.h \
71
		 gravity/Default/gravity_debug.h gravity/Default/gravity_part.h  \
Tom Theuns's avatar
Tom Theuns committed
72
		 sourceterms.h \
73
		 equation_of_state.h \
74
		 equation_of_state/ideal_gas/equation_of_state.h equation_of_state/isothermal/equation_of_state.h \
75
	 	 hydro.h hydro_io.h \
76
		 hydro/Minimal/hydro.h hydro/Minimal/hydro_iact.h hydro/Minimal/hydro_io.h \
77
                 hydro/Minimal/hydro_debug.h hydro/Minimal/hydro_part.h \
78
79
80
		 hydro/Default/hydro.h hydro/Default/hydro_iact.h hydro/Default/hydro_io.h \
                 hydro/Default/hydro_debug.h hydro/Default/hydro_part.h \
		 hydro/Gadget2/hydro.h hydro/Gadget2/hydro_iact.h hydro/Gadget2/hydro_io.h \
81
                 hydro/Gadget2/hydro_debug.h hydro/Gadget2/hydro_part.h \
82
83
		 hydro/PressureEntropy/hydro.h hydro/PressureEntropy/hydro_iact.h hydro/PressureEntropy/hydro_io.h \
                 hydro/PressureEntropy/hydro_debug.h hydro/PressureEntropy/hydro_part.h \
84
85
86
87
88
89
90
91
92
		 hydro/Gizmo/hydro.h hydro/Gizmo/hydro_iact.h \
                 hydro/Gizmo/hydro_io.h hydro/Gizmo/hydro_debug.h \
                 hydro/Gizmo/hydro_part.h \
                 hydro/Gizmo/hydro_gradients_gizmo.h \
                 hydro/Gizmo/hydro_gradients.h \
                 hydro/Gizmo/hydro_gradients_sph.h \
                 hydro/Gizmo/hydro_slope_limiters_cell.h \
                 hydro/Gizmo/hydro_slope_limiters_face.h \
                 hydro/Gizmo/hydro_slope_limiters.h \
93
94
                 hydro/Gizmo/hydro_unphysical.h \
                 hydro/Gizmo/hydro_velocities.h \
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
                 hydro/Shadowswift/hydro_debug.h \
                 hydro/Shadowswift/hydro_gradients.h hydro/Shadowswift/hydro.h \
                 hydro/Shadowswift/hydro_iact.h \
                 hydro/Shadowswift/hydro_io.h \
                 hydro/Shadowswift/hydro_part.h \
                 hydro/Shadowswift/hydro_slope_limiters_cell.h \
                 hydro/Shadowswift/hydro_slope_limiters_face.h \
                 hydro/Shadowswift/hydro_slope_limiters.h \
                 hydro/Shadowswift/voronoi1d_algorithm.h \
                 hydro/Shadowswift/voronoi1d_cell.h \
                 hydro/Shadowswift/voronoi2d_algorithm.h \
                 hydro/Shadowswift/voronoi2d_cell.h \
                 hydro/Shadowswift/voronoi3d_algorithm.h \
                 hydro/Shadowswift/voronoi3d_cell.h \
                 hydro/Shadowswift/voronoi_algorithm.h \
                 hydro/Shadowswift/voronoi_cell.h \
111
	         riemann/riemann_hllc.h riemann/riemann_trrs.h \
112
		 riemann/riemann_exact.h riemann/riemann_vacuum.h \
113
	 	 stars.h stars_io.h \
114
115
		 stars/Default/star.h stars/Default/star_iact.h stars/Default/star_io.h \
		 stars/Default/star_debug.h stars/Default/star_part.h  \
116
117
	         potential/none/potential.h potential/point_mass/potential.h \
                 potential/isothermal/potential.h potential/disc_patch/potential.h \
118
                 potential/sine_wave/potential.h \
119
		 cooling/none/cooling.h cooling/none/cooling_struct.h \
120
	         cooling/const_du/cooling.h cooling/const_du/cooling_struct.h \
121
                 cooling/const_lambda/cooling.h cooling/const_lambda/cooling_struct.h \
lhausamm's avatar
lhausamm committed
122
                 cooling/grackle/cooling.h cooling/grackle/cooling_struct.h \
123
		 cooling/EAGLE/cooling.h cooling/EAGLE/cooling_struct.h \
lhausamm's avatar
lhausamm committed
124
125
                 chemistry/none/chemistry.h \
		 chemistry/none/chemistry_io.h \
lhausamm's avatar
lhausamm committed
126
		 chemistry/none/chemistry_struct.h \
127
		 chemistry/none/chemistry_iact.h \
128
129
                 chemistry/gear/chemistry.h \
		 chemistry/gear/chemistry_io.h \
130
		 chemistry/gear/chemistry_struct.h \
131
		 chemistry/gear/chemistry_iact.h \
132
133
                 chemistry/EAGLE/chemistry.h \
		 chemistry/EAGLE/chemistry_io.h \
134
		 chemistry/EAGLE/chemistry_struct.h\
135
136
		 chemistry/EAGLE/chemistry_iact.h \
     space_getsid.h
137

138

139
140
# Sources and flags for regular library
libswiftsim_la_SOURCES = $(AM_SOURCES)
141
142
libswiftsim_la_CFLAGS = $(AM_CFLAGS)
libswiftsim_la_LDFLAGS = $(AM_LDFLAGS) $(EXTRA_LIBS)
143
libswiftsim_la_LIBADD = $(GRACKLE_LIBS)
144
145
146

# Sources and flags for MPI library
libswiftsim_mpi_la_SOURCES = $(AM_SOURCES)
147
148
libswiftsim_mpi_la_CFLAGS = $(AM_CFLAGS) $(MPI_FLAGS)
libswiftsim_mpi_la_LDFLAGS = $(AM_LDFLAGS) $(MPI_LIBS) $(EXTRA_LIBS)
149
libswiftsim_mpi_la_SHORTNAME = mpi
150
libswiftsim_mpi_la_LIBADD = $(GRACKLE_LIBS)
Pedro Gonnet's avatar
Pedro Gonnet committed
151

152

Matthieu Schaller's avatar
Matthieu Schaller committed
153
# Versioning. If any sources change then update the version_string.h file with
154
# the current git revision and package version.
Matthieu Schaller's avatar
Matthieu Schaller committed
155
# May have a checkout without a version_string.h file and no git command (tar/zip
156
# download), allow that, but make sure we know it.
Matthieu Schaller's avatar
Matthieu Schaller committed
157
version_string.h: version_string.h.in $(AM_SOURCES) $(include_HEADERS) $(noinst_HEADERS)
158
	if test "X$(GIT_CMD)" != "X"; then \
159
	    GIT_REVISION=`$(GIT_CMD) describe --abbrev=8  --always --tags --dirty`; \
160
	    GIT_BRANCH=`$(GIT_CMD) branch | sed -n 's/^\* \(.*\)/\1/p'`; \
161
            GIT_DATE=`$(GIT_CMD) log -1 --format=%ci`; \
162
	    sed -e "s,@PACKAGE_VERSION\@,$(PACKAGE_VERSION)," \
163
	        -e "s,@GIT_REVISION\@,$${GIT_REVISION}," \
164
	        -e "s|@GIT_BRANCH\@|$${GIT_BRANCH}|" \
165
	        -e "s|@GIT_DATE\@|$${GIT_DATE}|" \
166
	        -e "s|@SWIFT_CFLAGS\@|$(CFLAGS)|" $< > version_string.h; \
167
	else \
Matthieu Schaller's avatar
Matthieu Schaller committed
168
	    if test ! -f version_string.h; then \
169
	        sed -e "s,@PACKAGE_VERSION\@,$(PACKAGE_VERSION)," \
170
	            -e "s,@GIT_REVISION\@,unknown," \
171
		    -e "s,@GIT_BRANCH\@,unknown," \
172
		    -e "s,@GIT_DATE\@,unknown," \
173
	            -e "s|@SWIFT_CFLAGS\@|$(CFLAGS)|" $< > version_string.h; \
174
	    fi; \
175
	fi
176

Matthieu Schaller's avatar
Matthieu Schaller committed
177
178
#  Make sure version_string.h is built first.
BUILT_SOURCES = version_string.h
179

180
#  And distribute the built files.
Matthieu Schaller's avatar
Matthieu Schaller committed
181
EXTRA_DIST = version_string.h version_string.h.in