96 lines
3.1 KiB
Makefile
96 lines
3.1 KiB
Makefile
#*******************************************************************************
|
|
# HangZhou Hikvision Digital Technology Co., Ltd. All Right Reserved.
|
|
# Author :
|
|
# Version : V1.0.0 202x.01.01
|
|
# Description :
|
|
# Note : gaoyang@.com.cn Modified 2020.10.21
|
|
#*******************************************************************************
|
|
|
|
#*******************************************************************************
|
|
# Path information
|
|
#*******************************************************************************
|
|
LOCAL_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
|
|
|
|
# SDK directories
|
|
SDK_TOP ?= $(HOME)/Source/15-SG200x/01-MilkDuo/02-Project/SDK_SG200x_V2.0.0
|
|
KERNEL_DIR ?= $(SDK_TOP)/linux_5.10/build/sg2000_milkv_duos_glibc_arm64_sd
|
|
TOOLCHAIN_DIR ?= $(SDK_TOP)/host-tools/gcc/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin
|
|
|
|
# Subdirectory
|
|
|
|
OUTPUT_DIR := $(LOCAL_DIR)/output
|
|
INSTALL_DIR ?= $(LOCAL_DIR)/__install
|
|
#$(info Output directoty : $(OUTPUT_DIR))
|
|
#$(info Install directoty: $(INSTALL_DIR))
|
|
|
|
export KERNEL_DIR
|
|
#*******************************************************************************
|
|
# Variables
|
|
#*******************************************************************************
|
|
MULTI_CORES ?= $(shell grep -c ^processor /proc/cpuinfo)
|
|
|
|
SUB_DIRS := \
|
|
04-Debug \
|
|
03-Bus/01-Platform/01-osdev \
|
|
|
|
#*******************************************************************************
|
|
# Compile configure
|
|
#*******************************************************************************
|
|
#ARCH ?= riscv
|
|
#CROSS_COMPILE ?= riscv64-unknown-linux-musl-
|
|
ARCH ?= arm64
|
|
CROSS_COMPILE ?= aarch64-linux-gnu-
|
|
|
|
CC := $(CROSS_COMPILE)gcc
|
|
LD := $(CROSS_COMPILE)ld
|
|
AR := $(CROSS_COMPILE)ar
|
|
STRIP := $(CROSS_COMPILE)strip
|
|
|
|
PATH := $(TOOLCHAIN_DIR):$(PATH)
|
|
|
|
export ARCH CROSS_COMPILE PATH
|
|
#*******************************************************************************
|
|
# Targets
|
|
#*******************************************************************************
|
|
.PHONY: init all clean distclean install menuconfig
|
|
|
|
ifeq ($(KERNELRELEASE),)
|
|
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);
|
|
|
|
%_defconfig:
|
|
$(LOCAL_DIR)/scripts/kconfig/Kconfiglib/defconfig.py --kconfig Kconfig configs/$@
|
|
|
|
menuconfig:
|
|
$(LOCAL_DIR)/scripts/kconfig/Kconfiglib/menuconfig.py Kconfig
|
|
|
|
savedefconfig:
|
|
$(LOCAL_DIR)/scripts/kconfig/Kconfiglib/savedefconfig.py --kconfig Kconfig --out defconfig
|
|
|
|
else
|
|
# 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))
|
|
|
|
endif # ifeq ($(KERNELRELEASE),)
|