[CRIU] [PATCH 1/3] build: Move versions definitions on top level
Cyrill Gorcunov
gorcunov at openvz.org
Thu Feb 18 01:43:27 PST 2016
- define all versions in Makefile.versions toplevel file
- rename CRTOOLSVERSION to CRIU_VERSION (and add CRIU_ prefixes)
- rename versions for C librabry
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
Makefile | 5 +++++
Makefile.versions | 18 ++++++++++++++++++
criu/Makefile | 11 -----------
criu/Makefile.version | 9 ++++-----
lib/Makefile | 5 +----
5 files changed, 28 insertions(+), 20 deletions(-)
create mode 100644 Makefile.versions
diff --git a/Makefile b/Makefile
index 3e95df39a9de..1da3a74d7255 100644
--- a/Makefile
+++ b/Makefile
@@ -7,6 +7,11 @@ include $(__nmk_dir)/include.mk
include $(__nmk_dir)/macro.mk
#
+# Import tools versions early
+# so subsequents may refer them.
+include Makefile.versions
+
+#
# To build host helpers.
HOSTCC ?= gcc
HOSTLD ?= ld
diff --git a/Makefile.versions b/Makefile.versions
new file mode 100644
index 000000000000..6adb38d141f8
--- /dev/null
+++ b/Makefile.versions
@@ -0,0 +1,18 @@
+#
+# CRIU version.
+CRIU_VERSION_MAJOR := 2
+CRIU_VERSION_MINOR := 0
+CRIU_VERSION_SUBLEVEL :=
+CRIU_VERSION_EXTRA :=
+CRIU_VERSION_NAME :=
+CRIU_VERSION := $(CRIU_VERSION_MAJOR)$(if $(CRIU_VERSION_MINOR),.$(CRIU_VERSION_MINOR))$(if $(CRIU_VERSION_SUBLEVEL),.$(CRIU_VERSION_SUBLEVEL))
+
+export CRIU_VERSION_MAJOR CRIU_VERSION_MINOR CRIU_VERSION_SUBLEVEL
+export CRIU_VERSION_EXTRA CRIU_VERSION_NAME CRIU_VERSION
+
+#
+# C library for CRIU.
+CRIU_SO_VERSION_MAJOR := 1
+CRIU_SO_VERSION_MINOR := 0
+
+export CRIU_SO_VERSION_MAJOR CRIU_SO_VERSION_MINOR
diff --git a/criu/Makefile b/criu/Makefile
index 73889f2b7381..6ed297903c17 100644
--- a/criu/Makefile
+++ b/criu/Makefile
@@ -1,15 +1,4 @@
#
-# CRIU version.
-VERSION_MAJOR := 2
-VERSION_MINOR := 0
-VERSION_SUBLEVEL :=
-VERSION_EXTRA :=
-VERSION_NAME :=
-
-export VERSION_MAJOR VERSION_MINOR
-export VERSION_SUBLEVEL VERSION_EXTRA VERSION_NAME
-
-#
# HOST part is needed to build helper
# tools such as piegen.
HOSTCC ?= gcc
diff --git a/criu/Makefile.version b/criu/Makefile.version
index 44dad6c14266..310c5f2f8d36 100644
--- a/criu/Makefile.version
+++ b/criu/Makefile.version
@@ -1,4 +1,3 @@
-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 cd .. && git describe; fi)
@@ -16,14 +15,14 @@ $(GITID_FILE):
$(call msg-gen, $@)
$(Q) echo "$(GITID)" > $(GITID_FILE)
-$(VERSION_HEADER): Makefile.version $(GITID_FILE)
+$(VERSION_HEADER): ../Makefile.versions $(GITID_FILE)
$(call msg-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_VERSION \"$(CRIU_VERSION)\"" >> $(VERSION_HEADER)
+ $(Q) echo "#define CRIU_VERSION_MAJOR " $(CRIU_VERSION_MAJOR) >> $(VERSION_HEADER)
+ $(Q) echo "#define CRIU_VERSION_MINOR " $(CRIU_VERSION_MINOR) >> $(VERSION_HEADER)
$(Q) echo "#define CRIU_GITID \"$(GITID)\"" >> $(VERSION_HEADER)
$(Q) echo "#endif /* __CR_VERSION_H__ */" >> $(VERSION_HEADER)
diff --git a/lib/Makefile b/lib/Makefile
index 3c0decbe03f6..03229be98d7d 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -1,9 +1,6 @@
include $(__nmk_dir)/include.mk
include $(__nmk_dir)/macro.mk
-VERSION_SO_MAJOR := 1
-VERSION_SO_MINOR := 0
-
CRIU_SO := libcriu.so
#
@@ -15,7 +12,7 @@ c/built-in.o:
$(call msg-gen, $@)
$(Q) $(MAKE) $(build)=c all
-cflags-so += $(CFLAGS) -rdynamic -Wl,-soname,$(lib-so).so.$(VERSION_SO_MAJOR)
+cflags-so += $(CFLAGS) -rdynamic -Wl,-soname,$(lib-so).so.$(CRIU_SO_VERSION_MAJOR)
ldflags-so += -lprotobuf-c
c/$(CRIU_SO): c/built-in.o
$(call msg-link, $@)
--
2.5.0
More information about the CRIU
mailing list