mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-24 02:35:41 +00:00
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>
36 lines
1.3 KiB
Text
36 lines
1.3 KiB
Text
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
|
|
|
|
$(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)
|
|
$(Q) echo "#define __CR_VERSION_H__" >> $(VERSION_HEADER)
|
|
$(Q) echo "#define CRIU_VERSION \"$(CRTOOLSVERSION)\"" >> $(VERSION_HEADER)
|
|
$(Q) echo "#define CRIU_VERSION_MAJOR " $(VERSION_MAJOR) >> $(VERSION_HEADER)
|
|
$(Q) echo "#define CRIU_VERSION_MINOR " $(VERSION_MINOR) >> $(VERSION_HEADER)
|
|
$(Q) echo "#define CRIU_GITID \"$(GITID)\"" >> $(VERSION_HEADER)
|
|
$(Q) echo "#endif /* __CR_VERSION_H__ */" >> $(VERSION_HEADER)
|
|
|
|
##
|
|
## In case if someone add last resort rule
|
|
## together with .SUFFIXES not cleaned, this
|
|
## will slow down the build procedure
|
|
scripts/Makefile.version::
|
|
@true
|