2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-09-05 08:45:49 +00:00

make: Generate crtools version from Makefile definition

This allows us to have a unique place where version lives
and what is more important other subsystems (such as docs
generation) may reuse version definitions.

At moment EXTRA (which corresponds kernels -rc tag) and
NAME is not yet used, but I desided to put them in place
for future needs.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Cyrill Gorcunov
2013-02-11 19:24:06 +04:00
committed by Pavel Emelyanov
parent 7d8b5da7d6
commit 90fbbabb34
5 changed files with 30 additions and 5 deletions

23
scripts/Makefile.version Normal file
View File

@@ -0,0 +1,23 @@
VERSION_MAJOR := 0
VERSION_MINOR := 3
VERSION_SUBLEVEL :=
VERSION_EXTRA :=
VERSION_NAME :=
CRTOOLSVERSION := $(VERSION_MAJOR)$(if $(VERSION_MINOR),.$(VERSION_MINOR))$(if $(VERSION_SUBLEVEL),.$(VERSION_SUBLEVEL))
export VERSION_MAJOR VERSION_MINOR
VERSION_HEADER := include/version.h
$(VERSION_HEADER): 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 "static char version[] = {" >> $(VERSION_HEADER)
$(Q) echo \"$(CRTOOLSVERSION)\" >> $(VERSION_HEADER)
$(Q) echo "};" >> $(VERSION_HEADER)
$(Q) echo "#define CRIU_VERSION_MAJOR " $(VERSION_MAJOR) >> $(VERSION_HEADER)
$(Q) echo "#define CRIU_VERSION_MINOR " $(VERSION_MINOR) >> $(VERSION_HEADER)
$(Q) echo "#endif /* __CR_VERSION_H__ */" >> $(VERSION_HEADER)