build: Only regenerate src/git-version.h when .git/logs/HEAD changes
We rely on .git/logs/HEAD to be a file that changes when we commit to HEAD. The first idea is to make the makefile rule depend on .git/HEAD, but that's a symbolic ref that points to the current ref in refs/heads. However, .git/logs/HEAD changes whenever we commit to HEAD, so we can use that in the makefile rule.
This commit is contained in:
+11
-6
@@ -77,6 +77,12 @@ weston_SOURCES = \
|
|||||||
shared/zalloc.h \
|
shared/zalloc.h \
|
||||||
src/weston-egl-ext.h
|
src/weston-egl-ext.h
|
||||||
|
|
||||||
|
# Track this dependency explicitly instead of using BUILT_SOURCES. We
|
||||||
|
# add BUILT_SOURCES to CLEANFILES, but we want to keep git-version.h
|
||||||
|
# in case we're building from tarballs.
|
||||||
|
|
||||||
|
src/compositor.c : $(top_builddir)/src/git-version.h
|
||||||
|
|
||||||
noinst_LTLIBRARIES += \
|
noinst_LTLIBRARIES += \
|
||||||
libsession-helper.la
|
libsession-helper.la
|
||||||
|
|
||||||
@@ -99,10 +105,10 @@ libsession_helper_la_LIBADD += $(SYSTEMD_LOGIN_LIBS) $(DBUS_LIBS)
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
src/git-version.h : .FORCE
|
if HAVE_GIT_REPO
|
||||||
$(AM_V_GEN)(echo "#define BUILD_ID \"$(shell git --git-dir=$(top_srcdir)/.git describe --always --dirty) $(shell git --git-dir=$(top_srcdir)/.git log -1 --format='%s (%ci)')\"" > $@-new; \
|
src/git-version.h : $(top_srcdir)/.git/logs/HEAD
|
||||||
cmp -s $@ $@-new || cp $@-new $@; \
|
$(AM_V_GEN)echo "#define BUILD_ID \"$(shell git --git-dir=$(top_srcdir)/.git describe --always --dirty) $(shell git --git-dir=$(top_srcdir)/.git log -1 --format='%s (%ci)')\"" > $@
|
||||||
rm $@-new)
|
endif
|
||||||
|
|
||||||
.FORCE :
|
.FORCE :
|
||||||
|
|
||||||
@@ -339,8 +345,7 @@ BUILT_SOURCES += \
|
|||||||
src/workspaces-server-protocol.h \
|
src/workspaces-server-protocol.h \
|
||||||
src/workspaces-protocol.c \
|
src/workspaces-protocol.c \
|
||||||
src/scaler-server-protocol.h \
|
src/scaler-server-protocol.h \
|
||||||
src/scaler-protocol.c \
|
src/scaler-protocol.c
|
||||||
src/git-version.h
|
|
||||||
|
|
||||||
if BUILD_CLIENTS
|
if BUILD_CLIENTS
|
||||||
|
|
||||||
|
|||||||
@@ -485,6 +485,9 @@ AC_SUBST([dtddir])
|
|||||||
AM_CONDITIONAL([HAVE_XMLLINT], [test "x$XMLLINT" != "x" -a "x$dtddir" != "x"])
|
AM_CONDITIONAL([HAVE_XMLLINT], [test "x$XMLLINT" != "x" -a "x$dtddir" != "x"])
|
||||||
|
|
||||||
AC_CONFIG_FILES([Makefile src/version.h src/weston.pc])
|
AC_CONFIG_FILES([Makefile src/version.h src/weston.pc])
|
||||||
|
|
||||||
|
AM_CONDITIONAL([HAVE_GIT_REPO], [test -f $srcdir/.git/logs/HEAD])
|
||||||
|
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|
||||||
AC_MSG_RESULT([
|
AC_MSG_RESULT([
|
||||||
|
|||||||
Reference in New Issue
Block a user