Commit 303ebd64 authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Rename git revision files to simple version

Add package description function and simple documentation


Former-commit-id: c363b8223a62e9c5752a2e0ade55e3b96e341985
parent e4a02d44
......@@ -11,7 +11,7 @@ config.sub
ltmain.sh
libtool
src/git_revision.h
src/version.h
swift*.tar.gz
doc/doxyfile.stamp
doc/html/
......
......@@ -573,7 +573,7 @@ int main ( int argc , char *argv[] ) {
#endif
/* Greeting message */
message( "This is %s\n", package_version() );
message( "This is %s\n", package_description() );
/* Init the space. */
bzero( &s , sizeof(struct space) );
......
......@@ -40,7 +40,7 @@ include_HEADERS = space.h runner.h queue.h task.h lock.h cell.h part.h const.h \
# Common source files
AM_SOURCES = space.c runner.c queue.c task.c cell.c engine.c \
serial_io.c timers.c debug.c scheduler.c proxy.c parallel_io.c \
units.c common_io.c multipole.c git_revision.c
units.c common_io.c multipole.c version.c
# Include files for distribution, not installation.
noinst_HEADERS = atomic.h cycle.h error.h inline.h kernel.h vector.h \
......@@ -56,16 +56,17 @@ libswiftsim_mpi_la_CFLAGS = $(AM_CFLAGS) -DWITH_MPI
libswiftsim_mpi_la_SHORTNAME = mpi
# Git revision, if any sources change then update the git_revision.h file.
git_revision.h: git_revision.h.in $(AM_SOURCES) $(include_HEADERS) $(noinst_HEADERS)
# Versioning. If any sources change then update the version.h file with
# the current git revision and package version.
version.h: version.h.in $(AM_SOURCES) $(include_HEADERS) $(noinst_HEADERS)
if test "X$(GIT_CMD)" != "X"; then \
GIT_REVISION=`git describe --abbrev=8 --always --tags --dirty`; \
sed -e "s,@PACKAGE_VERSION\@,$(PACKAGE_VERSION)," \
-e "s,@GIT_REVISION\@,$${GIT_REVISION}," git_revision.h.in > git_revision.h; \
-e "s,@GIT_REVISION\@,$${GIT_REVISION}," version.h.in > version.h; \
fi
# Make sure git_revision is built first.
BUILT_SOURCES = git_revision.h
# Make sure version.h is built first.
BUILT_SOURCES = version.h
# And distribute the built file.
EXTRA_DIST = git_revision.h git_revision.h.in
# And distribute the built files.
EXTRA_DIST = version.h version.h.in
......@@ -41,7 +41,7 @@
#include "serial_io.h"
#include "parallel_io.h"
#include "debug.h"
#include "git_revision.h"
#include "version.h"
#ifdef LEGACY_GADGET2_SPH
#include "runner_iact_legacy.h"
......
/*******************************************************************************
* This file is part of SWIFT.
* Coypright (c) 2012 Matthieu Schaller (matthieu.schaller@durham.ac.uk).
* 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
......@@ -18,15 +19,33 @@
******************************************************************************/
#include <stdio.h>
#include "git_revision.h"
#include "version.h"
const char* git_revision( void )
/**
* @brief Return the source code git revision
*
* @details The SHA of the code checked out when the library was last built.
* Will include -dirty if they are local modifications.
*/
const char *git_revision( void )
{
static const char *revision = GIT_REVISION;
return revision;
}
const char* package_version( void )
/**
* @brief The version of SWIFT
*/
const char *package_version( void )
{
static const char *version = PACKAGE_VERSION;
return version;
}
/**
* @brief A description of the package version and code status.
*/
const char *package_description( void )
{
static char buf[256];
static int initialised = 0;
......
......@@ -17,18 +17,19 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#ifndef GIT_REVISION_H
#define GIT_REVISION_H
#ifndef SWIFT_VERSION_H
#define SWIFT_VERSION_H
/**
* @file git_revision.h
* @file version.h.in
* @brief Package version and git revision sha.
*/
#define PACKAGE_VERSION "@PACKAGE_VERSION@"
#define GIT_REVISION "@GIT_REVISION@"
const char* package_description( void );
const char* package_version(void);
const char* git_revision(void);
#endif /* GIT_REVISION_H */
#endif /* SWIFT_VERSION_H */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment