提交 181322a3 编写于 作者: C Caoruihong

chore(make): fix and optimize some build scripts

Signed-off-by: NCaoruihong <crh.cao@huawei.com>
Change-Id: I2e61b7ea231be78423dc10412e0ab9a710cad8ef
上级 5369b6aa
......@@ -17,7 +17,6 @@ tags
# Menuconfig temp files
/config.h
/defconfig
/.config
/.config.old
......
......@@ -262,14 +262,11 @@ config("los_common") {
}
if (defined(LOSCFG_THUMB)) {
cflags += [
"-mthumb",
"-Wa,-mimplicit-it=thumb",
]
cflags += [ "-mthumb" ]
if (defined(LOSCFG_COMPILER_CLANG_LLVM)) {
# llvm-as do not support "-mimplicit-it=thumb" option currently,
# so we remove it temporary.
cflags -= [ "-Wa,-mimplicit-it=thumb" ]
cflags += [ "-mimplicit-it=thumb" ]
} else {
cflags += [ "-Wa,-mimplicit-it=thumb" ]
}
}
......
......@@ -28,6 +28,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
LITEOSTOPDIR := $(realpath $(dir $(firstword $(MAKEFILE_LIST))))
export LITEOSTOPDIR
APPS = apps
ROOTFS = rootfs
......@@ -64,7 +65,6 @@ LITEOS_MENUCONFIG_H ?= $(LITEOSTOPDIR)/config.h
LITEOS_CONFIG_FILE ?= $(LITEOSTOPDIR)/.config
# export los_config.mk related environment variables
export LITEOSTOPDIR
export LITEOS_MENUCONFIG_H
export LITEOS_CONFIG_FILE
......
......@@ -66,8 +66,6 @@ LITEOS_GCCLIB := $(subst cortex-,,$(LOSCFG_ARCH_CPU))_softfp_$(LOSCFG_
endif
LITEOS_CORE_COPTS = $(or $(ARCH_CFLAGS),$(LITEOS_CPU_OPTS) $(LITEOS_FLOAT_OPTS) $(LITEOS_FPU_OPTS))
LITEOS_INTERWORK += $(LITEOS_CORE_COPTS)
LITEOS_NODEBUG += $(LITEOS_CORE_COPTS)
LITEOS_ASOPTS += $(LITEOS_CPU_OPTS)
LITEOS_CXXOPTS_BASE += $(LITEOS_CORE_COPTS)
......
......@@ -30,38 +30,36 @@
import("//kernel/liteos_a/liteos.gni")
module_name = "userinit"
executable(module_name) {
kernel_module(module_name) {
sources = [ "src/los_user_init.c" ]
include_dirs = [
"include",
"$LITEOSTOPDIR/syscall",
]
}
configs = []
configs += [
"$LITEOSTOPDIR:public",
"$LITEOSTOPDIR:los_config",
]
config("public") {
}
userinit = "lib$module_name.O"
executable(userinit) {
output_dir = target_out_dir
deps = [ ":$module_name" ]
configs = []
configs += [ "$LITEOSTOPDIR:los_config" ]
ldflags = [
"-static",
"-Wl,-r",
]
}
output_dir = target_out_dir
copy("copy_userinit") {
deps = [ ":$userinit" ]
sources = [ "$target_out_dir/unstripped/bin/$userinit" ]
outputs = [ "$root_out_dir/$userinit" ]
}
group("user") {
public_deps = [ ":$module_name" ]
deps = [ ":copy_userinit" ]
}
config("public") {
}
copy("copy_userinit") {
deps = [ ":$module_name" ]
sources = [ "$target_out_dir/unstripped/bin/$module_name" ]
outputs = [ "$root_out_dir/lib$module_name.O" ]
}
......@@ -32,17 +32,8 @@ include $(LITEOSTOPDIR)/config.mk
MODULE_NAME := userinit
LOCAL_INCLUDE := \
-I $(LITEOSTOPDIR)/kernel/base/include\
-I $(LITEOSTOPDIR)/kernel/include \
-I $(LITEOSTOPDIR)/kernel/extended/include \
-I $(LITEOSTOPDIR)/syscall \
-I $(LITEOSTOPDIR)/fs/vfs \
-I $(LITEOSTHIRDPARTY)/FatFs/source \
-I $(LITEOSTOPDIR)/fs/proc/include \
-I $(LITEOSTOPDIR)/fs/jffs2/include\
-I $(LITEOSTOPDIR)/fs/nfs/include\
-I $(LITEOSTOPDIR)/bsd/compat/linuxkpi/include \
-I $(LITEOSTOPDIR)/kernel/user/include
-I include
LOCAL_SRCS := $(wildcard src/*.c) \
$(wildcard src/*.S)
......
......@@ -56,16 +56,11 @@ LITEOS_CPU_TYPE :=
LITEOS_ASOPTS :=
LITEOS_COPTS_BASE :=
LITEOS_COPTS_EXTRA :=
LITEOS_COPTS_EXTRA_INTERWORK :=
LITEOS_COPTS_DEBUG :=
LITEOS_COPTS_NODEBUG :=
LITEOS_INTERWORK :=
LITEOS_CXXOPTS :=
LITEOS_CXXOPTS_BASE :=
LITEOS_LD_OPTS :=
LITEOS_GCOV_OPTS :=
## dynload ld options ##
LITEOS_DYNLOADOPTS :=
## macro define ##
LITEOS_CMACRO :=
LITEOS_CXXMACRO :=
......@@ -77,7 +72,6 @@ LITEOS_LD_SCRIPT :=
## c as cxx ld flags ##
LITEOS_ASFLAGS :=
LITEOS_CFLAGS :=
LITEOS_CFLAGS_INTERWORK :=
LITEOS_LDFLAGS :=
LITEOS_CXXFLAGS :=
## depended lib ##
......@@ -395,7 +389,7 @@ endif
ifeq ($(LOSCFG_DRIVERS_VIDEO), y)
LITEOS_BASELIB += -lvideo
LIB_SUBDIRS += $(LITEOSTOPDIR)/drivers/char/video
LITEOS_VIDEO_INCLUDE += -I $(LITEOSTOPDIR)/../../third_party/NuttX/include/nuttx/video
LITEOS_VIDEO_INCLUDE += -I $(LITEOSTHIRDPARTY)/NuttX/include/nuttx/video
endif
############################## Driver Option End #######################################
......@@ -426,6 +420,10 @@ ifeq ($(LOSCFG_COMPRESS), y)
LIB_SUBDIRS += tools/compress
endif
ifneq ($(LOSCFG_DEBUG_VERSION), y)
LITEOS_COPTS_DEBUG += -DNDEBUG
endif
ifeq ($(LOSCFG_COMPILE_DEBUG), y)
LITEOS_COPTS_OPTMIZE = -O0
LITEOS_COPTS_OPTION = -g -gdwarf-2
......@@ -435,13 +433,10 @@ else
else
LITEOS_COPTS_OPTMIZE = -O2
endif
LITEOS_COPTS_OPTMIZE_NODEBUG = -O0
endif
LITEOS_COPTS_DEBUG += $(LITEOS_COPTS_OPTION) $(LITEOS_COPTS_OPTMIZE)
LITEOS_INTERWORK += $(LITEOS_COPTS_OPTION) $(LITEOS_COPTS_OPTMIZE)
LITEOS_CXXOPTS_BASE += $(LITEOS_COPTS_OPTION) $(LITEOS_COPTS_OPTMIZE)
LITEOS_ASOPTS += $(LITEOS_COPTS_OPTION)
LITEOS_NODEBUG += $(LITEOS_COPTS_OPTMIZE_NODEBUG)
ifeq ($(LOSCFG_SHELL), y)
LITEOS_BASELIB += -lshell
......@@ -577,11 +572,11 @@ endif
endif
LITEOS_COPTS_EXTRA += -fno-short-enums
ifeq ($(LOSCFG_THUMB), y)
LITEOS_COPTS_EXTRA_INTERWORK := $(LITEOS_COPTS_EXTRA) -mthumb -Wa,-mimplicit-it=thumb
LITEOS_CMACRO += -DLOSCFG_INTERWORK_THUMB
ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
LITEOS_CFLAGS_INTERWORK := -mthumb -mimplicit-it=thumb
else
LITEOS_COPTS_EXTRA_INTERWORK := $(LITEOS_COPTS_EXTRA)
#-fno-inline
LITEOS_CFLAGS_INTERWORK := -mthumb -Wa,-mimplicit-it=thumb
endif
endif
# kernel configuration macros
......@@ -591,12 +586,7 @@ ifneq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
LITEOS_LD_OPTS += -nostartfiles
endif
LITEOS_LD_OPTS += -static --gc-sections
LITEOS_LD_OPTS += $(LITEOS_DYNLOADOPTS)
LITEOS_LD_PATH += -L$(OUT)/lib
ifeq ($(LOSCFG_VENDOR) ,y)
LITEOS_LD_PATH += -L$(OUT)/lib/rdk -L$(OUT)/lib/sdk \
-L$(OUT)/lib/main_server
endif
ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
LITEOS_LD_SCRIPT := -T$(LITEOSTOPDIR)/tools/build/liteos_llvm.ld
......@@ -614,17 +604,3 @@ LITEOS_BASELIB += $(shell $(_CC) "-print-file-name=libgcc_eh.a")
endif
LITEOS_BASELIB += $(shell $(_CC) "-print-libgcc-file-name")
LITEOS_LIB_INCLUDE += -isystem $(shell $(_CC) "-print-file-name=include")
LITEOS_CXXINCLUDE = $(LITEOS_INCLUDE)
LITEOS_COPTS_NODEBUG := $(LITEOS_NODEBUG) $(LITEOS_COPTS_BASE) $(LITEOS_COPTS_EXTRA)
LITEOS_COPTS_INTERWORK := $(LITEOS_INTERWORK) $(LITEOS_COPTS_BASE) $(LITEOS_COPTS_EXTRA_INTERWORK)
LITEOS_BASE_INCLUDE := $(LITEOS_KERNEL_INCLUDE) $(LITEOS_PLATFORM_INCLUDE) \
$(LITEOS_LIB_INCLUDE) $(LITEOS_FS_INCLUDE) \
$(LITEOS_EXTKERNEL_INCLUDE) \
$(LITEOS_COMPAT_INCLUDE) $(LITEOS_DRIVERS_INCLUDE) \
$(LOSCFG_TOOLS_DEBUG_INCLUDE) $(LITEOS_NET_INCLUDE)
LITEOS_CFLAGS_INTERWORK := $(LITEOS_COPTS_INTERWORK) $(LITEOS_CMACRO) \
$(LITEOS_IMAGE_MACRO) $(LITEOS_BASE_INCLUDE)
LITEOS_CFLAGS_NODEBUG := $(LITEOS_COPTS_NODEBUG) $(LITEOS_CMACRO) \
$(LITEOS_IMAGE_MACRO) $(LITEOS_BASE_INCLUDE)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册