diff --git a/.gitignore b/.gitignore index 277a14d0ce27af31ef94e9169bfb2ee49c24d2fb..92a16483158de70ccdac93cb13797824cafd1337 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,7 @@ config.sub ltmain.sh libtool -src/version.h +src/version_string.h swift*.tar.gz doc/doxyfile.stamp doc/html/ diff --git a/src/Makefile.am b/src/Makefile.am index 65f093b014ed16577c4f0f36bf4636da223e6929..57ca1e59742b9a1ce482c56909c1a5684445e32e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -36,7 +36,7 @@ endif include_HEADERS = space.h runner.h queue.h task.h lock.h cell.h part.h const.h \ engine.h swift.h serial_io.h timers.h debug.h scheduler.h proxy.h parallel_io.h \ common_io.h single_io.h multipole.h map.h tools.h partition.h clocks.h parser.h \ - physical_constants.h physical_constants_cgs.h potentials.h + physical_constants.h physical_constants_cgs.h potentials.h version.h # Common source files AM_SOURCES = space.c runner.c queue.c task.c cell.c engine.c \ @@ -72,27 +72,27 @@ libswiftsim_mpi_la_CFLAGS = $(AM_CFLAGS) -DWITH_MPI $(METIS_INCS) libswiftsim_mpi_la_SHORTNAME = mpi -# Versioning. If any sources change then update the version.h file with +# Versioning. If any sources change then update the version_string.h file with # the current git revision and package version. -# May have a checkout without a version.h file and no git command (tar/zip +# May have a checkout without a version_string.h file and no git command (tar/zip # download), allow that, but make sure we know it. -version.h: version.h.in $(AM_SOURCES) $(include_HEADERS) $(noinst_HEADERS) +version_string.h: version_string.h.in $(AM_SOURCES) $(include_HEADERS) $(noinst_HEADERS) if test "X$(GIT_CMD)" != "X"; then \ GIT_REVISION=`$(GIT_CMD) describe --abbrev=8 --always --tags --dirty`; \ GIT_BRANCH=`$(GIT_CMD) branch | sed -n 's/^\* \(.*\)/\1/p'`; \ sed -e "s,@PACKAGE_VERSION\@,$(PACKAGE_VERSION)," \ -e "s,@GIT_REVISION\@,$${GIT_REVISION}," \ - -e "s|@GIT_BRANCH\@|$${GIT_BRANCH}|" version.h.in > version.h; \ + -e "s|@GIT_BRANCH\@|$${GIT_BRANCH}|" version_string.h.in > version_string.h; \ else \ - if test ! -f version.h; then \ + if test ! -f version_string.h; then \ sed -e "s,@PACKAGE_VERSION\@,$(PACKAGE_VERSION)," \ -e "s,@GIT_REVISION\@,unknown," \ - -e "s,@GIT_BRANCH\@,unknown," version.h.in > version.h; \ + -e "s,@GIT_BRANCH\@,unknown," version_string.h.in > version_string.h; \ fi; \ fi -# Make sure version.h is built first. -BUILT_SOURCES = version.h +# Make sure version_string.h is built first. +BUILT_SOURCES = version_string.h # And distribute the built files. -EXTRA_DIST = version.h version.h.in +EXTRA_DIST = version_string.h version_string.h.in diff --git a/src/version.c b/src/version.c index 27841a16019a69442e66b21c327f4241e440fb12..ab22c0d9ab8841dedd09aa83aa8803e468e69ce9 100644 --- a/src/version.c +++ b/src/version.c @@ -40,6 +40,9 @@ /* This object's header. */ #include "version.h" +/* Local headers. */ +#include "version_string.h" + /** * @brief Return the source code git revision * diff --git a/src/version.h.in b/src/version.h similarity index 82% rename from src/version.h.in rename to src/version.h index 7824e06b996dfbb4178b57f1b72365a1e2d24484..4b6b38d220b36e5cb340571cd89e6f52a7b21a8e 100644 --- a/src/version.h.in +++ b/src/version.h @@ -2,33 +2,24 @@ * This file is part of SWIFT. * Copyright (c) 2012 Matthieu Schaller (matthieu.schaller@durham.ac.uk). * Copyright (c) 2015 Peter W. Draper (p.w.draper@durham.ac.uk). - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * 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. - * + * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. - * + * ******************************************************************************/ #ifndef SWIFT_VERSION_H #define SWIFT_VERSION_H -/** - * @file version.h - * @brief Package version, git revision sha and compiler info. - */ - -#define PACKAGE_VERSION "@PACKAGE_VERSION@" -#define GIT_REVISION "@GIT_REVISION@" -#define GIT_BRANCH "@GIT_BRANCH@" - const char* package_description(void); const char* package_version(void); const char* git_revision(void); @@ -36,8 +27,8 @@ const char* git_branch(void); const char* compiler_name(void); const char* compiler_version(void); const char* mpi_version(void); -const char *hdf5_version(void); -const char *metis_version(void); +const char* hdf5_version(void); +const char* metis_version(void); void greetings(void); #endif /* SWIFT_VERSION_H */ diff --git a/src/version_string.h.in b/src/version_string.h.in new file mode 100644 index 0000000000000000000000000000000000000000..e4d62c77788dbb79e718f54fd5a1da78b90a170e --- /dev/null +++ b/src/version_string.h.in @@ -0,0 +1,32 @@ +/******************************************************************************* + * This file is part of SWIFT. + * Copyright (c) 2012 Matthieu Schaller (matthieu.schaller@durham.ac.uk). + * Copyright (c) 2015 Peter W. Draper (p.w.draper@durham.ac.uk). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + ******************************************************************************/ +#ifndef SWIFT_VERSION_STRING_H +#define SWIFT_VERSION_STRING_H + +/** + * @file version_string.h + * @brief Package version, git revision sha and compiler info. + */ + +#define PACKAGE_VERSION "@PACKAGE_VERSION@" +#define GIT_REVISION "@GIT_REVISION@" +#define GIT_BRANCH "@GIT_BRANCH@" + +#endif /* SWIFT_VERSION_STRING_H */