• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2022 Huawei Technologies Co., Ltd.
2# Licensed under the Mulan PSL v2.
3# You can use this software according to the terms and conditions of the Mulan PSL v2.
4# You may obtain a copy of Mulan PSL v2 at:
5#     http://license.coscl.org.cn/MulanPSL2
6# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
7# IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
8# PURPOSE.
9# See the Mulan PSL v2 for more details.
10ROOT_DIR := ../../../../../
11include $(ROOT_DIR)/out/iot_config.mk
12TOOLCHAIN_DIR := $(ROOT_DIR)/prebuilts/clang/ohos/linux-x86_64/llvm/bin
13export CROSS_COMPILE=$(TOOLCHAIN_DIR)/aarch64-linux-ohos
14ifeq ($(DEVICE_MODEL), "AGS-X20")
15export SYSROOT=$(ROOT_DIR)/out/smartlock_AGS_X20$()/hi3519dv500_smartlock_small/sysroot
16else ifeq ($(DEVICE_MODEL), "AGS-Q20")
17export SYSROOT=$(ROOT_DIR)/out/smartlock_AGS_Q20$()/hi3519dv500_smartlock_small/sysroot
18endif
19
20CC := $(TOOLCHAIN_DIR)/aarch64-unknown-linux-ohos-clang
21AR := $(TOOLCHAIN_DIR)/llvm-ar
22
23CFLAGS  := -Wall -march=armv8-a+simd -O3 -fomit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables -fno-unwind-tables -fstack-protector-strong
24CFLAGS  += -target aarch64-linux-ohos
25CFLAGS  += --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include
26CFLAGS  += -flto
27
28DEBUG ?= 0
29ifeq ($(DEBUG), 1)
30CFLAGS += -O0 -g
31CFLAGS += -DDEBUG
32endif
33
34RM := rm -f
35
36define rm_dirs
37if [ -d "$(1)" ] ; then rmdir --ignore-fail-on-non-empty $(1) ; fi
38endef