10d163575Sopenharmony_ci# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
20d163575Sopenharmony_ci# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
30d163575Sopenharmony_ci#
40d163575Sopenharmony_ci# Redistribution and use in source and binary forms, with or without modification,
50d163575Sopenharmony_ci# are permitted provided that the following conditions are met:
60d163575Sopenharmony_ci#
70d163575Sopenharmony_ci# 1. Redistributions of source code must retain the above copyright notice, this list of
80d163575Sopenharmony_ci#    conditions and the following disclaimer.
90d163575Sopenharmony_ci#
100d163575Sopenharmony_ci# 2. Redistributions in binary form must reproduce the above copyright notice, this list
110d163575Sopenharmony_ci#    of conditions and the following disclaimer in the documentation and/or other materials
120d163575Sopenharmony_ci#    provided with the distribution.
130d163575Sopenharmony_ci#
140d163575Sopenharmony_ci# 3. Neither the name of the copyright holder nor the names of its contributors may be used
150d163575Sopenharmony_ci#    to endorse or promote products derived from this software without specific prior written
160d163575Sopenharmony_ci#    permission.
170d163575Sopenharmony_ci#
180d163575Sopenharmony_ci# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
190d163575Sopenharmony_ci# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
200d163575Sopenharmony_ci# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
210d163575Sopenharmony_ci# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
220d163575Sopenharmony_ci# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
230d163575Sopenharmony_ci# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
240d163575Sopenharmony_ci# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
250d163575Sopenharmony_ci# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
260d163575Sopenharmony_ci# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
270d163575Sopenharmony_ci# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
280d163575Sopenharmony_ci# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
290d163575Sopenharmony_ci
300d163575Sopenharmony_ciLITEOS_MENUCONFIG_H ?= $(LITEOSTOPDIR)/config.h
310d163575Sopenharmony_ciLITEOS_CONFIG_FILE ?= $(LITEOSTOPDIR)/.config
320d163575Sopenharmony_ci
330d163575Sopenharmony_ci-include $(LITEOS_CONFIG_FILE)
340d163575Sopenharmony_ci
350d163575Sopenharmony_ciifeq ($(ARCH),)
360d163575Sopenharmony_ciARCH = $(error ARCH not set!)
370d163575Sopenharmony_ciendif
380d163575Sopenharmony_ci
390d163575Sopenharmony_ci## variable define ##
400d163575Sopenharmony_ciHIDE = @
410d163575Sopenharmony_ciRM = -rm -rf
420d163575Sopenharmony_ciOUT = $(or $(OUTDIR),$(LITEOSTOPDIR)/out/$(LOSCFG_PRODUCT_NAME:"%"=%))
430d163575Sopenharmony_ciMODULE = $(LITEOSTOPDIR)/tools/build/mk/module.mk
440d163575Sopenharmony_ciLITEOS_SCRIPTPATH = $(LITEOSTOPDIR)/tools/scripts
450d163575Sopenharmony_ciLITEOSTHIRDPARTY = $(LITEOSTOPDIR)/../../third_party
460d163575Sopenharmony_ci
470d163575Sopenharmony_ci## compiler relative ##
480d163575Sopenharmony_ciget_compiler_path = $(or $(wildcard $(1)),$(dir $(shell which $(CROSS_COMPILE)as)))
490d163575Sopenharmony_ciifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
500d163575Sopenharmony_ciCROSS_COMPILE ?= llvm-
510d163575Sopenharmony_ciLITEOS_COMPILER_PATH ?= $(call get_compiler_path,$(LITEOSTOPDIR)/../../prebuilts/clang/ohos/linux-x86_64/llvm/bin/)
520d163575Sopenharmony_ciLLVM_TARGET = $(if $(LOSCFG_LLVM_TARGET:"%"=%),--target=$(LOSCFG_LLVM_TARGET:"%"=%),)
530d163575Sopenharmony_ciLLVM_SYSROOT = $(if $(SYSROOT_PATH),--sysroot=$(SYSROOT_PATH),)
540d163575Sopenharmony_ciCC  = $(LITEOS_COMPILER_PATH)clang $(LLVM_TARGET) $(LLVM_SYSROOT)
550d163575Sopenharmony_ciAS  = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)as
560d163575Sopenharmony_ciAR  = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)ar
570d163575Sopenharmony_ciLD  = $(LITEOS_COMPILER_PATH)ld.lld
580d163575Sopenharmony_ciGPP = $(LITEOS_COMPILER_PATH)clang++ $(LLVM_TARGET) $(LLVM_SYSROOT)
590d163575Sopenharmony_ciOBJCOPY = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)objcopy -R .bss
600d163575Sopenharmony_ciOBJDUMP = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)objdump
610d163575Sopenharmony_ciSIZE = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)size
620d163575Sopenharmony_ciNM = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)nm
630d163575Sopenharmony_ciSTRIP = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)strip
640d163575Sopenharmony_cielse ifeq ($(LOSCFG_COMPILER_GCC), y)
650d163575Sopenharmony_ciCROSS_COMPILE ?= $(LOSCFG_CROSS_COMPILE:"%"=%)
660d163575Sopenharmony_ciLITEOS_COMPILER_PATH ?= $(call get_compiler_path,$(LITEOSTOPDIR)/../../prebuilts/gcc/linux-x86/arm/arm-linux-ohoseabi-gcc/bin/)
670d163575Sopenharmony_ciCC  = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)gcc
680d163575Sopenharmony_ciAS  = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)as
690d163575Sopenharmony_ciAR  = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)ar
700d163575Sopenharmony_ciLD  = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)ld
710d163575Sopenharmony_ciGPP = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)g++
720d163575Sopenharmony_ciOBJCOPY = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)objcopy
730d163575Sopenharmony_ciOBJDUMP = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)objdump
740d163575Sopenharmony_ciSIZE = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)size
750d163575Sopenharmony_ciNM = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)nm
760d163575Sopenharmony_ciSTRIP = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)strip
770d163575Sopenharmony_cielse
780d163575Sopenharmony_ciCC  = echo $(info compiler type not set!)
790d163575Sopenharmony_ciendif
800d163575Sopenharmony_ci
810d163575Sopenharmony_ci## c as cxx ld options ##
820d163575Sopenharmony_ciLITEOS_ASOPTS :=
830d163575Sopenharmony_ciLITEOS_COPTS_BASE :=
840d163575Sopenharmony_ciLITEOS_COPTS_EXTRA :=
850d163575Sopenharmony_ciLITEOS_COPTS_DEBUG :=
860d163575Sopenharmony_ciLITEOS_CXXOPTS :=
870d163575Sopenharmony_ciLITEOS_CXXOPTS_BASE :=
880d163575Sopenharmony_ciLITEOS_LD_OPTS :=
890d163575Sopenharmony_ciLITEOS_GCOV_OPTS :=
900d163575Sopenharmony_ci## macro define ##
910d163575Sopenharmony_ciLITEOS_CMACRO := -D__LITEOS__
920d163575Sopenharmony_ciLITEOS_CXXMACRO :=
930d163575Sopenharmony_ci## head file path and ld path ##
940d163575Sopenharmony_ciLITEOS_PLATFORM_INCLUDE :=
950d163575Sopenharmony_ciLITEOS_CXXINCLUDE :=
960d163575Sopenharmony_ciLITEOS_LD_PATH :=
970d163575Sopenharmony_ciLITEOS_LD_SCRIPT :=
980d163575Sopenharmony_ci## c as cxx ld flags ##
990d163575Sopenharmony_ciLITEOS_ASFLAGS :=
1000d163575Sopenharmony_ciLITEOS_CFLAGS :=
1010d163575Sopenharmony_ciLITEOS_LDFLAGS :=
1020d163575Sopenharmony_ciLITEOS_CXXFLAGS :=
1030d163575Sopenharmony_ci## depended lib ##
1040d163575Sopenharmony_ciLITEOS_BASELIB :=
1050d163575Sopenharmony_ciLITEOS_LIBDEP :=
1060d163575Sopenharmony_ci## directory ##
1070d163575Sopenharmony_ciLIB_SUBDIRS :=
1080d163575Sopenharmony_ci
1090d163575Sopenharmony_ci####################################### CPU Option Begin #########################################
1100d163575Sopenharmony_ciinclude $(LITEOSTOPDIR)/arch/cpu.mk
1110d163575Sopenharmony_ci####################################### CPU Option End #########################################
1120d163575Sopenharmony_ci
1130d163575Sopenharmony_ci############################# Platform Option Begin#################################
1140d163575Sopenharmony_ciinclude $(LITEOSTOPDIR)/platform/bsp.mk
1150d163575Sopenharmony_ci############################# Platform Option End #################################
1160d163575Sopenharmony_ci
1170d163575Sopenharmony_ci####################################### Kernel Option Begin ###########################################
1180d163575Sopenharmony_ciLITEOS_BASELIB += -lbase
1190d163575Sopenharmony_ciLIB_SUBDIRS       += kernel/base
1200d163575Sopenharmony_ciLITEOS_KERNEL_INCLUDE   := -I $(LITEOSTOPDIR)/kernel/include \
1210d163575Sopenharmony_ci                           -I $(LITEOSTOPDIR)/kernel/base/include
1220d163575Sopenharmony_ci
1230d163575Sopenharmony_ciLITEOS_BASELIB += -lcommon
1240d163575Sopenharmony_ciLIB_SUBDIRS       += kernel/common
1250d163575Sopenharmony_ciLITEOS_KERNEL_INCLUDE   += -I $(LITEOSTOPDIR)/kernel/common
1260d163575Sopenharmony_ci
1270d163575Sopenharmony_ciifeq ($(LOSCFG_KERNEL_CONTAINER), y)
1280d163575Sopenharmony_ci    LITEOS_BASELIB    += -lcontainer
1290d163575Sopenharmony_ci    LIB_SUBDIRS       += kernel/extended/container
1300d163575Sopenharmony_ciendif
1310d163575Sopenharmony_ci
1320d163575Sopenharmony_ciifeq ($(LOSCFG_KERNEL_CPPSUPPORT), y)
1330d163575Sopenharmony_ci    LITEOS_BASELIB += -lcppsupport
1340d163575Sopenharmony_ci    LIB_SUBDIRS       += kernel/extended/cppsupport
1350d163575Sopenharmony_ci    LITEOS_CPPSUPPORT_INCLUDE   += -I $(LITEOSTOPDIR)/kernel/extended/cppsupport
1360d163575Sopenharmony_ciendif
1370d163575Sopenharmony_ci
1380d163575Sopenharmony_ciifeq ($(LOSCFG_KERNEL_CPUP), y)
1390d163575Sopenharmony_ci    LITEOS_BASELIB   += -lcpup
1400d163575Sopenharmony_ci    LIB_SUBDIRS         += kernel/extended/cpup
1410d163575Sopenharmony_ci    LITEOS_CPUP_INCLUDE := -I $(LITEOSTOPDIR)/kernel/extended/cpup
1420d163575Sopenharmony_ciendif
1430d163575Sopenharmony_ci
1440d163575Sopenharmony_ciifeq ($(LOSCFG_KERNEL_DYNLOAD), y)
1450d163575Sopenharmony_ci    LITEOS_BASELIB   += -ldynload
1460d163575Sopenharmony_ci    LIB_SUBDIRS      += kernel/extended/dynload
1470d163575Sopenharmony_ci    LITEOS_DYNLOAD_INCLUDE   += -I $(LITEOSTOPDIR)/kernel/extended/dynload/include
1480d163575Sopenharmony_ciendif
1490d163575Sopenharmony_ci
1500d163575Sopenharmony_ciifeq ($(LOSCFG_KERNEL_VDSO), y)
1510d163575Sopenharmony_ci    LITEOS_BASELIB   += -lvdso
1520d163575Sopenharmony_ci    LIB_SUBDIRS      += kernel/extended/vdso/usr
1530d163575Sopenharmony_ci    LIB_SUBDIRS      += kernel/extended/vdso/src
1540d163575Sopenharmony_ci    LITEOS_VDSO_INCLUDE   += -I $(LITEOSTOPDIR)/kernel/extended/vdso/include
1550d163575Sopenharmony_ciendif
1560d163575Sopenharmony_ci
1570d163575Sopenharmony_ciifeq ($(LOSCFG_KERNEL_TRACE), y)
1580d163575Sopenharmony_ci    LITEOS_BASELIB    += -ltrace
1590d163575Sopenharmony_ci    LIB_SUBDIRS       += kernel/extended/trace
1600d163575Sopenharmony_ciendif
1610d163575Sopenharmony_ci
1620d163575Sopenharmony_ciifeq ($(LOSCFG_KERNEL_HOOK), y)
1630d163575Sopenharmony_ci    LITEOS_BASELIB += -lhook
1640d163575Sopenharmony_ci    LIB_SUBDIRS       += kernel/extended/hook
1650d163575Sopenharmony_ci    LITEOS_HOOK_INCLUDE   += -I $(LITEOSTOPDIR)/kernel/extended/hook/include
1660d163575Sopenharmony_ciendif
1670d163575Sopenharmony_ci
1680d163575Sopenharmony_ciifeq ($(LOSCFG_KERNEL_PERF), y)
1690d163575Sopenharmony_ci    LITEOS_BASELIB        += -lperf
1700d163575Sopenharmony_ci    LIB_SUBDIRS           += kernel/extended/perf
1710d163575Sopenharmony_ci    LITEOS_PERF_INCLUDE   += -I $(LITEOSTOPDIR)/kernel/extended/perf
1720d163575Sopenharmony_ciendif
1730d163575Sopenharmony_ci
1740d163575Sopenharmony_ciifeq ($(LOSCFG_KERNEL_LMS), y)
1750d163575Sopenharmony_ci    LITEOS_BASELIB        += -llms
1760d163575Sopenharmony_ci    LIB_SUBDIRS           += kernel/extended/lms
1770d163575Sopenharmony_ci    LITEOS_LMS_INCLUDE   += -I $(LITEOSTOPDIR)/kernel/extended/lms
1780d163575Sopenharmony_ciendif
1790d163575Sopenharmony_ci
1800d163575Sopenharmony_ciifeq ($(LOSCFG_KERNEL_LITEIPC), y)
1810d163575Sopenharmony_ci    LITEOS_BASELIB     += -lliteipc
1820d163575Sopenharmony_ci    LIB_SUBDIRS           += kernel/extended/liteipc
1830d163575Sopenharmony_ci    LITEOS_LITEIPC_INCLUDE   += -I $(LITEOSTOPDIR)/kernel/extended/liteipc
1840d163575Sopenharmony_ciendif
1850d163575Sopenharmony_ci
1860d163575Sopenharmony_ciifeq ($(LOSCFG_KERNEL_PIPE), y)
1870d163575Sopenharmony_ci    LITEOS_BASELIB     += -lpipes
1880d163575Sopenharmony_ci    LIB_SUBDIRS           += kernel/extended/pipes
1890d163575Sopenharmony_ci    LITEOS_PIPE_INCLUDE   += -I $(LITEOSTOPDIR)/../../third_party/NuttX/drivers/pipes
1900d163575Sopenharmony_ciendif
1910d163575Sopenharmony_ci
1920d163575Sopenharmony_ciifeq ($(LOSCFG_KERNEL_PM), y)
1930d163575Sopenharmony_ci    LITEOS_BASELIB        += -lpower
1940d163575Sopenharmony_ci    LIB_SUBDIRS           += kernel/extended/power
1950d163575Sopenharmony_ci    LITEOS_PM_INCLUDE      = -I $(LITEOSTOPDIR)/kernel/extended/power
1960d163575Sopenharmony_ciendif
1970d163575Sopenharmony_ci
1980d163575Sopenharmony_ciifeq ($(LOSCFG_KERNEL_SYSCALL), y)
1990d163575Sopenharmony_ci    LITEOS_BASELIB += -lsyscall
2000d163575Sopenharmony_ci    LIB_SUBDIRS += syscall
2010d163575Sopenharmony_ciendif
2020d163575Sopenharmony_ci
2030d163575Sopenharmony_ciifeq ($(LOSCFG_KERNEL_PLIMITS), y)
2040d163575Sopenharmony_ci    LITEOS_BASELIB        += -lplimit
2050d163575Sopenharmony_ci    LIB_SUBDIRS           += kernel/extended/plimit
2060d163575Sopenharmony_ci    LITEOS_PLIMITS_INCLUDE = -I $(LITEOSTOPDIR)/kernel/extended/plimit
2070d163575Sopenharmony_ciendif
2080d163575Sopenharmony_ci
2090d163575Sopenharmony_ciLIB_SUBDIRS += kernel/user
2100d163575Sopenharmony_ci
2110d163575Sopenharmony_ci################################### Kernel Option End ################################
2120d163575Sopenharmony_ci
2130d163575Sopenharmony_ci#################################### Lib Option Begin ###############################
2140d163575Sopenharmony_ciLITEOS_BASELIB   += -lscrew
2150d163575Sopenharmony_ciLIB_SUBDIRS         += lib/libscrew
2160d163575Sopenharmony_ciLITEOS_LIBSCREW_INCLUDE += -I $(LITEOSTOPDIR)/lib/libscrew/include
2170d163575Sopenharmony_ci
2180d163575Sopenharmony_ciifeq ($(LOSCFG_LIB_LIBC), y)
2190d163575Sopenharmony_ci    LIB_SUBDIRS           += lib/libc/musl
2200d163575Sopenharmony_ci    LITEOS_BASELIB        += -lc
2210d163575Sopenharmony_ci    LITEOS_LIBC_INCLUDE   += \
2220d163575Sopenharmony_ci        -isystem $(LITEOSTHIRDPARTY)/musl/porting/liteos_a/kernel/include
2230d163575Sopenharmony_ci
2240d163575Sopenharmony_ci    LIB_SUBDIRS           += lib/libsec
2250d163575Sopenharmony_ci    LITEOS_BASELIB        += -lsec
2260d163575Sopenharmony_ci    LITEOS_LIBC_INCLUDE   += \
2270d163575Sopenharmony_ci        -I $(LITEOSTHIRDPARTY)/bounds_checking_function/include
2280d163575Sopenharmony_ci    LITEOS_CMACRO         += -DSECUREC_IN_KERNEL=0
2290d163575Sopenharmony_ciendif
2300d163575Sopenharmony_ci
2310d163575Sopenharmony_ciifeq ($(LOSCFG_LIB_ZLIB), y)
2320d163575Sopenharmony_ci    LITEOS_BASELIB += -lz
2330d163575Sopenharmony_ci    LIB_SUBDIRS    += lib/zlib
2340d163575Sopenharmony_ci    LITEOS_ZLIB_INCLUDE += -I $(LITEOSTHIRDPARTY)/zlib
2350d163575Sopenharmony_ciendif
2360d163575Sopenharmony_ci################################### Lib Option End ######################################
2370d163575Sopenharmony_ci
2380d163575Sopenharmony_ci####################################### Compat Option Begin #########################################
2390d163575Sopenharmony_ciifeq ($(LOSCFG_COMPAT_POSIX), y)
2400d163575Sopenharmony_ci    LITEOS_BASELIB += -lposix
2410d163575Sopenharmony_ci    LIB_SUBDIRS       += compat/posix
2420d163575Sopenharmony_ci    LITEOS_POSIX_INCLUDE   += \
2430d163575Sopenharmony_ci        -I $(LITEOSTOPDIR)/compat/posix/include
2440d163575Sopenharmony_ciendif
2450d163575Sopenharmony_ci
2460d163575Sopenharmony_ciifeq ($(LOSCFG_COMPAT_BSD), y)
2470d163575Sopenharmony_ci    LITEOS_BASELIB += -lbsd
2480d163575Sopenharmony_ci    LIB_SUBDIRS    += bsd
2490d163575Sopenharmony_ci    LITEOS_BSD_INCLUDE   += -I $(LITEOSTOPDIR)/bsd
2500d163575Sopenharmony_ci    LITEOS_BASELIB += -llinuxkpi
2510d163575Sopenharmony_ci    LIB_SUBDIRS       += bsd/compat/linuxkpi
2520d163575Sopenharmony_ci    LITEOS_LINUX_INCLUDE += -I $(LITEOSTOPDIR)/bsd/compat/linuxkpi/include \
2530d163575Sopenharmony_ci                            -I $(LITEOSTOPDIR)/bsd \
2540d163575Sopenharmony_ci                            -I $(LITEOSTOPDIR)/bsd/kern
2550d163575Sopenharmony_ciendif
2560d163575Sopenharmony_ci######################################## Compat Option End ############################################
2570d163575Sopenharmony_ci
2580d163575Sopenharmony_ci
2590d163575Sopenharmony_ci#################################### FS Option Begin ##################################
2600d163575Sopenharmony_ciifeq ($(LOSCFG_FS_VFS), y)
2610d163575Sopenharmony_ci    LITEOS_BASELIB += -lvfs -lmulti_partition
2620d163575Sopenharmony_ciifeq ($(LOSCFG_FS_VFS_BLOCK_DEVICE), y)
2630d163575Sopenharmony_ci    LITEOS_BASELIB += -lbch
2640d163575Sopenharmony_ci    LIB_SUBDIRS       += $(LITEOSTOPDIR)/drivers/char/bch
2650d163575Sopenharmony_ciendif
2660d163575Sopenharmony_ci    LIB_SUBDIRS       += fs/vfs drivers/mtd/multi_partition
2670d163575Sopenharmony_ci    LITEOS_VFS_INCLUDE   += -I $(LITEOSTOPDIR)/fs/include \
2680d163575Sopenharmony_ci                            -I $(LITEOSTOPDIR)/fs/vfs/include
2690d163575Sopenharmony_ci    LITEOS_VFS_INCLUDE   += -I $(LITEOSTOPDIR)/fs/vfs/include/operation
2700d163575Sopenharmony_ci    LITEOS_VFS_MTD_INCLUDE := -I $(LITEOSTOPDIR)/drivers/mtd/multi_partition/include
2710d163575Sopenharmony_ciendif
2720d163575Sopenharmony_ci
2730d163575Sopenharmony_ciifeq ($(LOSCFG_FS_FAT), y)
2740d163575Sopenharmony_ci    LITEOS_BASELIB  += -lfat
2750d163575Sopenharmony_ci    LIB_SUBDIRS     += fs/fat
2760d163575Sopenharmony_ci    LITEOS_FAT_INCLUDE += -I $(LITEOSTHIRDPARTY)/FatFs/source
2770d163575Sopenharmony_ciendif
2780d163575Sopenharmony_ci
2790d163575Sopenharmony_ciifeq ($(LOSCFG_FS_FAT_VIRTUAL_PARTITION), y)
2800d163575Sopenharmony_ci    LITEOS_BASELIB += -lvirpart
2810d163575Sopenharmony_ci    LIB_SUBDIRS += fs/fat/virpart
2820d163575Sopenharmony_ci    LITEOS_FAT_VIRPART_INCLUDE += -I $(LITEOSTOPDIR)/fs/fat/virpart/include
2830d163575Sopenharmony_ciendif
2840d163575Sopenharmony_ci
2850d163575Sopenharmony_ciifeq ($(LOSCFG_FS_FAT_DISK), y)
2860d163575Sopenharmony_ci    LITEOS_BASELIB += -ldisk
2870d163575Sopenharmony_ci    LIB_SUBDIRS += $(LITEOSTOPDIR)/drivers/block/disk
2880d163575Sopenharmony_ci    LITEOS_VFS_DISK_INCLUDE := -I $(LITEOSTOPDIR)/drivers/block/disk/include
2890d163575Sopenharmony_ciendif
2900d163575Sopenharmony_ci
2910d163575Sopenharmony_ciifeq ($(LOSCFG_FS_FAT_CACHE), y)
2920d163575Sopenharmony_ci    LITEOS_BASELIB  += -lbcache
2930d163575Sopenharmony_ci    LIB_SUBDIRS     += fs/vfs/bcache
2940d163575Sopenharmony_ci    LITEOS_FAT_CACHE_INCLUDE += -I $(LITEOSTOPDIR)/fs/vfs/include/bcache
2950d163575Sopenharmony_ciendif
2960d163575Sopenharmony_ci
2970d163575Sopenharmony_ci
2980d163575Sopenharmony_ciifeq ($(LOSCFG_FS_RAMFS), y)
2990d163575Sopenharmony_ci    LITEOS_BASELIB  += -lramfs
3000d163575Sopenharmony_ci    LIB_SUBDIRS     += fs/ramfs
3010d163575Sopenharmony_ciendif
3020d163575Sopenharmony_ci
3030d163575Sopenharmony_ciifeq ($(LOSCFG_FS_ROMFS), y)
3040d163575Sopenharmony_ci    LITEOS_BASELIB  += -lromfs
3050d163575Sopenharmony_ci    LIB_SUBDIRS     += fs/romfs
3060d163575Sopenharmony_ciendif
3070d163575Sopenharmony_ci
3080d163575Sopenharmony_ciifeq ($(LOSCFG_FS_NFS), y)
3090d163575Sopenharmony_ci    LITEOS_BASELIB  += -lnfs
3100d163575Sopenharmony_ci    LIB_SUBDIRS     += fs/nfs
3110d163575Sopenharmony_ciendif
3120d163575Sopenharmony_ci
3130d163575Sopenharmony_ciifeq ($(LOSCFG_FS_PROC), y)
3140d163575Sopenharmony_ci    LITEOS_BASELIB  += -lproc
3150d163575Sopenharmony_ci    LIB_SUBDIRS     += fs/proc
3160d163575Sopenharmony_ci    LITEOS_PROC_INCLUDE += -I $(LITEOSTOPDIR)/fs/proc/include
3170d163575Sopenharmony_ciendif
3180d163575Sopenharmony_ci
3190d163575Sopenharmony_ci
3200d163575Sopenharmony_ciifeq ($(LOSCFG_FS_JFFS), y)
3210d163575Sopenharmony_ci#    LITEOS_BASELIB  += -ljffs2
3220d163575Sopenharmony_ci#    LIB_SUBDIRS     += fs/jffs2
3230d163575Sopenharmony_ciendif
3240d163575Sopenharmony_ci
3250d163575Sopenharmony_ciifeq ($(LOSCFG_PLATFORM_ROOTFS), y)
3260d163575Sopenharmony_ci    LITEOS_BASELIB  += -lrootfs
3270d163575Sopenharmony_ci    LIB_SUBDIRS     += fs/rootfs
3280d163575Sopenharmony_ci    LITEOS_PLATFORM_INCLUDE     += -I $(LITEOSTOPDIR)/fs/rootfs
3290d163575Sopenharmony_ciendif
3300d163575Sopenharmony_ci
3310d163575Sopenharmony_ciifeq ($(LOSCFG_PLATFORM_PATCHFS), y)
3320d163575Sopenharmony_ci    LITEOS_BASELIB  += -lpatchfs
3330d163575Sopenharmony_ci    LIB_SUBDIRS     += fs/patchfs
3340d163575Sopenharmony_ciendif
3350d163575Sopenharmony_ci
3360d163575Sopenharmony_ciifeq ($(LOSCFG_FS_ZPFS), y)
3370d163575Sopenharmony_ci    LITEOS_BASELIB  += -lzpfs
3380d163575Sopenharmony_ci    LIB_SUBDIRS     += fs/zpfs
3390d163575Sopenharmony_ciendif
3400d163575Sopenharmony_ci#################################### FS Option End ##################################
3410d163575Sopenharmony_ci
3420d163575Sopenharmony_ci
3430d163575Sopenharmony_ci################################### Net Option Begin ###################################
3440d163575Sopenharmony_ciifeq ($(LOSCFG_NET_LWIP_SACK), y)
3450d163575Sopenharmony_ciifeq ($(LOSCFG_NET_LWIP_SACK_2_1), y)
3460d163575Sopenharmony_ci    LWIPDIR := $(LITEOSTHIRDPARTY)/lwip/src
3470d163575Sopenharmony_ci    LITEOS_BASELIB += -llwip
3480d163575Sopenharmony_ci    LIB_SUBDIRS       += net/lwip-2.1
3490d163575Sopenharmony_ci    LITEOS_LWIP_SACK_INCLUDE   += \
3500d163575Sopenharmony_ci        -I $(LITEOSTOPDIR)/net/lwip-2.1/porting/include \
3510d163575Sopenharmony_ci        -I $(LWIPDIR)/include \
3520d163575Sopenharmony_ci        -I $(LITEOSTOPDIR)/net/mac
3530d163575Sopenharmony_cielse ifeq ($(LOSCFG_NET_LWIP_SACK_2_0), y)
3540d163575Sopenharmony_ci    LWIPDIR := $(LITEOSTHIRDPARTY)/lwip_enhanced/src
3550d163575Sopenharmony_ci    LITEOS_BASELIB += -llwip
3560d163575Sopenharmony_ci    LIB_SUBDIRS       += $(LWIPDIR)
3570d163575Sopenharmony_ci    LITEOS_LWIP_SACK_INCLUDE   += \
3580d163575Sopenharmony_ci        -I $(LWIPDIR)/include \
3590d163575Sopenharmony_ci        -I $(LITEOSTOPDIR)/net/mac
3600d163575Sopenharmony_ci    LITEOS_CMACRO += -DLWIP_CONFIG_FILE=\"lwip/lwipopts.h\" -DLWIP_LITEOS_A_COMPAT
3610d163575Sopenharmony_cielse
3620d163575Sopenharmony_ci    $(error "unknown lwip version")
3630d163575Sopenharmony_ciendif
3640d163575Sopenharmony_ciendif
3650d163575Sopenharmony_ci
3660d163575Sopenharmony_ci#################################### Net Option End####################################
3670d163575Sopenharmony_ciLITEOS_DRIVERS_BASE_PATH := $(LITEOSTOPDIR)/../../drivers/liteos
3680d163575Sopenharmony_ci################################## Driver Option Begin #################################
3690d163575Sopenharmony_ciifeq ($(LOSCFG_DRIVERS_HDF), y)
3700d163575Sopenharmony_ciinclude $(LITEOSTOPDIR)/../../drivers/hdf_core/adapter/khdf/liteos/hdf_lite.mk
3710d163575Sopenharmony_ciendif
3720d163575Sopenharmony_ci
3730d163575Sopenharmony_ciifeq ($(LOSCFG_DRIVERS_HIEVENT), y)
3740d163575Sopenharmony_ci    LITEOS_BASELIB     += -lhievent
3750d163575Sopenharmony_ci    LIB_SUBDIRS           += $(LITEOS_DRIVERS_BASE_PATH)/hievent
3760d163575Sopenharmony_ci    LITEOS_HIEVENT_INCLUDE   += -I $(LITEOS_DRIVERS_BASE_PATH)/hievent/include
3770d163575Sopenharmony_ciendif
3780d163575Sopenharmony_ci
3790d163575Sopenharmony_ciifeq ($(LOSCFG_DRIVERS_TZDRIVER), y)
3800d163575Sopenharmony_ci    LITEOS_BASELIB   += -ltzdriver -lmbedtls
3810d163575Sopenharmony_ci    LIB_SUBDIRS         += $(LITEOS_DRIVERS_BASE_PATH)/tzdriver  $(LITEOSTOPDIR)/lib/libmbedtls
3820d163575Sopenharmony_ci    LITEOS_TZDRIVER_INCLUDE += -I $(LITEOS_DRIVERS_BASE_PATH)/tzdriver/include
3830d163575Sopenharmony_ciendif
3840d163575Sopenharmony_ci
3850d163575Sopenharmony_ciifeq ($(LOSCFG_DRIVERS_MEM), y)
3860d163575Sopenharmony_ci    LITEOS_BASELIB += -lmem
3870d163575Sopenharmony_ci    LIB_SUBDIRS       += $(LITEOSTOPDIR)/drivers/char/mem
3880d163575Sopenharmony_ci    LITEOS_DEV_MEM_INCLUDE = -I $(LITEOSTOPDIR)/drivers/char/mem/include
3890d163575Sopenharmony_ciendif
3900d163575Sopenharmony_ci
3910d163575Sopenharmony_ciifeq ($(LOSCFG_DRIVERS_TRACE), y)
3920d163575Sopenharmony_ci    LITEOS_BASELIB += -ltrace_dev
3930d163575Sopenharmony_ci    LIB_SUBDIRS       += $(LITEOSTOPDIR)/drivers/char/trace
3940d163575Sopenharmony_ciendif
3950d163575Sopenharmony_ci
3960d163575Sopenharmony_ciifeq ($(LOSCFG_DRIVERS_PERF), y)
3970d163575Sopenharmony_ci    LITEOS_BASELIB            += -lperf_dev
3980d163575Sopenharmony_ci    LIB_SUBDIRS               += $(LITEOSTOPDIR)/drivers/char/perf
3990d163575Sopenharmony_ci    LITEOS_DEV_PERF_INCLUDE   += -I $(LITEOSTOPDIR)/drivers/char/perf/include
4000d163575Sopenharmony_ciendif
4010d163575Sopenharmony_ci
4020d163575Sopenharmony_ciifeq ($(LOSCFG_DRIVERS_QUICKSTART), y)
4030d163575Sopenharmony_ci    LITEOS_BASELIB += -lquickstart
4040d163575Sopenharmony_ci    LIB_SUBDIRS       += $(LITEOSTOPDIR)/drivers/char/quickstart
4050d163575Sopenharmony_ci    LITEOS_DEV_QUICKSTART_INCLUDE = -I $(LITEOSTOPDIR)/drivers/char/quickstart/include
4060d163575Sopenharmony_ciendif
4070d163575Sopenharmony_ci
4080d163575Sopenharmony_ciifeq ($(LOSCFG_DRIVERS_RANDOM), y)
4090d163575Sopenharmony_ci    LITEOS_BASELIB += -lrandom
4100d163575Sopenharmony_ci    LIB_SUBDIRS    += $(LITEOSTOPDIR)/drivers/char/random
4110d163575Sopenharmony_ci    LITEOS_RANDOM_INCLUDE += -I $(LITEOSTOPDIR)/drivers/char/random/include
4120d163575Sopenharmony_ciendif
4130d163575Sopenharmony_ci
4140d163575Sopenharmony_ciifeq ($(LOSCFG_DRIVERS_USB), y)
4150d163575Sopenharmony_ci    LITEOS_BASELIB  += -lusb_base
4160d163575Sopenharmony_ci    LIB_SUBDIRS     += $(LITEOSTOPDIR)/bsd/dev/usb
4170d163575Sopenharmony_ci    LITEOS_USB_INCLUDE += -I $(LITEOSTOPDIR)/bsd/dev/usb
4180d163575Sopenharmony_ci    LITEOS_CMACRO   += -DUSB_DEBUG_VAR=5
4190d163575Sopenharmony_ciendif
4200d163575Sopenharmony_ci
4210d163575Sopenharmony_ciifeq ($(LOSCFG_DRIVERS_VIDEO), y)
4220d163575Sopenharmony_ci    LITEOS_BASELIB += -lvideo
4230d163575Sopenharmony_ci    LIB_SUBDIRS       += $(LITEOSTOPDIR)/drivers/char/video
4240d163575Sopenharmony_ci    LITEOS_VIDEO_INCLUDE += -I $(LITEOSTHIRDPARTY)/NuttX/include/nuttx/video
4250d163575Sopenharmony_ciendif
4260d163575Sopenharmony_ci
4270d163575Sopenharmony_ci############################## Driver Option End #######################################
4280d163575Sopenharmony_ci
4290d163575Sopenharmony_ci############################## Dfx Option Begin#######################################
4300d163575Sopenharmony_ciifeq ($(LOSCFG_BASE_CORE_HILOG), y)
4310d163575Sopenharmony_ci    LITEOS_BASELIB      += -lhilog
4320d163575Sopenharmony_ci    LIB_SUBDIRS         += $(LITEOSTOPDIR)/../../base/hiviewdfx/hilog_lite/frameworks/featured
4330d163575Sopenharmony_ci    LIB_SUBDIRS         += $(LITEOSTOPDIR)/kernel/extended/hilog
4340d163575Sopenharmony_ci    LITEOS_HILOG_INCLUDE  += -I $(LITEOSTOPDIR)/../../base/hiviewdfx/hilog_lite/interfaces/native/kits
4350d163575Sopenharmony_ci    LITEOS_HILOG_INCLUDE  += -I $(LITEOSTOPDIR)/../../base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog
4360d163575Sopenharmony_ci    LITEOS_HILOG_INCLUDE  += -I $(LITEOSTOPDIR)/kernel/extended/hilog
4370d163575Sopenharmony_ciendif
4380d163575Sopenharmony_ciifeq ($(LOSCFG_BLACKBOX), y)
4390d163575Sopenharmony_ci    LITEOS_BASELIB     += -lblackbox
4400d163575Sopenharmony_ci    LIB_SUBDIRS           += $(LITEOSTOPDIR)/kernel/extended/blackbox
4410d163575Sopenharmony_ci    LITEOS_BLACKBOX_INCLUDE  += -I $(LITEOSTOPDIR)/kernel/extended/blackbox
4420d163575Sopenharmony_ciendif
4430d163575Sopenharmony_ciifeq ($(LOSCFG_HIDUMPER), y)
4440d163575Sopenharmony_ci    LITEOS_BASELIB     += -lhidumper
4450d163575Sopenharmony_ci    LIB_SUBDIRS           += $(LITEOSTOPDIR)/kernel/extended/hidumper
4460d163575Sopenharmony_ci    LITEOS_HIDUMPER_INCLUDE  += -I $(LITEOSTOPDIR)/kernel/extended/hidumper
4470d163575Sopenharmony_ciendif
4480d163575Sopenharmony_ci############################## Dfx Option End #######################################
4490d163575Sopenharmony_ci
4500d163575Sopenharmony_ci############################# Tools && Debug Option Begin ##############################
4510d163575Sopenharmony_ciifeq ($(LOSCFG_COMPRESS), y)
4520d163575Sopenharmony_ci    LITEOS_BASELIB    += -lcompress
4530d163575Sopenharmony_ci    LIB_SUBDIRS       += tools/compress
4540d163575Sopenharmony_ciendif
4550d163575Sopenharmony_ci
4560d163575Sopenharmony_ciifneq ($(LOSCFG_DEBUG_VERSION), y)
4570d163575Sopenharmony_ci    LITEOS_COPTS_DEBUG  += -DNDEBUG
4580d163575Sopenharmony_ciendif
4590d163575Sopenharmony_ci
4600d163575Sopenharmony_ciifeq ($(LOSCFG_COMPILE_DEBUG), y)
4610d163575Sopenharmony_ci    LITEOS_COPTS_OPTIMIZE = -O0
4620d163575Sopenharmony_ci    LITEOS_COPTS_OPTION  = -g -gdwarf-2
4630d163575Sopenharmony_ciendif
4640d163575Sopenharmony_ciifeq ($(LOSCFG_COMPILE_OPTIMIZE), y)
4650d163575Sopenharmony_ci    LITEOS_COPTS_OPTIMIZE = -O2
4660d163575Sopenharmony_ciendif
4670d163575Sopenharmony_ciifeq ($(LOSCFG_COMPILE_OPTIMIZE_SIZE), y)
4680d163575Sopenharmony_ci    ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
4690d163575Sopenharmony_ci        LITEOS_COPTS_OPTIMIZE = -Oz
4700d163575Sopenharmony_ci    else
4710d163575Sopenharmony_ci        LITEOS_COPTS_OPTIMIZE = -Os
4720d163575Sopenharmony_ci    endif
4730d163575Sopenharmony_ciendif
4740d163575Sopenharmony_ciifeq ($(LOSCFG_COMPILE_LTO), y)
4750d163575Sopenharmony_ci    ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
4760d163575Sopenharmony_ci        LITEOS_COPTS_OPTIMIZE += -flto=thin
4770d163575Sopenharmony_ci    else
4780d163575Sopenharmony_ci        LITEOS_COPTS_OPTIMIZE += -flto
4790d163575Sopenharmony_ci    endif
4800d163575Sopenharmony_ciendif
4810d163575Sopenharmony_ci    LITEOS_COPTS_DEBUG  += $(LITEOS_COPTS_OPTION) $(LITEOS_COPTS_OPTIMIZE)
4820d163575Sopenharmony_ci    LITEOS_CXXOPTS_BASE += $(LITEOS_COPTS_OPTION) $(LITEOS_COPTS_OPTIMIZE)
4830d163575Sopenharmony_ci    LITEOS_ASOPTS   += $(LITEOS_COPTS_OPTION)
4840d163575Sopenharmony_ci
4850d163575Sopenharmony_ciifeq ($(LOSCFG_SHELL), y)
4860d163575Sopenharmony_ci    LITEOS_BASELIB += -lshell
4870d163575Sopenharmony_ci    LIB_SUBDIRS       += shell
4880d163575Sopenharmony_ci    LITEOS_SHELL_INCLUDE  += -I $(LITEOSTOPDIR)/shell/full/include
4890d163575Sopenharmony_ciendif
4900d163575Sopenharmony_ci
4910d163575Sopenharmony_ci
4920d163575Sopenharmony_ciifeq ($(LOSCFG_NET_TELNET), y)
4930d163575Sopenharmony_ci    LITEOS_BASELIB += -ltelnet
4940d163575Sopenharmony_ci    LIB_SUBDIRS       += net/telnet
4950d163575Sopenharmony_ci    LITEOS_TELNET_INCLUDE   += \
4960d163575Sopenharmony_ci        -I $(LITEOSTOPDIR)/net/telnet/include
4970d163575Sopenharmony_ciendif
4980d163575Sopenharmony_ci############################# Tools && Debug Option End #################################
4990d163575Sopenharmony_ci
5000d163575Sopenharmony_ci############################# Security Option Begin ##############################
5010d163575Sopenharmony_ciLITEOS_SSP = -fno-stack-protector
5020d163575Sopenharmony_ciifeq ($(LOSCFG_CC_STACKPROTECTOR), y)
5030d163575Sopenharmony_ci    LITEOS_SSP = -fstack-protector --param ssp-buffer-size=4
5040d163575Sopenharmony_ciendif
5050d163575Sopenharmony_ci
5060d163575Sopenharmony_ciifeq ($(LOSCFG_CC_STACKPROTECTOR_STRONG), y)
5070d163575Sopenharmony_ci    LITEOS_SSP = -fstack-protector-strong
5080d163575Sopenharmony_ciendif
5090d163575Sopenharmony_ci
5100d163575Sopenharmony_ciifeq ($(LOSCFG_CC_STACKPROTECTOR_ALL), y)
5110d163575Sopenharmony_ci    LITEOS_SSP = -fstack-protector-all
5120d163575Sopenharmony_ciendif
5130d163575Sopenharmony_ci
5140d163575Sopenharmony_ciifeq ($(LOSCFG_SECURITY), y)
5150d163575Sopenharmony_ci    LIB_SUBDIRS += security
5160d163575Sopenharmony_ci    LITEOS_BASELIB += -lsecurity
5170d163575Sopenharmony_ciifeq ($(LOSCFG_SECURITY_CAPABILITY), y)
5180d163575Sopenharmony_ci    LITEOS_SECURITY_CAP_INC := -I $(LITEOSTOPDIR)/security/cap
5190d163575Sopenharmony_ciendif
5200d163575Sopenharmony_ciifeq ($(LOSCFG_SECURITY_VID), y)
5210d163575Sopenharmony_ci    LITEOS_SECURITY_VID_INC := -I $(LITEOSTOPDIR)/security/vid
5220d163575Sopenharmony_ciendif
5230d163575Sopenharmony_ciendif
5240d163575Sopenharmony_ci
5250d163575Sopenharmony_ci############################# Security Option End ##############################
5260d163575Sopenharmony_ci
5270d163575Sopenharmony_ciLITEOS_EXTKERNEL_INCLUDE   := $(LITEOS_CPPSUPPORT_INCLUDE) $(LITEOS_DYNLOAD_INCLUDE) \
5280d163575Sopenharmony_ci                              $(LITEOS_TICKLESS_INCLUDE)   $(LITEOS_HOOK_INCLUDE)\
5290d163575Sopenharmony_ci                              $(LITEOS_VDSO_INCLUDE)       $(LITEOS_LITEIPC_INCLUDE) \
5300d163575Sopenharmony_ci                              $(LITEOS_PIPE_INCLUDE)       $(LITEOS_CPUP_INCLUDE) \
5310d163575Sopenharmony_ci                              $(LITEOS_PERF_INCLUDE)       $(LITEOS_LMS_INCLUDE) \
5320d163575Sopenharmony_ci                              $(LITEOS_PM_INCLUDE)         $(LITEOS_PLIMITS_INCLUDE)
5330d163575Sopenharmony_ciLITEOS_COMPAT_INCLUDE      := $(LITEOS_POSIX_INCLUDE) $(LITEOS_LINUX_INCLUDE) \
5340d163575Sopenharmony_ci                              $(LITEOS_BSD_INCLUDE)
5350d163575Sopenharmony_ciLITEOS_FS_INCLUDE          := $(LITEOS_VFS_INCLUDE)        $(LITEOS_FAT_CACHE_INCLUDE) \
5360d163575Sopenharmony_ci                              $(LITEOS_VFS_MTD_INCLUDE)    $(LITEOS_VFS_DISK_INCLUDE) \
5370d163575Sopenharmony_ci                              $(LITEOS_PROC_INCLUDE)       $(LITEOS_FAT_VIRPART_INCLUDE) \
5380d163575Sopenharmony_ci                              $(LITEOS_FAT_INCLUDE)
5390d163575Sopenharmony_ciLITEOS_NET_INCLUDE         := $(LITEOS_LWIP_SACK_INCLUDE)
5400d163575Sopenharmony_ciLITEOS_LIB_INCLUDE         := $(LITEOS_LIBC_INCLUDE)       $(LITEOS_LIBM_INCLUDE) \
5410d163575Sopenharmony_ci                              $(LITEOS_ZLIB_INCLUDE)       $(LITEOS_LIBSCREW_INCLUDE)
5420d163575Sopenharmony_ciLITEOS_DRIVERS_INCLUDE     := $(LITEOS_CELLWISE_INCLUDE)   $(LITEOS_GPIO_INCLUDE) \
5430d163575Sopenharmony_ci                              $(LITEOS_HIDMAC_INCLUDE)     $(LITEOS_HIETH_SF_INCLUDE) \
5440d163575Sopenharmony_ci                              $(LITEOS_HIGMAC_INCLUDE)     $(LITEOS_I2C_INCLUDE) \
5450d163575Sopenharmony_ci                              $(LITEOS_LCD_INCLUDE)        $(LITEOS_MMC_INCLUDE) \
5460d163575Sopenharmony_ci                              $(LITEOS_MTD_SPI_NOR_INCLUDE) $(LITEOS_MTD_NAND_INCLUDE) \
5470d163575Sopenharmony_ci                              $(LITEOS_RANDOM_INCLUDE)     $(LITEOS_RTC_INCLUDE) \
5480d163575Sopenharmony_ci                              $(LITEOS_SPI_INCLUDE)        $(LITEOS_USB_INCLUDE) \
5490d163575Sopenharmony_ci                              $(LITEOS_WTDG_INCLUDE)       $(LITEOS_DBASE_INCLUDE) \
5500d163575Sopenharmony_ci                              $(LITEOS_CPUFREQ_INCLUDE)    $(LITEOS_DEVFREQ_INCLUDE) \
5510d163575Sopenharmony_ci                              $(LITEOS_REGULATOR_INCLUDE)  $(LITEOS_VIDEO_INCLUDE) \
5520d163575Sopenharmony_ci                              $(LITEOS_DRIVERS_HDF_INCLUDE) $(LITEOS_TZDRIVER_INCLUDE) \
5530d163575Sopenharmony_ci                              $(LITEOS_HIEVENT_INCLUDE)    $(LITEOS_DEV_MEM_INCLUDE) \
5540d163575Sopenharmony_ci                              $(LITEOS_DEV_QUICKSTART_INCLUDE) $(LITEOS_DEV_PERF_INCLUDE)
5550d163575Sopenharmony_ciLITEOS_DFX_INCLUDE    := $(LITEOS_HILOG_INCLUDE) \
5560d163575Sopenharmony_ci                         $(LITEOS_BLACKBOX_INCLUDE) \
5570d163575Sopenharmony_ci                         $(LITEOS_HIDUMPER_INCLUDE)
5580d163575Sopenharmony_ci
5590d163575Sopenharmony_ciLITEOS_SECURITY_INCLUDE    := $(LITEOS_SECURITY_CAP_INC) $(LITEOS_SECURITY_VID_INC)
5600d163575Sopenharmony_ciLITEOS_TOOLS_DEBUG_INCLUDE := $(LITEOS_SHELL_INCLUDE)  $(LITEOS_UART_INCLUDE) \
5610d163575Sopenharmony_ci                              $(LITEOS_TELNET_INCLUDE)
5620d163575Sopenharmony_ci
5630d163575Sopenharmony_ciLITEOS_COMMON_OPTS  := -fno-pic -fno-builtin -nostdinc -nostdlib -Wall -Werror -fms-extensions -fno-omit-frame-pointer -Wno-address-of-packed-member -Winvalid-pch
5640d163575Sopenharmony_ci
5650d163575Sopenharmony_ciLITEOS_CXXOPTS_BASE += $(LITEOS_COMMON_OPTS) -std=c++11 -nostdinc++ -fexceptions -fpermissive -fno-use-cxa-atexit -frtti
5660d163575Sopenharmony_ci
5670d163575Sopenharmony_ciLITEOS_COPTS_BASE   += $(LITEOS_COMMON_OPTS) $(LITEOS_SSP) -fno-strict-aliasing -fno-common -fsigned-char -mno-unaligned-access
5680d163575Sopenharmony_ciifneq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
5690d163575Sopenharmony_ciLITEOS_COPTS_BASE   += -fno-aggressive-loop-optimizations
5700d163575Sopenharmony_ciendif
5710d163575Sopenharmony_ci
5720d163575Sopenharmony_ciLITEOS_COPTS_EXTRA  += -std=c99 -Wpointer-arith -Wstrict-prototypes -ffunction-sections -fdata-sections -fno-exceptions -fno-short-enums
5730d163575Sopenharmony_ciLITEOS_COPTS_EXTRA  += -Wno-strict-prototypes -Wno-deprecated-non-prototype -Wno-unused-but-set-variable
5740d163575Sopenharmony_ci
5750d163575Sopenharmony_ciifeq ($(LOSCFG_ARCH_ARM_AARCH32), y)
5760d163575Sopenharmony_ciifneq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
5770d163575Sopenharmony_ciLITEOS_COPTS_EXTRA  += -mthumb-interwork
5780d163575Sopenharmony_ciendif
5790d163575Sopenharmony_ciendif
5800d163575Sopenharmony_ci
5810d163575Sopenharmony_ciifeq ($(LOSCFG_THUMB), y)
5820d163575Sopenharmony_ciifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
5830d163575Sopenharmony_ciLITEOS_CFLAGS_INTERWORK := -mthumb -mimplicit-it=thumb
5840d163575Sopenharmony_cielse
5850d163575Sopenharmony_ciLITEOS_CFLAGS_INTERWORK := -mthumb -Wa,-mimplicit-it=thumb
5860d163575Sopenharmony_ciendif
5870d163575Sopenharmony_ciendif
5880d163575Sopenharmony_ci
5890d163575Sopenharmony_ci# kernel configuration macros
5900d163575Sopenharmony_ciLITEOS_CMACRO     += -imacros "$(LITEOS_MENUCONFIG_H)"
5910d163575Sopenharmony_ci
5920d163575Sopenharmony_ciifneq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
5930d163575Sopenharmony_ciLITEOS_LD_OPTS += -nostartfiles
5940d163575Sopenharmony_ciendif
5950d163575Sopenharmony_ciLITEOS_LD_OPTS += -static --gc-sections
5960d163575Sopenharmony_ciLITEOS_LD_PATH += -L$(OUT)/lib
5970d163575Sopenharmony_ci
5980d163575Sopenharmony_ciifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
5990d163575Sopenharmony_ciLITEOS_LD_SCRIPT := -T$(LITEOSTOPDIR)/tools/build/liteos_llvm.ld
6000d163575Sopenharmony_cielse
6010d163575Sopenharmony_ciLITEOS_LD_SCRIPT := -T$(LITEOSTOPDIR)/tools/build/liteos.ld
6020d163575Sopenharmony_ciendif
6030d163575Sopenharmony_ci
6040d163575Sopenharmony_ci##compiler##
6050d163575Sopenharmony_ciLITEOS_BASELIB     += $(shell $(CC) $(LITEOS_CORE_COPTS) "-print-libgcc-file-name")
6060d163575Sopenharmony_ciLITEOS_LIB_INCLUDE += -isystem $(shell $(CC) $(LITEOS_CORE_COPTS) "-print-file-name=include")
607