mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
make: Rebuild version if git commit id is changed
Original message from Tycho: This might be a slightly controversial change since it always causes crtools.h to be rebuilt, which may be annoying. However, right now version.h is only generated on the initial git build and never again touched, which is also incorrect. We could potentially do something fancy by monitoring .git/HEAD for changes, but since it may not always exist if building from a tarball, it is a little sticky. CC: Andersen <tycho.andersen@canonical.com> CC: Pavel Emelyanov <xemul@parallels.com> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> Acked-by: Tycho Andersen <tycho.andersen@canonical.com> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
58ef9bc4f2
commit
1b406338d2
2 changed files with 13 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -30,3 +30,4 @@ include/config.h
|
|||
protobuf-desc-gen.h
|
||||
criu.pc
|
||||
build
|
||||
.gitid
|
||||
|
|
|
|||
|
|
@ -1,12 +1,23 @@
|
|||
CRTOOLSVERSION := $(VERSION_MAJOR)$(if $(VERSION_MINOR),.$(VERSION_MINOR))$(if $(VERSION_SUBLEVEL),.$(VERSION_SUBLEVEL))
|
||||
|
||||
VERSION_HEADER := include/version.h
|
||||
GITID_FILE := .gitid
|
||||
GITID := $(shell if [ -d ".git" ]; then git describe; fi)
|
||||
|
||||
ifeq ($(GITID),)
|
||||
GITID := 0
|
||||
else
|
||||
GITID_FILE_VALUE := $(shell if [ `cat .gitid` = $(GITID) ]; then echo y; fi)
|
||||
ifneq ($(GITID_FILE_VALUE),y)
|
||||
.PHONY: $(GITID_FILE)
|
||||
endif
|
||||
endif
|
||||
|
||||
$(VERSION_HEADER): Makefile scripts/Makefile.version
|
||||
$(GITID_FILE):
|
||||
$(E) " GEN " $@
|
||||
$(Q) echo "$(GITID)" > $(GITID_FILE)
|
||||
|
||||
$(VERSION_HEADER): Makefile scripts/Makefile.version $(GITID_FILE)
|
||||
$(E) " GEN " $@
|
||||
$(Q) echo "/* Autogenerated, do not edit */" > $(VERSION_HEADER)
|
||||
$(Q) echo "#ifndef __CR_VERSION_H__" >> $(VERSION_HEADER)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue