mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-23 02:17:22 +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:
parent
7d8b5da7d6
commit
90fbbabb34
1
.gitignore
vendored
1
.gitignore
vendored
@ -17,3 +17,4 @@ include/syscall.h
|
|||||||
include/syscall-codes.h
|
include/syscall-codes.h
|
||||||
protobuf/*.c
|
protobuf/*.c
|
||||||
protobuf/*.h
|
protobuf/*.h
|
||||||
|
include/version.h
|
||||||
|
5
Makefile
5
Makefile
@ -87,6 +87,8 @@ PROTOBUF-LIB = $(SRC_DIR)/protobuf/protobuf-lib.o
|
|||||||
export E Q CC ECHO MAKE CFLAGS LIBS ARCH DEFINES MAKEFLAGS
|
export E Q CC ECHO MAKE CFLAGS LIBS ARCH DEFINES MAKEFLAGS
|
||||||
export SRC_DIR SYSCALL-LIB SH ARCH_DIR OBJCOPY LDARCH
|
export SRC_DIR SYSCALL-LIB SH ARCH_DIR OBJCOPY LDARCH
|
||||||
|
|
||||||
|
include scripts/Makefile.version
|
||||||
|
|
||||||
PROGRAM := crtools
|
PROGRAM := crtools
|
||||||
|
|
||||||
OBJS += parasite-syscall.o
|
OBJS += parasite-syscall.o
|
||||||
@ -144,7 +146,7 @@ ifeq ($(GCOV),1)
|
|||||||
%.o $(PROGRAM): override CFLAGS += --coverage
|
%.o $(PROGRAM): override CFLAGS += --coverage
|
||||||
endif
|
endif
|
||||||
|
|
||||||
all: pie
|
all: pie $(VERSION_HEADER)
|
||||||
$(Q) $(MAKE) $(PROGRAM)
|
$(Q) $(MAKE) $(PROGRAM)
|
||||||
|
|
||||||
pie: protobuf $(ARCH)
|
pie: protobuf $(ARCH)
|
||||||
@ -192,6 +194,7 @@ rebuild:
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(E) " CLEAN"
|
$(E) " CLEAN"
|
||||||
|
$(Q) $(RM) $(VERSION_HEADER)
|
||||||
$(Q) $(RM) -f ./*.o
|
$(Q) $(RM) -f ./*.o
|
||||||
$(Q) $(RM) -f ./*.d
|
$(Q) $(RM) -f ./*.d
|
||||||
$(Q) $(RM) -f ./*.i
|
$(Q) $(RM) -f ./*.i
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "files.h"
|
#include "files.h"
|
||||||
#include "sk-inet.h"
|
#include "sk-inet.h"
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
struct cr_options opts;
|
struct cr_options opts;
|
||||||
|
|
||||||
@ -226,7 +227,7 @@ int main(int argc, char *argv[])
|
|||||||
opts.handle_file_locks = true;
|
opts.handle_file_locks = true;
|
||||||
break;
|
break;
|
||||||
case 'V':
|
case 'V':
|
||||||
pr_msg("Version: %d.%d\n", CRIU_VERSION_MAJOR, CRIU_VERSION_MINOR);
|
pr_msg("Version: %s\n", version);
|
||||||
return 0;
|
return 0;
|
||||||
case 'h':
|
case 'h':
|
||||||
default:
|
default:
|
||||||
|
@ -14,9 +14,6 @@
|
|||||||
|
|
||||||
#define CR_FD_PERM (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH)
|
#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 {
|
enum {
|
||||||
CR_FD_INVENTORY,
|
CR_FD_INVENTORY,
|
||||||
/*
|
/*
|
||||||
|
23
scripts/Makefile.version
Normal file
23
scripts/Makefile.version
Normal 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)
|
Loading…
x
Reference in New Issue
Block a user