mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-11-04 05:54:32 +00:00 
			
		
		
		
	better Version.h implementation
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -114,4 +114,3 @@ gh-pages/
 | 
			
		||||
#####################
 | 
			
		||||
Grid/qcd/spin/gamma-gen/*.h
 | 
			
		||||
Grid/qcd/spin/gamma-gen/*.cc
 | 
			
		||||
Grid/version.h
 | 
			
		||||
 
 | 
			
		||||
@@ -21,6 +21,28 @@ if BUILD_HDF5
 | 
			
		||||
  extra_headers+=serialisation/Hdf5Type.h
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
all: version-cache
 | 
			
		||||
 | 
			
		||||
version-cache:
 | 
			
		||||
	if [ `git status --porcelain | wc -l` -gt 0 ]; then\
 | 
			
		||||
		a="uncommited changes";\
 | 
			
		||||
	else\
 | 
			
		||||
		a="no uncommitted changes";\
 | 
			
		||||
	fi;\
 | 
			
		||||
	echo "`git log -n 1 --format=format:"#define GITHASH \\"%H:%d $$a\\"%n" HEAD`" > vertmp;\
 | 
			
		||||
	if [ -e version-cache ]; then\
 | 
			
		||||
		d=`diff vertmp version-cache`;\
 | 
			
		||||
		[ "${d}" != "" ] && mv vertmp version-cache;\
 | 
			
		||||
	else\
 | 
			
		||||
		mv vertmp version-cache;\
 | 
			
		||||
	fi;\
 | 
			
		||||
	rm -f vertmp
 | 
			
		||||
 | 
			
		||||
Version.h:
 | 
			
		||||
	echo "`git log -n 1 --format=format:"#define GITHASH \\"%H:%d $$a\\"%n" HEAD`" > Version.h
 | 
			
		||||
 | 
			
		||||
.PHONY: version-cache
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Libraries
 | 
			
		||||
#
 | 
			
		||||
@@ -30,8 +52,8 @@ include Eigen.inc
 | 
			
		||||
lib_LIBRARIES = libGrid.a
 | 
			
		||||
 | 
			
		||||
CCFILES += $(extra_sources)
 | 
			
		||||
HFILES  += $(extra_headers)
 | 
			
		||||
HFILES  += $(extra_headers) Config.h Version.h
 | 
			
		||||
 | 
			
		||||
libGrid_a_SOURCES              = $(CCFILES)
 | 
			
		||||
libGrid_adir                   = $(includedir)/Grid
 | 
			
		||||
nobase_dist_pkginclude_HEADERS = $(HFILES) $(eigen_files) $(eigen_unsupp_files) Config.h
 | 
			
		||||
nobase_dist_pkginclude_HEADERS = $(HFILES) $(eigen_files) $(eigen_unsupp_files)
 | 
			
		||||
 
 | 
			
		||||
@@ -49,7 +49,6 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
 | 
			
		||||
#include <Grid/Grid.h>
 | 
			
		||||
 | 
			
		||||
#include <Grid/util/CompilerCompatible.h>
 | 
			
		||||
#include <version.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include <fenv.h>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
#include <iostream>
 | 
			
		||||
#include <version.h>
 | 
			
		||||
#include "Version.h"
 | 
			
		||||
namespace Grid {
 | 
			
		||||
  void printHash(){
 | 
			
		||||
#ifdef GITHASH
 | 
			
		||||
 
 | 
			
		||||
@@ -5,11 +5,6 @@ include $(top_srcdir)/doxygen.inc
 | 
			
		||||
 | 
			
		||||
bin_SCRIPTS=grid-config
 | 
			
		||||
 | 
			
		||||
BUILT_SOURCES = version.h
 | 
			
		||||
 | 
			
		||||
version.h:
 | 
			
		||||
	if [ `git status --porcelain | wc -l` -gt 0 ]; then a="uncommited changes"; else a="no uncommitted changes"; fi; echo "`git log -n 1 --format=format:"#define GITHASH \\"%H:%d $$a\\"%n" HEAD`" > $(srcdir)/Grid/version.h
 | 
			
		||||
 | 
			
		||||
.PHONY: bench check tests doxygen-run doxygen-doc $(DX_PS_GOAL) $(DX_PDF_GOAL)
 | 
			
		||||
 | 
			
		||||
tests-local: all
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user