• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2020 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14
15ifeq ($(LOCAL_HCS_ROOT),)
16  LOCAL_HCS_ROOT := $(PRODUCT_PATH)
17endif
18
19SOURCE_ROOT:=$(abspath ../../../../../)
20
21HC_GEN_DIR := $(abspath $(SOURCE_ROOT)/drivers/framework/tools/hc-gen)
22HC_GEN := $(HC_GEN_DIR)/build/hc-gen
23LOCAL_HCS_ROOT := $(abspath $(dir $(realpath $(lastword $(MAKEFILE_LIST)))))
24
25HCS_DIR := $(LOCAL_HCS_ROOT)
26
27$(info HCS_DIR = $(HCS_DIR))
28HCB_FLAGS := -b -i -a
29
30HCS_OBJ := hdf_hcs_hex.o
31HCS_OBJ_SRC := $(subst .o,.c,$(notdir $(HCS_OBJ)))
32
33CONFIG_GEN_HEX_SRC := $(addprefix $(LOCAL_HCS_ROOT)/, $(HCS_OBJ_SRC))
34CONFIG_HCS_SRC := $(subst _hcs_hex.o,.hcs,$(addprefix $(HCS_DIR)/, $(HCS_OBJ)))
35
36$(obj)/$(HCS_OBJ): $(CONFIG_GEN_HEX_SRC)
37	$(Q)$(CC) $(c_flags) -c -o $@ $<
38	$(Q)rm -f $<
39
40$(CONFIG_GEN_HEX_SRC):  $(LOCAL_HCS_ROOT)/%_hcs_hex.c: $(HCS_DIR)/%.hcs | $(HC_GEN)
41	$(Q)echo gen hdf built-in config
42	$(Q)if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi
43	$(Q)$(HC_GEN) $(HCB_FLAGS) -o $(subst _hex.c,,$(@)) $<
44
45$(CONFIG_GEN_SRCS): $(CONFIG_OUT_DIR)%.c: $(HCS_DIR)/%.hcs | $(HC_GEN)
46	$(Q)echo gen hdf driver config
47	$(Q)if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi
48	$(Q)$(HC_GEN) -t -o $@ $<
49
50$(HC_GEN):
51	$(HIDE)make -C $(HC_GEN_DIR)
52
53obj-$(CONFIG_DRIVERS_HDF) += $(HCS_OBJ)
54
55