#------------------------------------------------------------------------------# # All Right Reserved. # Author : # Version : V1.0.0 202x.01.01 # Description : # Note : gaoyang3513@163.com Modified 202x.01.01 #------------------------------------------------------------------------------# #------------------------------------------------------------------------------# # Path information #------------------------------------------------------------------------------# LOCAL_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) # Subdirectory PN5180_DIR := 01-NFC_PN5180 CMT2301_DIR := 02-Sub1G_CMT2301 OUTPUT_DIR := $(LOCAL_DIR)/output INSTALL_DIR ?= $(LOCAL_DIR)/__install #$(info Output directoty : $(OUTPUT_DIR)) #$(info Install directoty: $(INSTALL_DIR)) #------------------------------------------------------------------------------# # Variables #------------------------------------------------------------------------------# MULTI_CORES ?= $(shell grep -c ^processor /proc/cpuinfo) SUB_DIRS := $(CMT2301_DIR) $(PN5180_DIR) #------------------------------------------------------------------------------# # Compile configure #------------------------------------------------------------------------------# ARCH ?= riscv CROSS_COMPILE ?= riscv64-unknown-linux-musl- CC := $(CROSS_COMPILE)gcc LD := $(CROSS_COMPILE)ld AR := $(CROSS_COMPILE)ar STRIP := $(CROSS_COMPILE)strip export ARCH CROSS_COMPILE #------------------------------------------------------------------------------# # Targets #------------------------------------------------------------------------------# ifneq ($(KERNELRELEASE),) # called from kernel build system: just declare what our modules are obj-y += $(SUB_DIRS) #INC_DIRS := $(INCLUDE_DIR)/generated #subdir-ccflags-y += $(addprefix -I, $(INC_DIRS)) else # !KERNELRELEASE .PHONY: init all clean distclean install menuconfig all: init @for sub in $(SUB_DIRS); do \ $(MAKE) -C $$sub; \ $(MAKE) install INSTALL_DIR=$(OUTPUT_DIR) -C $$sub || exit "$$?"; \ done; clean: @for sub in $(SUB_DIRS); do \ $(MAKE) clean -C $$sub || exit "$$?"; \ done; # Directory @if [ -d $(LOCAL_DIR)/output ]; then rm -rf $(LOCAL_DIR)/output; fi; @if [ -d $(LOCAL_DIR)/__install ]; then rm -rf $(LOCAL_DIR)/__install; fi; install: @mkdir -p $(INSTALL_DIR) @cp -arf $(OUTPUT_DIR)/. $(INSTALL_DIR) init: @mkdir -p $(OUTPUT_DIR); endif # !KERNELRELEASE