Skip to content

Instantly share code, notes, and snippets.

@Bassem-Ramzy
Bassem-Ramzy / Makefile
Last active February 7, 2022 09:22
check_linux_kernel_version_make
# In Makefile, check if the current kernel version is < 5.6,
# it sets `ADD_CCFLAGS_Y=-DOLD_KERNEL_FOR_PIN`
# Kernel Version
KVER := $(shell uname -r)
KMAJ := $(shell echo $(KVER) | \
sed -e 's/^\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*.*/\1/')
KMIN := $(shell echo $(KVER) | \
sed -e 's/^[0-9][0-9]*\.\([0-9][0-9]*\)\.[0-9][0-9]*.*/\1/')