diff --git a/Makefile b/Makefile index 3e95df39a..1da3a74d7 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,11 @@ export __nmk_dir 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 diff --git a/Makefile.versions b/Makefile.versions new file mode 100644 index 000000000..6adb38d14 --- /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 099020d86..c639b1115 100644 --- a/criu/Makefile +++ b/criu/Makefile @@ -1,14 +1,3 @@ -# -# 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. diff --git a/criu/Makefile.version b/criu/Makefile.version index 6007958ad..9b5a614b5 100644 --- a/criu/Makefile.version +++ b/criu/Makefile.version @@ -1,6 +1,5 @@ include $(__nmk_dir)msg.mk -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) @@ -18,14 +17,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 3c0decbe0..03229be98 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, $@)