Makefile.am 8.12 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
lhausamm's avatar
lhausamm committed
19
AM_CFLAGS = $(HDF5_CPPFLAGS)
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.
lhausamm's avatar
lhausamm committed
28
EXTRA_LIBS = $(HDF5_LIBS) $(PROFILER_LIBS) $(TCMALLOC_LIBS) $(JEMALLOC_LIBS) $(GRACKLE_LIB)
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 \
49
    gravity_softened_derivatives.h vector_power.h collectgroup.h hydro_space.h sort_part.h
50
51
52

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

62
63

# Include files for distribution, not installation.
64
nobase_noinst_HEADERS = align.h approx_math.h atomic.h barrier.h cycle.h error.h inline.h kernel_hydro.h kernel_gravity.h \
65
		 kernel_long_gravity.h vector.h cache.h runner_doiact.h runner_doiact_vec.h runner_doiact_grav.h runner_doiact_fft.h \
66
                 runner_doiact_nosort.h units.h intrinsics.h minmax.h kick.h timestep.h drift.h adiabatic_index.h io_properties.h \
67
		 dimension.h equation_of_state.h part_type.h periodic.h \
68
		 gravity.h gravity_io.h gravity_cache.h \
69
		 gravity/Default/gravity.h gravity/Default/gravity_iact.h gravity/Default/gravity_io.h \
70
		 gravity/Default/gravity_debug.h gravity/Default/gravity_part.h  \
Tom Theuns's avatar
Tom Theuns committed
71
		 sourceterms.h \
72
	 	 hydro.h hydro_io.h \
73
		 hydro/Minimal/hydro.h hydro/Minimal/hydro_iact.h hydro/Minimal/hydro_io.h \
74
                 hydro/Minimal/hydro_debug.h hydro/Minimal/hydro_part.h \
75
76
77
		 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 \
78
                 hydro/Gadget2/hydro_debug.h hydro/Gadget2/hydro_part.h \
79
80
		 hydro/PressureEntropy/hydro.h hydro/PressureEntropy/hydro_iact.h hydro/PressureEntropy/hydro_io.h \
                 hydro/PressureEntropy/hydro_debug.h hydro/PressureEntropy/hydro_part.h \
81
82
83
84
85
86
87
88
89
		 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 \
90
91
                 hydro/Gizmo/hydro_unphysical.h \
                 hydro/Gizmo/hydro_velocities.h \
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
                 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 \
108
	         riemann/riemann_hllc.h riemann/riemann_trrs.h \
109
		 riemann/riemann_exact.h riemann/riemann_vacuum.h \
110
	 	 stars.h stars_io.h \
111
112
		 stars/Default/star.h stars/Default/star_iact.h stars/Default/star_io.h \
		 stars/Default/star_debug.h stars/Default/star_part.h  \
113
114
	         potential/none/potential.h potential/point_mass/potential.h \
                 potential/isothermal/potential.h potential/disc_patch/potential.h \
115
                 potential/sine_wave/potential.h \
116
		 cooling/none/cooling.h cooling/none/cooling_struct.h \
117
	         cooling/const_du/cooling.h cooling/const_du/cooling_struct.h \
118
                 cooling/const_lambda/cooling.h cooling/const_lambda/cooling_struct.h \
lhausamm's avatar
lhausamm committed
119
120
                 cooling/grackle/cooling.h cooling/grackle/cooling_struct.h \
		 cooling/grackle/grackle_wrapper.h \
121
                 memswap.h dump.h logger.h
122

123

124
125
# Sources and flags for regular library
libswiftsim_la_SOURCES = $(AM_SOURCES)
126
127
libswiftsim_la_CFLAGS = $(AM_CFLAGS)
libswiftsim_la_LDFLAGS = $(AM_LDFLAGS) $(EXTRA_LIBS)
128
libswiftsim_la_LIBADD = $(GRACKLE_LIBS)
129
130
131

# Sources and flags for MPI library
libswiftsim_mpi_la_SOURCES = $(AM_SOURCES)
132
133
libswiftsim_mpi_la_CFLAGS = $(AM_CFLAGS) $(MPI_FLAGS)
libswiftsim_mpi_la_LDFLAGS = $(AM_LDFLAGS) $(MPI_LIBS) $(EXTRA_LIBS)
134
libswiftsim_mpi_la_SHORTNAME = mpi
135
libswiftsim_mpi_la_LIBADD = $(GRACKLE_LIBS)
Pedro Gonnet's avatar
Pedro Gonnet committed
136

137

Matthieu Schaller's avatar
Matthieu Schaller committed
138
# Versioning. If any sources change then update the version_string.h file with
139
# the current git revision and package version.
Matthieu Schaller's avatar
Matthieu Schaller committed
140
# May have a checkout without a version_string.h file and no git command (tar/zip
141
# download), allow that, but make sure we know it.
Matthieu Schaller's avatar
Matthieu Schaller committed
142
version_string.h: version_string.h.in $(AM_SOURCES) $(include_HEADERS) $(noinst_HEADERS)
143
	if test "X$(GIT_CMD)" != "X"; then \
144
	    GIT_REVISION=`$(GIT_CMD) describe --abbrev=8  --always --tags --dirty`; \
145
	    GIT_BRANCH=`$(GIT_CMD) branch | sed -n 's/^\* \(.*\)/\1/p'`; \
146
            GIT_DATE=`$(GIT_CMD) log -1 --format=%ci`; \
147
	    sed -e "s,@PACKAGE_VERSION\@,$(PACKAGE_VERSION)," \
148
	        -e "s,@GIT_REVISION\@,$${GIT_REVISION}," \
149
	        -e "s|@GIT_BRANCH\@|$${GIT_BRANCH}|" \
150
	        -e "s|@GIT_DATE\@|$${GIT_DATE}|" \
151
	        -e "s|@SWIFT_CFLAGS\@|$(CFLAGS)|" $< > version_string.h; \
152
	else \
Matthieu Schaller's avatar
Matthieu Schaller committed
153
	    if test ! -f version_string.h; then \
154
	        sed -e "s,@PACKAGE_VERSION\@,$(PACKAGE_VERSION)," \
155
	            -e "s,@GIT_REVISION\@,unknown," \
156
		    -e "s,@GIT_BRANCH\@,unknown," \
157
		    -e "s,@GIT_DATE\@,unknown," \
158
	            -e "s|@SWIFT_CFLAGS\@|$(CFLAGS)|" $< > version_string.h; \
159
	    fi; \
160
	fi
161

Matthieu Schaller's avatar
Matthieu Schaller committed
162
163
#  Make sure version_string.h is built first.
BUILT_SOURCES = version_string.h
164

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