Skip to content
Browse files
Makefile: write git-ref file to track git revision
fixes #16
  • Loading branch information
dev-zero committed Sep 2, 2019
1 parent 86c1134 commit ae9949d76d96721bff101ddc4761d6df19119685
Showing with 11 additions and 4 deletions.
  1. +11 −4 Makefile
@@ -426,10 +426,17 @@ vpath $(ALL_SRC_DIRS)
# Add additional dependency of cp2k_info.F to git-HEAD.
# Ensuring that cp2k prints the correct source code revision number in its banner.
GIT_HEAD := $(wildcard $(CP2KHOME)/../.git/HEAD*)
ifneq ($(strip $(GIT_HEAD)),)
cp2k_info.o: $(GIT_HEAD)
GIT_REF := ${MAINOBJDIR}/git-ref

# use a force (fake) target to always rebuild this file but have Make consider this updated
# iff it was actually rewritten (a .PHONY target is always considered new)
@$(CP2KHOME)/tools/build_utils/get_revision_number $(SRCDIR) > "$@.tmp"
@cmp "$@.tmp" "$@" || mv -f "$@.tmp" "$@"


cp2k_info.o: $(GIT_REF)

# Add some practical metadata about the build.

0 comments on commit ae9949d

Please sign in to comment.