Files
Linux_Drivers/02-I2C/Makefile
2024-01-27 15:27:10 +00:00

55 lines
1.6 KiB
Makefile

# All Right Reserved.
# Author : gaoyang3513@outlook.com
# Version : V1.0.0 202x.01.01
# Description :
# Note :
# ---------------------------------------------------------------------------
# Path information
LOCAL_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
# Subdirectory
# Output directories
OUTPUT_DIR ?= $(LOCAL_DIR)/output
INSTALL_DIR ?= $(LOCAL_DIR)/_install
# ---------------------------------------------------------------------------
# Variables
MULTI_CORES ?= $(shell grep -c ^processor /proc/cpuinfo)
# ---------------------------------------------------------------------------
# Compile configure
# ---------------------------------------------------------------------------
# Source and oject files
ifneq ($(KERNELRELEASE),)
obj-m := i2c_static.o
# ---------------------------------------------------------------------------
# Targets
else # KERNELRELEASE
ifneq ($(filter $(BOARD),mikv-Duo),)
KERNELDIR := ${HOME}/Source/10-CV1800/01-MilkDuo/02-Project/SDK_CV1800_BR2/linux_5.10/build/cv1800b_milkv_duo_sd
ROOTFS := ${HOME}/nfs/rootfs
else
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
endif
.PHONY: all clean init
all:
@$(MAKE) -C $(KERNELDIR) M=$(LOCAL_DIR) modules -j$(MULTI_CORES);
install:
@$(MAKE) -C $(KERNELDIR) M=$(LOCAL_DIR) modules_install INSTALL_MOD_PATH=$(INSTALL_DIR)
clean:
@rm -rf *.o *.ko .*.cmd *.mod* modules.order Module.symvers .tmp_versions
@if [ -d $(LOCAL_DIR)/output ]; then rm -rf $(LOCAL_DIR)/output; fi;
@if [ -d $(LOCAL_DIR)/_install ]; then rm -rf $(LOCAL_DIR)/_install; fi;
endif # KERNELRELEASE