Commit 90fbbabb authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

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: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 7d8b5da7
......@@ -17,3 +17,4 @@ include/syscall.h
include/syscall-codes.h
protobuf/*.c
protobuf/*.h
include/version.h
......@@ -87,6 +87,8 @@ PROTOBUF-LIB = $(SRC_DIR)/protobuf/protobuf-lib.o
export E Q CC ECHO MAKE CFLAGS LIBS ARCH DEFINES MAKEFLAGS
export SRC_DIR SYSCALL-LIB SH ARCH_DIR OBJCOPY LDARCH
include scripts/Makefile.version
PROGRAM := crtools
OBJS += parasite-syscall.o
......@@ -144,7 +146,7 @@ ifeq ($(GCOV),1)
%.o $(PROGRAM): override CFLAGS += --coverage
endif
all: pie
all: pie $(VERSION_HEADER)
$(Q) $(MAKE) $(PROGRAM)
pie: protobuf $(ARCH)
......@@ -192,6 +194,7 @@ rebuild:
clean:
$(E) " CLEAN"
$(Q) $(RM) $(VERSION_HEADER)
$(Q) $(RM) -f ./*.o
$(Q) $(RM) -f ./*.d
$(Q) $(RM) -f ./*.i
......
......@@ -21,6 +21,7 @@
#include "files.h"
#include "sk-inet.h"
#include "net.h"
#include "version.h"
struct cr_options opts;
......@@ -226,7 +227,7 @@ int main(int argc, char *argv[])
opts.handle_file_locks = true;
break;
case 'V':
pr_msg("Version: %d.%d\n", CRIU_VERSION_MAJOR, CRIU_VERSION_MINOR);
pr_msg("Version: %s\n", version);
return 0;
case 'h':
default:
......
......@@ -14,9 +14,6 @@
#define CR_FD_PERM (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH)
#define CRIU_VERSION_MAJOR 0
#define CRIU_VERSION_MINOR 3
enum {
CR_FD_INVENTORY,
/*
......
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)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment