Update Makefile

This commit is contained in:
ShirkNeko
2025-03-19 21:21:09 +08:00
committed by GitHub
parent 0b7fe65b02
commit 0c2588862d

View File

@@ -44,20 +44,20 @@ endif
obj-$(CONFIG_KSU) += kernelsu.o obj-$(CONFIG_KSU) += kernelsu.o
KSU_MANUAL_VERSION := 12510
ifeq ($(strip $(KSU_MANUAL_VERSION)),) ifeq ($(strip $(KSU_MANUAL_VERSION)),)
ifeq ($(shell test -e $(srctree)/$(src)/../.git; echo $$?),0) ifeq ($(shell test -e $(srctree)/$(src)/../.git; echo $$?),0)
$(shell cd $(srctree)/$(src); /usr/bin/env PATH="$$PATH":/usr/bin:/usr/local/bin git checkout main) $(shell cd $(srctree)/$(src); /usr/bin/env PATH="$$PATH":/usr/bin:/usr/local/bin [ -f ../.git/shallow ] && git fetch --unshallow)
$(shell cd $(srctree)/$(src); /usr/bin/env PATH="$$PATH":/usr/bin:/usr/local/bin git pull origin main)
KSU_GIT_VERSION := $(shell cd $(srctree)/$(src); /usr/bin/env PATH="$$PATH":/usr/bin:/usr/local/bin git rev-list --count HEAD) KSU_GIT_VERSION := $(shell cd $(srctree)/$(src); /usr/bin/env PATH="$$PATH":/usr/bin:/usr/local/bin git rev-list --count HEAD)
# ksu_version: major * 10000 + git version + 600 for historical reasons # ksu_version: major * 10000 + git version + 500 for historical reasons
$(eval KSU_VERSION=$(shell expr 12000 + $(KSU_GIT_VERSION) + 500)) $(eval KSU_VERSION=$(shell expr 12000 + $(KSU_GIT_VERSION) + 500))
$(info -- KernelSU version (Git-based): $(KSU_VERSION)) $(info -- KernelSU version (Git-based): $(KSU_VERSION))
ccflags-y += -DKSU_VERSION=$(KSU_VERSION) ccflags-y += -DKSU_VERSION=$(KSU_VERSION)
else else
# .git is a text file while the module is imported by 'git submodule add'. # .git is a text file while the module is imported by 'git submodule add'.
$(warning "KSU_GIT_VERSION not defined! Using default version.") $(warning "KSU_GIT_VERSION not defined! Using default version.")
KSU_VERSION := $(KSU_MANUAL_VERSION) KSU_VERSION := 12510
$(info -- KernelSU version (Default): $(KSU_VERSION)) $(info -- KernelSU version (Default): $(KSU_VERSION))
ccflags-y += -DKSU_VERSION=$(KSU_VERSION) ccflags-y += -DKSU_VERSION=$(KSU_VERSION)
endif endif