10b966c5eSopenharmony_ci# 20b966c5eSopenharmony_ci# Copyright (c) 2020-2023 Huawei Device Co., Ltd. 30b966c5eSopenharmony_ci# 40b966c5eSopenharmony_ci# This software is licensed under the terms of the GNU General Public 50b966c5eSopenharmony_ci# License version 2, as published by the Free Software Foundation, and 60b966c5eSopenharmony_ci# may be copied, distributed, and modified under those terms. 70b966c5eSopenharmony_ci# 80b966c5eSopenharmony_ci# This program is distributed in the hope that it will be useful, 90b966c5eSopenharmony_ci# but WITHOUT ANY WARRANTY; without even the implied warranty of 100b966c5eSopenharmony_ci# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 110b966c5eSopenharmony_ci# GNU General Public License for more details. 120b966c5eSopenharmony_ci# 130b966c5eSopenharmony_ci# 140b966c5eSopenharmony_ci 150b966c5eSopenharmony_ciccflags-$(CONFIG_DRIVERS_HDF_TEST) += -I$(srctree)/include/hdf \ 160b966c5eSopenharmony_ci -I$(srctree)/include/hdf/osal \ 170b966c5eSopenharmony_ci -I$(srctree)/include/hdf/utils \ 180b966c5eSopenharmony_ci -I$(srctree)/drivers/hdf/inner_api/osal/shared \ 190b966c5eSopenharmony_ci -I$(srctree)/drivers/hdf/inner_api/host/shared \ 200b966c5eSopenharmony_ci -I$(srctree)/drivers/hdf/inner_api/utils \ 210b966c5eSopenharmony_ci -I$(srctree)/drivers/hdf/inner_api/core \ 220b966c5eSopenharmony_ci -I$(srctree)/drivers/hdf/khdf/osal/include \ 230b966c5eSopenharmony_ci -I$(srctree)/drivers/hdf/framework/utils/include 240b966c5eSopenharmony_ci 250b966c5eSopenharmony_ciifeq ($(LOCAL_HCS_ROOT),) 260b966c5eSopenharmony_ci LOCAL_HCS_ROOT := $(PRODUCT_PATH) 270b966c5eSopenharmony_ciendif 280b966c5eSopenharmony_ci 290b966c5eSopenharmony_ciCURRENT_DIR := $(abspath $(dir $(realpath $(lastword $(MAKEFILE_LIST))))) 300b966c5eSopenharmony_ciSOURCE_ROOT := $(abspath $(CURRENT_DIR)/../../../../../../) 310b966c5eSopenharmony_ci 320b966c5eSopenharmony_ciHC_GEN_DIR := $(abspath $(SOURCE_ROOT)/drivers/hdf_core/framework/tools/hc-gen) 330b966c5eSopenharmony_ciifneq ($(OUT_DIR),) 340b966c5eSopenharmony_ciHC_GEN := $(OUT_DIR)/kernel/OBJ/${KERNEL_VERSION}/drivers/hdf/khdf/hc_gen_build/hc-gen 350b966c5eSopenharmony_cielse 360b966c5eSopenharmony_ciHC_GEN := $(HC_GEN_DIR)/build/hc-gen 370b966c5eSopenharmony_ciendif 380b966c5eSopenharmony_ciLOCAL_HCS_ROOT := $(CURRENT_DIR) 390b966c5eSopenharmony_ci 400b966c5eSopenharmony_ciHCS_DIR := $(LOCAL_HCS_ROOT) 410b966c5eSopenharmony_ci 420b966c5eSopenharmony_ciifneq ($(TARGET_BOARD_PLATFORM),) 430b966c5eSopenharmony_ci HCS_DIR := $(LOCAL_HCS_ROOT)/$(TARGET_BOARD_PLATFORM) 440b966c5eSopenharmony_cielse 450b966c5eSopenharmony_ci ifneq ($(CONFIG_ARCH_HI3516DV300),) 460b966c5eSopenharmony_ci HCS_DIR := $(LOCAL_HCS_ROOT) 470b966c5eSopenharmony_ci endif 480b966c5eSopenharmony_ci ifneq ($(CONFIG_ARCH_HI3518EV300),) 490b966c5eSopenharmony_ci HCS_DIR := $(LOCAL_HCS_ROOT) 500b966c5eSopenharmony_ci endif 510b966c5eSopenharmony_ciendif 520b966c5eSopenharmony_ci$(info HCS_DIR = $(HCS_DIR)) 530b966c5eSopenharmony_ciHCB_FLAGS := -b -i -a 540b966c5eSopenharmony_ci 550b966c5eSopenharmony_ciHCS_OBJ := hdf_hcs_hex.o 560b966c5eSopenharmony_ciHCS_OBJ_SRC := $(subst .o,.c,$(notdir $(HCS_OBJ))) 570b966c5eSopenharmony_ci 580b966c5eSopenharmony_ciCONFIG_GEN_HEX_SRC := $(addprefix $(LOCAL_HCS_ROOT)/, $(HCS_OBJ_SRC)) 590b966c5eSopenharmony_ciCONFIG_HCS_SRC := $(subst _hcs_hex.o,.hcs,$(addprefix $(HCS_DIR)/, $(HCS_OBJ))) 600b966c5eSopenharmony_ci 610b966c5eSopenharmony_ciHDF_FRAMWORK_TEST_ROOT = $(abspath $(SOURCE_ROOT)/drivers/hdf_core/framework/test/unittest/utils/hcs_parser/unittest) 620b966c5eSopenharmony_ciHCS_MACRO_OBJ := hcs_macro_cases.o 630b966c5eSopenharmony_ciHCS_MACRO_SRC := $(HDF_FRAMWORK_TEST_ROOT)/hcs_macro_cases.c 640b966c5eSopenharmony_ciHCS_DEP := $(HDF_FRAMWORK_TEST_ROOT)/hdf_macro_test.h 650b966c5eSopenharmony_ciHCS_MACRO_GEN_FILE := $(HDF_FRAMWORK_TEST_ROOT)/hdf_macro_test 660b966c5eSopenharmony_ciHCS_FILE := $(HCS_DIR)/hdf.hcs 670b966c5eSopenharmony_ci 680b966c5eSopenharmony_ci$(obj)/$(HCS_OBJ): $(CONFIG_GEN_HEX_SRC) 690b966c5eSopenharmony_ci $(Q)$(CC) $(c_flags) -c -o $@ $< 700b966c5eSopenharmony_ci $(Q)rm -f $< 710b966c5eSopenharmony_ci 720b966c5eSopenharmony_ci$(CONFIG_GEN_HEX_SRC): $(LOCAL_HCS_ROOT)/%_hcs_hex.c: $(HCS_DIR)/%.hcs | $(HC_GEN) 730b966c5eSopenharmony_ci $(Q)echo gen hdf built-in config 740b966c5eSopenharmony_ci $(Q)if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi 750b966c5eSopenharmony_ci $(Q)$(HC_GEN) $(HCB_FLAGS) -o $(subst _hex.c,,$(@)) $< 760b966c5eSopenharmony_ci 770b966c5eSopenharmony_ci$(CONFIG_GEN_SRCS): $(CONFIG_OUT_DIR)%.c: $(HCS_DIR)/%.hcs | $(HC_GEN) 780b966c5eSopenharmony_ci $(Q)echo gen hdf driver config 790b966c5eSopenharmony_ci $(Q)if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi 800b966c5eSopenharmony_ci $(Q)$(HC_GEN) -t -o $@ $< 810b966c5eSopenharmony_ci 820b966c5eSopenharmony_ci$(HC_GEN): 830b966c5eSopenharmony_ci $(HIDE)make -C $(HC_GEN_DIR) BUILD_DIR=$(dir $@) 840b966c5eSopenharmony_ci 850b966c5eSopenharmony_ci$(obj)/$(HCS_MACRO_OBJ): $(HCS_MACRO_SRC) $(HCS_DEP) 860b966c5eSopenharmony_ci $(Q)$(CC) $(c_flags) -c -o $@ $< 870b966c5eSopenharmony_ci 880b966c5eSopenharmony_ci$(HCS_DEP): $(HC_GEN) 890b966c5eSopenharmony_ci $(Q)echo gen hdf built-in config macro 900b966c5eSopenharmony_ci $(Q)$(HC_GEN) -m -o $(HCS_MACRO_GEN_FILE) $(HCS_FILE) 910b966c5eSopenharmony_ci 920b966c5eSopenharmony_ciobj-$(CONFIG_DRIVERS_HDF) += $(HCS_OBJ) \ 930b966c5eSopenharmony_ci $(HCS_MACRO_OBJ) 94