From 2c24c3d4057eb9d53e56939fc706655a553f5e8f Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Fri, 23 Mar 2012 08:42:03 -0400 Subject: [PATCH] Added git SHA1 hash on output through Makefile symbol. --- src/Makefile | 8 +++++++- src/output.F90 | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index 14b74bd85a..a5c9237e2f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -22,6 +22,12 @@ OPTIMIZE = no USE_MPI = no USE_HDF5 = no +#=============================================================================== +# Add git SHA-1 hash +#=============================================================================== + +GIT_SHA1 = $(shell git log -1 | head -n 1 | awk '{print $$2}') + #=============================================================================== # GNU Fortran compiler options #=============================================================================== @@ -212,7 +218,7 @@ neat: .PHONY: all xml-fortran clean neat distclean %.o: %.F90 - $(F90) $(F90FLAGS) -Ixml-fortran -Ixml-fortran/templates -c $< + $(F90) $(F90FLAGS) -DGIT_SHA1="\"$(GIT_SHA1)\"" -Ixml-fortran -Ixml-fortran/templates -c $< #=============================================================================== # Dependencies diff --git a/src/output.F90 b/src/output.F90 index 920d9643f7..c389fab8d1 100644 --- a/src/output.F90 +++ b/src/output.F90 @@ -50,6 +50,9 @@ contains ' Developed At: Massachusetts Institute of Technology' write(UNIT=OUTPUT_UNIT, FMT='(6X,"Version:",7X,I1,".",I1,".",I1)') & VERSION_MAJOR, VERSION_MINOR, VERSION_RELEASE +#ifdef GIT_SHA1 + write(UNIT=OUTPUT_UNIT, FMT='(6X,"Git SHA1:",6X,A)') GIT_SHA1 +#endif ! Write the date and time call get_today(today_date, today_time)