Changeset 27087


Ignore:
Timestamp:
2011-06-01T20:08:17+02:00 (7 years ago)
Author:
nbd
Message:

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)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/kernel.mk

    r27032 r27087  
    162162endef 
    163163 
     164version_field=$(if $(word $(1),$(2)),$(word $(1),$(2)),0) 
     165kernel_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)) )) 
     166 
    164167ifdef DUMP 
    165   CompareKernelPatchVer=0 
     168  kernel_version_cmp= 
    166169else 
    167   define CompareKernelPatchVer 
    168     $(shell [ $$(echo $(1) | tr . 0) -$(2) $$(echo $(3) | tr . 0) ] && echo 1 || echo 0) 
    169   endef 
     170  kernel_version_cmp=$(shell [ $(call kernel_version_merge,$(call split_version,$(2))) $(1) $(call kernel_version_merge,$(call split_version,$(3))) ] && echo 1 ) 
    170171endif 
    171172 
     173CompareKernelPatchVer=$(if $(call kernel_version_cmp,-$(2),$(1),$(3)),1,0) 
     174 
     175kernel_patchver_gt=$(call kernel_version_cmp,-gt,$(KERNEL_PATCHVER),$(1)) 
     176kernel_patchver_ge=$(call kernel_version_cmp,-ge,$(KERNEL_PATCHVER),$(1)) 
     177kernel_patchver_eq=$(call kernel_version_cmp,-eq,$(KERNEL_PATCHVER),$(1)) 
     178kernel_patchver_le=$(call kernel_version_cmp,-lt,$(KERNEL_PATCHVER),$(1)) 
     179kernel_patchver_lt=$(call kernel_version_cmp,-le,$(KERNEL_PATCHVER),$(1)) 
     180 
Note: See TracChangeset for help on using the changeset viewer.