Commit 1cdc1a97 authored by Lynn Garren's avatar Lynn Garren

provide version information

parent 4525d08f
2008-08-06 Lynn Garren <garren@fnal.gov>
* configure.in, Makefile.am, build-header.in: automatically
create ClhepVersion.h during the build proceedure
Version information is available as integers and the full string.
2008-07-17 Lynn Garren <garren@fnal.gov>
* various changes in Random to keep gcc 4.3 happy
......
......@@ -40,9 +40,9 @@ else
MAKE_SHARED_CLHEP = $(LN_S) libCLHEP-@VERSION@.$(SHEXT) libCLHEP.$(SHEXT)
endif
CLEANFILES = clheplib library-list $(CLHEPLIB) $(lib_shared)
CLEANFILES = clheplib library-list $(CLHEPLIB) $(lib_shared) ClhepVersion.h
all-local: $(CLHEPLIB) $(lib_shared)
all-local: $(CLHEPLIB) $(lib_shared) versionheader
$(CLHEPLIB):
-rm -f $@
......@@ -74,7 +74,10 @@ install-docs:
clheplib: build-clheplib
./build-clheplib $(SUBDIRS)
install-exec-local: install-CLHEPLIB
versionheader: build-header
./build-header
install-exec-local: install-CLHEPLIB install-versionheader
install-CLHEPLIB: $(CLHEPLIB) $(lib_shared)
@$(NORMAL_INSTALL)
......@@ -111,6 +114,15 @@ install-CLHEPLIB: $(CLHEPLIB) $(lib_shared)
else :; fi; \
done
install-versionheader: versionheader
@$(NORMAL_INSTALL)
test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)"
if test -f ClhepVersion.h; then \
echo " $(INSTALL_DATA) 'ClhepVersion.h' '$(DESTDIR)$(includedir)/ClhepVersion.h'"; \
$(INSTALL_DATA) "ClhepVersion.h" "$(DESTDIR)$(includedir)/ClhepVersion.h"; \
else :; fi
@$(POST_INSTALL)
clean-local:
rm -f *-dep-list
rm -f *-library-list
#! /bin/sh
# @configure_input@
#
# This script creates ClhepVersion.h
#
rm -f ClhepVersion.h
VERSION="@VERSION@"
# decode the version number
v1=`echo $VERSION | awk -F\. '{ print $1 }'`
v2=`echo $VERSION | awk -F\. '{ print $2 }'`
v3=`echo $VERSION | awk -F\. '{ print $3 }'`
v4=`echo $VERSION | awk -F\. '{ print $4 }'`
rm -f ClhepVersion.h
echo "#ifndef CLHEP_VERSION_H" >> ClhepVersion.h
echo "#define CLHEP_VERSION_H 1" >> ClhepVersion.h
echo "//" >> ClhepVersion.h
echo "// ClhepVersion.h" >> ClhepVersion.h
echo "//" >> ClhepVersion.h
echo "// Sample Usage:" >> ClhepVersion.h
echo "// std::string version = CLHEP::Version::String()" >> ClhepVersion.h
echo "// int mjr = CLHEP::Version::Major();" >> ClhepVersion.h
echo "//" >> ClhepVersion.h
echo "" >> ClhepVersion.h
echo "#include <string>" >> ClhepVersion.h
echo "" >> ClhepVersion.h
echo "namespace CLHEP {" >> ClhepVersion.h
echo "" >> ClhepVersion.h
echo " struct Version {" >> ClhepVersion.h
echo "" >> ClhepVersion.h
echo " static std::string String() { return \"$VERSION\"; }" >> ClhepVersion.h
echo " static int Major() { return $v1; }" >> ClhepVersion.h
echo " static int SubMajor() { return $v2; }" >> ClhepVersion.h
echo " static int Minor() { return $v3; }" >> ClhepVersion.h
echo " static int SubMinor() { return $v4; }" >> ClhepVersion.h
echo "" >> ClhepVersion.h
echo " };" >> ClhepVersion.h
echo "" >> ClhepVersion.h
echo "} // namespace" >> ClhepVersion.h
echo "" >> ClhepVersion.h
echo "#endif // CLHEP_VERSION_H" >> ClhepVersion.h
exit 0
......@@ -85,6 +85,9 @@ AC_CONFIG_FILES([makeBinaryTar], [chmod +x makeBinaryTar])
# build clheplib
AC_CONFIG_FILES([build-clheplib], [chmod +x build-clheplib])
# build ClhepVersion.h
AC_CONFIG_FILES([build-header], [chmod +x build-header])
# Configuration inquiry program/script:
AC_CONFIG_FILES([clhep-config], [chmod +x clhep-config])
......
Markdown is supported
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