10a7ce71fSopenharmony_ci# 20a7ce71fSopenharmony_ci# Copyright (c) 2020-2022 Huawei Device Co., Ltd. 30a7ce71fSopenharmony_ci# 40a7ce71fSopenharmony_ci# This software is licensed under the terms of the GNU General Public 50a7ce71fSopenharmony_ci# License version 2, as published by the Free Software Foundation, and 60a7ce71fSopenharmony_ci# may be copied, distributed, and modified under those terms. 70a7ce71fSopenharmony_ci# 80a7ce71fSopenharmony_ci# This program is distributed in the hope that it will be useful, 90a7ce71fSopenharmony_ci# but WITHOUT ANY WARRANTY; without even the implied warranty of 100a7ce71fSopenharmony_ci# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 110a7ce71fSopenharmony_ci# GNU General Public License for more details. 120a7ce71fSopenharmony_ci# 130a7ce71fSopenharmony_ci# 140a7ce71fSopenharmony_ci 150a7ce71fSopenharmony_ciifeq ($(LOCAL_HCS_ROOT),) 160a7ce71fSopenharmony_ci LOCAL_HCS_ROOT := $(PRODUCT_PATH) 170a7ce71fSopenharmony_ciendif 180a7ce71fSopenharmony_ciCURRENT_DIR := $(abspath $(dir $(realpath $(lastword $(MAKEFILE_LIST))))) 190a7ce71fSopenharmony_ciSOURCE_ROOT := $(abspath $(CURRENT_DIR)/../../../../../) 200a7ce71fSopenharmony_ci 210a7ce71fSopenharmony_ciHC_GEN_DIR := $(abspath $(SOURCE_ROOT)/drivers/hdf_core/framework/tools/hc-gen) 220a7ce71fSopenharmony_ciifneq ($(OUT_DIR),) 230a7ce71fSopenharmony_ciHC_GEN := $(OUT_DIR)/kernel/OBJ/${KERNEL_VERSION}/drivers/hdf/khdf/hc_gen_build/hc-gen 240a7ce71fSopenharmony_cielse 250a7ce71fSopenharmony_ciHC_GEN := $(HC_GEN_DIR)/build/hc-gen 260a7ce71fSopenharmony_ciendif 270a7ce71fSopenharmony_ciLOCAL_HCS_ROOT := $(CURRENT_DIR) 280a7ce71fSopenharmony_ci 290a7ce71fSopenharmony_ciHCS_DIR := $(LOCAL_HCS_ROOT) 300a7ce71fSopenharmony_ci 310a7ce71fSopenharmony_ciifneq ($(TARGET_BOARD_PLATFORM),) 320a7ce71fSopenharmony_ci HCS_DIR := $(LOCAL_HCS_ROOT)/$(TARGET_BOARD_PLATFORM) 330a7ce71fSopenharmony_cielse 340a7ce71fSopenharmony_ci ifneq ($(CONFIG_ARCH_HI3516DV300),) 350a7ce71fSopenharmony_ci HCS_DIR := $(LOCAL_HCS_ROOT) 360a7ce71fSopenharmony_ci endif 370a7ce71fSopenharmony_ci ifneq ($(CONFIG_ARCH_HI3518EV300),) 380a7ce71fSopenharmony_ci HCS_DIR := $(LOCAL_HCS_ROOT) 390a7ce71fSopenharmony_ci endif 400a7ce71fSopenharmony_ci ifneq ($(CONFIG_ARCH_HI3751V350),) 410a7ce71fSopenharmony_ci HCS_DIR := $(LOCAL_HCS_ROOT) 420a7ce71fSopenharmony_ci endif 430a7ce71fSopenharmony_ciendif 440a7ce71fSopenharmony_ci$(info HCS_DIR = $(HCS_DIR)) 450a7ce71fSopenharmony_ciHCB_FLAGS := -b -i -a 460a7ce71fSopenharmony_ci 470a7ce71fSopenharmony_ciHCS_OBJ := hdf_hcs_hex.o 480a7ce71fSopenharmony_ciHCS_OBJ_SRC := $(subst .o,.c,$(notdir $(HCS_OBJ))) 490a7ce71fSopenharmony_ci 500a7ce71fSopenharmony_ciCONFIG_GEN_HEX_SRC := $(addprefix $(LOCAL_HCS_ROOT)/, $(HCS_OBJ_SRC)) 510a7ce71fSopenharmony_ciCONFIG_HCS_SRC := $(subst _hcs_hex.o,.hcs,$(addprefix $(HCS_DIR)/, $(HCS_OBJ))) 520a7ce71fSopenharmony_ci 530a7ce71fSopenharmony_ci$(obj)/$(HCS_OBJ): $(CONFIG_GEN_HEX_SRC) 540a7ce71fSopenharmony_ci $(Q)$(CC) $(c_flags) -c -o $@ $< 550a7ce71fSopenharmony_ci $(Q)rm -f $< 560a7ce71fSopenharmony_ci 570a7ce71fSopenharmony_ci$(CONFIG_GEN_HEX_SRC): $(LOCAL_HCS_ROOT)/%_hcs_hex.c: $(HCS_DIR)/%.hcs | $(HC_GEN) 580a7ce71fSopenharmony_ci $(Q)echo gen hdf built-in config 590a7ce71fSopenharmony_ci $(Q)if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi 600a7ce71fSopenharmony_ci $(Q)$(HC_GEN) $(HCB_FLAGS) -o $(subst _hex.c,,$(@)) $< 610a7ce71fSopenharmony_ci 620a7ce71fSopenharmony_ci$(CONFIG_GEN_SRCS): $(CONFIG_OUT_DIR)%.c: $(HCS_DIR)/%.hcs | $(HC_GEN) 630a7ce71fSopenharmony_ci $(Q)echo gen hdf driver config 640a7ce71fSopenharmony_ci $(Q)if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi 650a7ce71fSopenharmony_ci $(Q)$(HC_GEN) -t -o $@ $< 660a7ce71fSopenharmony_ci 670a7ce71fSopenharmony_ci$(HC_GEN): 680a7ce71fSopenharmony_ci $(HIDE)make -C $(HC_GEN_DIR) BUILD_DIR=$(dir $@) 690a7ce71fSopenharmony_ci 700a7ce71fSopenharmony_ciobj-$(CONFIG_DRIVERS_HDF) += $(HCS_OBJ) 71