standalone-kernel-module/Makefile

23 lines
566 B
Makefile
Raw Permalink Normal View History

2024-04-17 12:10:24 +02:00
TOOLCHAIN=$(ANDROID_NDK)/toolchains/llvm/prebuilt/linux-x86_64
TARGET=aarch64-linux-android
API=30
AR=$(TOOLCHAIN)/bin/llvm-ar
CC=$(TOOLCHAIN)/bin/$(TARGET)$(API)-clang
AS=$(CC)
CXX=$(TOOLCHAIN)/bin/$(TARGET)$(API)-clang++
LD=$(TOOLCHAIN)/bin/ld.lld
RANLIB=$(TOOLCHAIN)/bin/llvm-ranlib
STRIP=$(TOOLCHAIN)/bin/llvm-strip
.PHONY: install clean
all: bmod.o
$(CC) -fno-pic -flto=thin -fvisibility=default -fsanitize=cfi -fsanitize-cfi-cross-dso -fno-common -c bmod.c
$(LD) -r -o bmod.ko bmod.o
install:
adb push bmod.ko /data/local/tmp
clean:
rm bmod.o bmod.ko