diff options
author | Felix Fietkau <nbd@openwrt.org> | 2011-06-01 18:08:17 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2011-06-01 18:08:17 +0000 |
commit | 9acb81d9af4cef2679f0475bd2b0f18963c795de (patch) | |
tree | e3085d0e2eee4790ba1e2f874bbdce8f68bfcbd7 /include/kernel.mk | |
parent | 1027d262ef382c196478ab040a4cc33dd36211a2 (diff) | |
download | upstream-9acb81d9af4cef2679f0475bd2b0f18963c795de.tar.gz upstream-9acb81d9af4cef2679f0475bd2b0f18963c795de.tar.bz2 upstream-9acb81d9af4cef2679f0475bd2b0f18963c795de.zip |
kernel.mk: add a new helper for comparing kernel versions, which can take 1 - 4 field kernel versions
implement CompareKernelPatchVer using this new helper
implement kernel_patchver_{gt,ge,eq,le,lt}, which are more convenient for use with inline $(if)
SVN-Revision: 27087
Diffstat (limited to 'include/kernel.mk')
-rw-r--r-- | include/kernel.mk | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/include/kernel.mk b/include/kernel.mk index 5e8df444fb..e120cef1fa 100644 --- a/include/kernel.mk +++ b/include/kernel.mk @@ -161,11 +161,20 @@ define AutoLoad add_module "$(1)" "$(2)" "$(3)"; endef +version_field=$(if $(word $(1),$(2)),$(word $(1),$(2)),0) +kernel_version_merge=$$(( ($(call version_field,1,$(1)) << 24) + ($(call version_field,2,$(1)) << 16) + ($(call version_field,3,$(1)) << 8) + $(call version_field,4,$(1)) )) + ifdef DUMP - CompareKernelPatchVer=0 + kernel_version_cmp= else - define CompareKernelPatchVer - $(shell [ $$(echo $(1) | tr . 0) -$(2) $$(echo $(3) | tr . 0) ] && echo 1 || echo 0) - endef + kernel_version_cmp=$(shell [ $(call kernel_version_merge,$(call split_version,$(2))) $(1) $(call kernel_version_merge,$(call split_version,$(3))) ] && echo 1 ) endif +CompareKernelPatchVer=$(if $(call kernel_version_cmp,-$(2),$(1),$(3)),1,0) + +kernel_patchver_gt=$(call kernel_version_cmp,-gt,$(KERNEL_PATCHVER),$(1)) +kernel_patchver_ge=$(call kernel_version_cmp,-ge,$(KERNEL_PATCHVER),$(1)) +kernel_patchver_eq=$(call kernel_version_cmp,-eq,$(KERNEL_PATCHVER),$(1)) +kernel_patchver_le=$(call kernel_version_cmp,-lt,$(KERNEL_PATCHVER),$(1)) +kernel_patchver_lt=$(call kernel_version_cmp,-le,$(KERNEL_PATCHVER),$(1)) + |