use git describe for header version, but use existing wmake framework

This commit is contained in:
Mark Olesen
2008-12-18 19:54:13 +01:00
parent ae9057c9fe
commit b5f06a3833
4 changed files with 24 additions and 3 deletions

View File

@ -2,6 +2,9 @@
cd ${0%/*} || exit 1 # run from this directory
set -x
# force update of Foam::FOAMversion string (git tag or $WM_PROJECT_VERSION)
/bin/rm -f OpenFOAM/Make/$WM_OPTIONS/global.? 2>/dev/null
wmakeLnInclude -f OpenFOAM
wmakeLnInclude -f OSspecific/$WM_OS
Pstream/Allwmake

View File

@ -31,13 +31,22 @@ License
template<class Stream>
inline void Foam::IOobject::writeBanner(Stream& os, bool noHint)
{
static bool spacesSet = false;
static bool spacesSet(false);
static char spaces[40];
if (!spacesSet)
{
memset(spaces, ' ', 40);
spaces[38 - strlen(Foam::FOAMversion)] = '\0';
size_t len = strlen(Foam::FOAMversion);
if (len < 38)
{
spaces[38 - len] = '\0';
}
else
{
spaces[0] = '\0';
}
spacesSet = true;
}

View File

@ -1,6 +1,15 @@
.SUFFIXES: .Cver
Cvertoo = sed s/WM_PROJECT_VERSION/\"$(WM_PROJECT_VERSION)\"/ $$SOURCE > $*.C ; $(CC) $(c++FLAGS) -c $*.C -o $@
#
# update version string from git, or just use the WM_PROJECT_VERSION
# note: could also add --abbrev=32 for maximum resolution
#
Cvertoo = \
sed s/WM_PROJECT_VERSION/\"$(shell \
git describe --always --tags 2>/dev/null || \
echo $(WM_PROJECT_VERSION) \
)\"/ $$SOURCE > $*.C; \
$(CC) $(c++FLAGS) -c $*.C -o $@
.Cver.dep:
$(MAKE_DEP)