2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-23 02:17:22 +00:00
criu/scripts/Makefile.version

26 lines
1.1 KiB
Makefile
Raw Normal View History

CRTOOLSVERSION := $(VERSION_MAJOR)$(if $(VERSION_MINOR),.$(VERSION_MINOR))$(if $(VERSION_SUBLEVEL),.$(VERSION_SUBLEVEL))
VERSION_HEADER := include/version.h
GITID := $(shell if [ -d ".git" ]; then git reflog -n 1 | cut -f1 -d' '; fi)
ifeq ($(GITID),)
GITID := 0
endif
$(VERSION_HEADER): Makefile scripts/Makefile.version
$(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::
@echo > /dev/null