提交 5edd78e7 编写于 作者: O openharmony_ci 提交者: Gitee

!513 fix: clang相关编译选项隔离

Merge pull request !513 from MGY917/clang_isolation
...@@ -39,11 +39,16 @@ BUILD_DIR := $(MKSH_DIR)/build ...@@ -39,11 +39,16 @@ BUILD_DIR := $(MKSH_DIR)/build
BUILD_LOG := $(MKSH_DIR)/build.log BUILD_LOG := $(MKSH_DIR)/build.log
TARGET_OS := OpenHarmony TARGET_OS := OpenHarmony
LOCAL_CFLAGS := -flto -fdata-sections -ffunction-sections -Oz -fstack-protector-strong -D_FORTIFY_SOURCE=2 LOCAL_CFLAGS := -flto -fdata-sections -ffunction-sections -fstack-protector-strong -D_FORTIFY_SOURCE=2
LOCAL_CFLAGS += --target=$(LLVM_TARGET) $(LLVM_SYSROOT)
LOCAL_CFLAGS += -DMKSH_DISABLE_TTY_WARNING -DMKSH_SMALL=1 -DMKSH_ASSUME_UTF8=1 -DMKSH_SMALL_BUT_FAST=0 -DMKSH_S_NOVI=1 -DHAVE_CAN_FSTACKPROTECTORSTRONG=1 LOCAL_CFLAGS += -DMKSH_DISABLE_TTY_WARNING -DMKSH_SMALL=1 -DMKSH_ASSUME_UTF8=1 -DMKSH_SMALL_BUT_FAST=0 -DMKSH_S_NOVI=1 -DHAVE_CAN_FSTACKPROTECTORSTRONG=1
LOCAL_CFLAGS += -DMKSH_LESS_CMDLINE_EDITING -DMKSH_LESS_BUILDINS -DMKSH_NO_INITCOMS -DADAPT_FOR_LITEOS_A LOCAL_CFLAGS += -DMKSH_LESS_CMDLINE_EDITING -DMKSH_LESS_BUILDINS -DMKSH_NO_INITCOMS -DADAPT_FOR_LITEOS_A
LOCAL_LDFLAGS := -Wl,--gc-sections -flto -O2 --target=$(LLVM_TARGET) $(LLVM_SYSROOT) LOCAL_LDFLAGS := -Wl,--gc-sections -flto -O2
ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
LOCAL_CFLAGS += -Oz --target=$(LLVM_TARGET) $(LLVM_SYSROOT)
else
LOCAL_CFLAGS += -O2
endif
all:$(MKSH) all:$(MKSH)
...@@ -64,8 +69,10 @@ endif ...@@ -64,8 +69,10 @@ endif
$(HIDE)$(CP) $(MKSH) $(APPS_OUT) $(HIDE)$(CP) $(MKSH) $(APPS_OUT)
$(HIDE)mkdir -p $(ETC_OUT) $(HIDE)mkdir -p $(ETC_OUT)
$(HIDE)$(CP) -rf $(BUILD_DIR)/.mkshrc $(ETC_OUT)/ $(HIDE)$(CP) -rf $(BUILD_DIR)/.mkshrc $(ETC_OUT)/
$(HIDE)$(RM) $(BUILD_DIR) $(BUILD_LOG)
clean: clean:
$(HIDE)$(RM) $(MKSH) $(BUILD_DIR) $(BUILD_LOG) $(HIDE)$(RM) $(MKSH) $(BUILD_DIR) $(BUILD_LOG)
.PHONY: all $(MKSH) clean .PHONY: all $(MKSH) clean
...@@ -38,6 +38,13 @@ BUILD_DIR := $(TOYBOX_DIR)/build ...@@ -38,6 +38,13 @@ BUILD_DIR := $(TOYBOX_DIR)/build
BUILD_LOG := $(TOYBOX_DIR)/build.log BUILD_LOG := $(TOYBOX_DIR)/build.log
OUTNAME := $(TOYBOX) OUTNAME := $(TOYBOX)
CFLAGS := -D_FORTIFY_SOURCE=2 -fstack-protector-strong
LDFLAGS :=
ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
CFLAGS += --target=$(LLVM_TARGET) $(LLVM_SYSROOT)
LDFLAGS += --target=$(LLVM_TARGET) $(LLVM_SYSROOT)
endif
$(TOYBOX): $(TOYBOX):
ifneq ($(wildcard $(BUILD_DIR)),) ifneq ($(wildcard $(BUILD_DIR)),)
$(HIDE)echo "not clean, rebuilding now"; $(HIDE)echo "not clean, rebuilding now";
...@@ -46,12 +53,14 @@ else ...@@ -46,12 +53,14 @@ else
$(HIDE)$(CP) $(LITEOSTHIRDPARTY)/$(TOYBOX)/. $(BUILD_DIR) $(HIDE)$(CP) $(LITEOSTHIRDPARTY)/$(TOYBOX)/. $(BUILD_DIR)
$(HIDE)$(CP) -p $(LITEOSTHIRDPARTY)/$(TOYBOX)/porting/liteos_a/. $(BUILD_DIR) $(HIDE)$(CP) -p $(LITEOSTHIRDPARTY)/$(TOYBOX)/porting/liteos_a/. $(BUILD_DIR)
endif endif
$(HIDE)CFLAGS="-D_FORTIFY_SOURCE=2 -fstack-protector-strong --target=$(LLVM_TARGET) $(LLVM_SYSROOT)" CC="$(CC)" OUTNAME=$(OUTNAME) \
LDFLAGS="--target=$(LLVM_TARGET) $(LLVM_SYSROOT)" \ $(HIDE)CFLAGS="$(CFLAGS)" CC="$(CC)" OUTNAME="$(OUTNAME)" \
LDFLAGS="$(LDFLAGS)" STRIP="$(STRIP)" \
make -C $(BUILD_DIR) toybox -j> $(BUILD_LOG) 2>&1 make -C $(BUILD_DIR) toybox -j> $(BUILD_LOG) 2>&1
$(HIDE)$(CP) $(BUILD_DIR)/$(TOYBOX) . $(HIDE)$(CP) $(BUILD_DIR)/$(TOYBOX) .
$(HIDE)mkdir -p $(APPS_OUT) $(HIDE)mkdir -p $(APPS_OUT)
$(HIDE)$(CP) $(TOYBOX) $(APPS_OUT) $(HIDE)$(CP) $(TOYBOX) $(APPS_OUT)
$(HIDE)$(RM) $(BUILD_DIR) $(BUILD_LOG)
clean: clean:
$(HIDE)$(RM) $(TOYBOX) $(BUILD_DIR) $(BUILD_LOG) $(HIDE)$(RM) $(TOYBOX) $(BUILD_DIR) $(BUILD_LOG)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册