Also do as cmake to avoid full recompilation when the hash changes.
AC_SUBST(lyx_devel_version)
])
AC_SUBST(lyx_devel_version)
])
-dnl If LyX is compiled from a git clone, find the HEAD commit hash
-dnl
-dnl
-AC_DEFUN([LYX_CHECK_GIT_COMMIT], [
-AC_MSG_CHECKING([for git commit hash])
-lyxgitcommit=`cd "$srcdir" && git log -1 --pretty=format:%H 2>/dev/null || true`
-test x$lyxgitcommit = x && lyxgitcommit="none"
-AC_MSG_RESULT($lyxgitcommit)
-])
-
dnl Define the option to set a LyX version on installed executables and directories
dnl
dnl Define the option to set a LyX version on installed executables and directories
dnl
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
PACKAGE=$save_PACKAGE
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
PACKAGE=$save_PACKAGE
# Allow to build some parts of the code as one big chunk
m4_define([ALLPARTS],[boost,client,insets,mathed,core,tex2lyx,frontend_qt])
AC_ARG_ENABLE(monolithic-build,
# Allow to build some parts of the code as one big chunk
m4_define([ALLPARTS],[boost,client,insets,mathed,core,tex2lyx,frontend_qt])
AC_ARG_ENABLE(monolithic-build,
"${version_suffix}",[Program version suffix])
AC_DEFINE_UNQUOTED([LYX_DATE],"$LYX_DATE",[Date of release])
"${version_suffix}",[Program version suffix])
AC_DEFINE_UNQUOTED([LYX_DATE],"$LYX_DATE",[Date of release])
-AC_DEFINE_UNQUOTED([LYX_GIT_COMMIT_HASH], "$lyxgitcommit", [Git commit])
AC_DEFINE_UNQUOTED([VERSION_INFO],"$VERSION_INFO",[Full version info])
AC_DEFINE_UNQUOTED([LYX_DIR_VER],"$lyx_dir_ver",[Versioned env var for system dir])
AC_DEFINE_UNQUOTED([LYX_USERDIR_VER],"$lyx_userdir_ver",[Versioned env var for user dir])
AC_DEFINE_UNQUOTED([VERSION_INFO],"$VERSION_INFO",[Full version info])
AC_DEFINE_UNQUOTED([LYX_DIR_VER],"$lyx_dir_ver",[Versioned env var for system dir])
AC_DEFINE_UNQUOTED([LYX_USERDIR_VER],"$lyx_userdir_ver",[Versioned env var for user dir])
SUBDIRS = support frontends . $(CLIENT) tex2lyx
SUBDIRS = support frontends . $(CLIENT) tex2lyx
+EXTRA_DIST = lyx_commit_hash.h.in \
+ pch.h \
CMakeLists.txt \
graphics/CMakeLists.txt \
insets/CMakeLists.txt \
CMakeLists.txt \
graphics/CMakeLists.txt \
insets/CMakeLists.txt \
STANDALONEFILES = \
Layout.cpp
STANDALONEFILES = \
Layout.cpp
+.PHONY: lyx_commit_hash.h
+
+lyx_commit_hash.h:
+ $(AM_V_GEN)hash=`cd "$(top_srcdir)" && git log -1 --pretty=format:%H 2>/dev/null || echo none` ; \
+ sed s/@LYX_GIT_COMMIT_HASH@/$$hash/ "$(srcdir)"/lyx_commit_hash.h.in >$@
+BUILT_SOURCES += lyx_commit_hash.h
+CLEANFILES += lyx_commit_hash.h
lyxcore.cpp:
@echo -e '$(SOURCEFILESCORE:%=\n#include "%")\n' > $@
lyxcore.cpp:
@echo -e '$(SOURCEFILESCORE:%=\n#include "%")\n' > $@
CLEANFILES += $(MOCEDFILES)
moc_%.cpp: %.h
CLEANFILES += $(MOCEDFILES)
moc_%.cpp: %.h
- $(QT_MOC) $(MOCFLAG) -o $@ $<
+ $(AM_V_GEN)$(QT_MOC) $(MOCFLAG) -o $@ $<
liblyxcore_a_DEPENDENCIES = $(MOCEDFILES)
liblyxcore_a_DEPENDENCIES = $(MOCEDFILES)
--- /dev/null
+/*
+ * \file lyx_commit_hash.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * If LyX is compiled from a git clone, this should contain the HEAD
+ * commit hash.
+ */
+
+#ifndef _LYX_COMMIT_HASH_H
+#define _LYX_COMMIT_HASH_H
+
+#define LYX_GIT_COMMIT_HASH "@LYX_GIT_COMMIT_HASH@"
+
+#endif
+
#if ! defined(LYX_GIT_COMMIT_HASH)
#if ! defined(LYX_GIT_COMMIT_HASH)
- #include <lyx_commit_hash.h>
+#include "lyx_commit_hash.h"