Commit 66289a6d authored by Konrad Sztyber's avatar Konrad Sztyber Committed by Ben Walker
Browse files

build: use VERSION file for storing version



This reduces the number of places to update whenever a version is bumped
and also gives us an easy way to check the current version from scripts.

Signed-off-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I01d7240b6e07467548c211f1e505c1e1a34360af
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/25523


Community-CI: Mellanox Build Bot
Community-CI: Community CI Samsung <spdk.community.ci.samsung@gmail.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <ben@nvidia.com>
Reviewed-by: default avatarJim Harris <jim.harris@nvidia.com>
parent 62638991
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ cscope.out
dpdk-*
CUnit-Memory-Dump.xml
include/spdk/config.h
include/spdk/version.h
CONFIG.local
*VC.db
.vscode
@@ -36,6 +37,7 @@ mk/cc.mk
mk/config.mk
mk/cc.flags.mk
PYTHON_COMMAND
python/spdk/version.py
test_completions.txt
timing.txt
test/common/build_config.sh
+10 −1
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ endif
all: mk/cc.mk $(DIRS-y)
clean: $(DIRS-y)
	$(Q)rm -f include/spdk/config.h
	$(Q)rm -f include/spdk/version.h
	$(Q)rm -rf build

install: all
@@ -107,7 +108,7 @@ examples: $(LIB)
pkgdep:
	sh ./scripts/pkgdep.sh

$(DIRS-y): mk/cc.mk build_dir include/spdk/config.h
$(DIRS-y): mk/cc.mk build_dir include/spdk/config.h include/spdk/version.h

mk/cc.mk:
	$(Q)echo "Please run configure prior to make"
@@ -128,6 +129,14 @@ include/spdk/config.h: mk/config.mk scripts/genconfig.py
	cmp -s $@.tmp $@ || mv $@.tmp $@ ; \
	rm -f $@.tmp

include/spdk/version.h: include/spdk/version.h.in VERSION
	$(Q)sed " \
		s/\$$SPDK_VERSION_MAJOR/$(version_major)/g; \
		s/\$$SPDK_VERSION_MINOR/$(version_minor)/g; \
		s/\$$SPDK_VERSION_PATCH/$(version_patch)/g; \
		s/\$$SPDK_VERSION_SUFFIX/$(version_suffix)/g;" \
		$@.in > $@

cc_version: mk/cc.mk
	$(Q)echo "SPDK using CC=$(CC)"; $(CC) -v

VERSION

0 → 100644
+1 −0
Original line number Diff line number Diff line
25.01.0-pre
+4 −4
Original line number Diff line number Diff line
@@ -17,12 +17,12 @@ extern "C" {
/**
 * Major version number (year of original release minus 2000).
 */
#define SPDK_VERSION_MAJOR	25
#define SPDK_VERSION_MAJOR	$SPDK_VERSION_MAJOR

/**
 * Minor version number (month of original release).
 */
#define SPDK_VERSION_MINOR	1
#define SPDK_VERSION_MINOR	$SPDK_VERSION_MINOR

/**
 * Patch level.
@@ -30,12 +30,12 @@ extern "C" {
 * Patch level is incremented on maintenance branch releases and reset to 0 for each
 * new major.minor release.
 */
#define SPDK_VERSION_PATCH	0
#define SPDK_VERSION_PATCH	$SPDK_VERSION_PATCH

/**
 * Version string suffix.
 */
#define SPDK_VERSION_SUFFIX	"-pre"
#define SPDK_VERSION_SUFFIX	"$SPDK_VERSION_SUFFIX"

/**
 * Single numeric value representing a version number for compile-time comparisons.
+5 −0
Original line number Diff line number Diff line
@@ -580,6 +580,11 @@ define cc_version_eq
$(shell [ "$(call cc_version)" = "$(1)" ] && echo 1 || echo 0)
endef

version_major := $(shell IFS='-.' read -r v _ _ _ < $(SPDK_ROOT_DIR)/VERSION; echo $$v)
version_minor := $(shell IFS='-.' read -r _ v _ _ < $(SPDK_ROOT_DIR)/VERSION; echo $${v#0})
version_patch := $(shell IFS='-.' read -r _ _ v _ < $(SPDK_ROOT_DIR)/VERSION; echo $$v)
version_suffix := $(shell IFS='-.' read -r _ _ _ v < $(SPDK_ROOT_DIR)/VERSION; echo $${v:+-$$v})

# _uniq returns the unique elements from the list specified. It does
# not change the order of the elements. If the same element occurs
# multiple times in the list, the last instance is kept and the others
Loading