mirror of
https://github.com/tiann/KernelSU.git
synced 2025-02-20 11:43:32 +08:00
Merge e9072139566d1b84db0a3f7c93bdbff9a59197e4 into 6e3d5569601e89b3edff657a9c9eec016a0e581a
This commit is contained in:
commit
579c2c0cb7
@ -16,15 +16,36 @@ ccflags-y += -I$(objtree)/security/selinux -include $(srctree)/include/uapi/asm-
|
|||||||
|
|
||||||
obj-$(CONFIG_KSU) += kernelsu.o
|
obj-$(CONFIG_KSU) += kernelsu.o
|
||||||
|
|
||||||
# .git is a text file while the module is imported by 'git submodule add'.
|
IS_KERNEL_69 := $(strip $(shell \
|
||||||
ifeq ($(shell test -e $(srctree)/$(src)/../.git; echo $$?),0)
|
if [ "$(VERSION)" -ge "6" -a "$(PATCHLEVEL)" -ge "9" ]; then \
|
||||||
$(shell cd $(srctree)/$(src); /usr/bin/env PATH="$$PATH":/usr/bin:/usr/local/bin [ -f ../.git/shallow ] && git fetch --unshallow)
|
echo TRUE; \
|
||||||
KSU_GIT_VERSION := $(shell cd $(srctree)/$(src); /usr/bin/env PATH="$$PATH":/usr/bin:/usr/local/bin git rev-list --count HEAD)
|
else \
|
||||||
|
echo FALSE; \
|
||||||
|
fi \
|
||||||
|
))
|
||||||
|
|
||||||
|
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b1992c3772e69a6fd0e3fc81cd4d2820c8b6eca0
|
||||||
|
ifeq ($(IS_KERNEL_69),TRUE)
|
||||||
|
SRC_LOCATION := $(src)
|
||||||
|
else
|
||||||
|
SRC_LOCATION := $(srctree)/$(src)
|
||||||
|
endif
|
||||||
|
|
||||||
|
GIT_TOOL := /usr/bin/env PATH="$$PATH":/usr/bin:/usr/local/bin git
|
||||||
|
|
||||||
|
# Check for both https & ssh remote
|
||||||
|
REMOTE_CHECK := $(shell cd $(SRC_LOCATION); $(GIT_TOOL) remote -v | grep -E 'github\.com[/:]tiann/KernelSU')
|
||||||
|
|
||||||
|
ifneq ($(REMOTE_CHECK),)
|
||||||
|
ifeq ($(shell cd $(SRC_LOCATION); $(GIT_TOOL) rev-parse --is-shallow-repository),true)
|
||||||
|
$(shell cd $(SRC_LOCATION); $(GIT_TOOL) fetch --unshallow)
|
||||||
|
endif
|
||||||
|
KSU_GIT_VERSION := $(shell cd $(SRC_LOCATION); $(GIT_TOOL) rev-list --count HEAD)
|
||||||
# ksu_version: major * 10000 + git version + 200 for historical reasons
|
# ksu_version: major * 10000 + git version + 200 for historical reasons
|
||||||
$(eval KSU_VERSION=$(shell expr 10000 + $(KSU_GIT_VERSION) + 200))
|
$(eval KSU_VERSION=$(shell expr 10000 + $(KSU_GIT_VERSION) + 200))
|
||||||
$(info -- KernelSU version: $(KSU_VERSION))
|
$(info -- KernelSU version: $(KSU_VERSION))
|
||||||
ccflags-y += -DKSU_VERSION=$(KSU_VERSION)
|
ccflags-y += -DKSU_VERSION=$(KSU_VERSION)
|
||||||
else # If there is no .git file, the default version will be passed.
|
else # Pass default version if the defined remote is not found
|
||||||
$(warning "KSU_GIT_VERSION not defined! It is better to make KernelSU a git submodule!")
|
$(warning "KSU_GIT_VERSION not defined! It is better to make KernelSU a git submodule!")
|
||||||
ccflags-y += -DKSU_VERSION=16
|
ccflags-y += -DKSU_VERSION=16
|
||||||
endif
|
endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user