aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPjotr Prins2017-10-26 08:07:28 +0000
committerPjotr Prins2017-10-26 08:07:28 +0000
commit3f2ebeba716ccc04f08e4245db4ffbc377c10206 (patch)
tree566fb7c2b5e8268ebc7d871c2fc88e1ca83c06b3
parentf9eacf6637b091c794a4692cfd0646c9a5bcf35a (diff)
downloadpangemma-3f2ebeba716ccc04f08e4245db4ffbc377c10206.tar.gz
VERSION now contains the GEMMA version number. A script generates a header
file named ./src/version.h. See Makefile for details.
-rw-r--r--.gitignore1
-rw-r--r--Makefile17
-rw-r--r--VERSION1
-rwxr-xr-xscripts/gen_version_info.sh12
-rw-r--r--src/gemma.cpp5
5 files changed, 29 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore
index ef520c8..059da73 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
*.o
*.tar.gz
src/Eigen
+src/version.h
example/output
test/output
./output
diff --git a/Makefile b/Makefile
index c57567b..2d91a49 100644
--- a/Makefile
+++ b/Makefile
@@ -38,10 +38,12 @@
#
# https://github.com/genetics-statistics/GEMMA/blob/master/INSTALL.md
+GEMMA_VERSION = $(shell cat ./VERSION)
+
# Set this variable to either LNX or MAC
SYS = LNX # LNX|MAC (Linux is the default)
# Leave blank after "=" to disable; put "= 1" to enable
-DIST_NAME = gemma-0.97.3
+DIST_NAME = gemma-$(GEMMA_VERSION)
DEBUG = 1 # DEBUG mode, set DEBUG=0 for a release
SHOW_COMPILER_WARNINGS =
WITH_LAPACK = 1
@@ -132,13 +134,16 @@ ifdef WITH_LAPACK
endif
endif
-HDR = $(wildcard src/*.h)
+HDR = $(wildcard src/*.h) ./src/version.h
SOURCES = $(wildcard src/*.cpp)
# all
OBJS = $(SOURCES:.cpp=.o)
-all: $(OUTPUT)
+./src/version.h:
+ ./scripts/gen_version_info.sh > src/version.h
+
+all: ./src/version.h $(OUTPUT)
$(OUTPUT): $(OBJS)
$(CPP) $(CPPFLAGS) $(OBJS) $(LIBS) -o $(OUTPUT)
@@ -173,16 +178,18 @@ check: fast-check slow-check
check-all: check lengthy-check
clean:
+ rm $(SRC_DIR)/version.h
rm -vf $(SRC_DIR)/*.o
rm -vf $(SRC_DIR)/*~
rm -vf $(TEST_SRC_DIR)/*.o
rm -vf $(OUTPUT)
rm -vf ./bin/unittests-gemma
-DIST_COMMON = COPYING.txt README.txt Makefile
+DIST_COMMON = *.md LICENSE VERSION Makefile
DIST_SUBDIRS = src doc example bin
-tar:
+tar: version all
+ @echo "Creating $(DIST_NAME)"
mkdir -p ./$(DIST_NAME)
cp $(DIST_COMMON) ./$(DIST_NAME)/
cp -r $(DIST_SUBDIRS) ./$(DIST_NAME)/
diff --git a/VERSION b/VERSION
new file mode 100644
index 0000000..09f968e
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+0.97-pre3
diff --git a/scripts/gen_version_info.sh b/scripts/gen_version_info.sh
new file mode 100755
index 0000000..8a9e38d
--- /dev/null
+++ b/scripts/gen_version_info.sh
@@ -0,0 +1,12 @@
+#! /bin/bash
+#
+# Script to generate the version info of GEMMA and its environment
+# in ./src/version.h
+
+DATE=$(date "+%Y/%m/%d")
+YEAR=$(date "+%Y")
+
+echo // version.h generated by GEMMA $0
+echo \#define GEMMA_VERSION \"$(cat ./VERSION)\"
+echo \#define GEMMA_DATE \"$DATE\"
+echo \#define GEMMA_YEAR \"$YEAR\"
diff --git a/src/gemma.cpp b/src/gemma.cpp
index 650ba43..2c54672 100644
--- a/src/gemma.cpp
+++ b/src/gemma.cpp
@@ -57,10 +57,11 @@ extern "C" {
#include "varcov.h"
#include "vc.h"
#include "debug.h"
+#include "version.h"
using namespace std;
-GEMMA::GEMMA(void) : version("0.97.3"), date("10/10/2017"), year("2017") {}
+GEMMA::GEMMA(void) : version(GEMMA_VERSION), date(GEMMA_DATE), year(GEMMA_YEAR) {}
void gemma_gsl_error_handler (const char * reason,
const char * file,
@@ -3103,7 +3104,7 @@ void GEMMA::WriteLog(int argc, char **argv, PARAM &cPar) {
}
outfile << "##" << endl;
- outfile << "## GEMMA Version = " << version << endl;
+ outfile << "## GEMMA Version = " << version << " (" << date << ")" << endl;
outfile << "## GSL Version = " << GSL_VERSION << endl;
outfile << "## Eigen Version = " << EIGEN_WORLD_VERSION << "." << EIGEN_MAJOR_VERSION << "." << EIGEN_MINOR_VERSION << endl;
#ifdef OPENBLAS