1# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. 2# 3# Redistribution and use in source and binary forms, with or without modification, 4# are permitted provided that the following conditions are met: 5# 6# 1. Redistributions of source code must retain the above copyright notice, this list of 7# conditions and the following disclaimer. 8# 9# 2. Redistributions in binary form must reproduce the above copyright notice, this list 10# of conditions and the following disclaimer in the documentation and/or other materials 11# provided with the distribution. 12# 13# 3. Neither the name of the copyright holder nor the names of its contributors may be used 14# to endorse or promote products derived from this software without specific prior written 15# permission. 16# 17# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 19# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 20# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 23# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 24# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 26# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 27# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 29ifeq ($(LOSCFG_DRIVERS_HDF_USB_DDK_DEVICE), y) 30LITEOS_BASELIB += -L$(LITEOSTOPDIR)/../../device/soc/hisilicon/common/platform/libs/ohos/llvm/hi3516dv300 31LITEOS_BASELIB += -lusb_dwc3 32endif 33 34ifeq ($(LOSCFG_DRIVERS_HDF), y) 35 LITEOS_BASELIB += --whole-archive 36 LITEOS_DRIVERS_HDF := $(LITEOSTOPDIR)/../../drivers/hdf_core/adapter/khdf/liteos 37 LITEOS_SOURCE_ROOT := $(LITEOSTOPDIR)/../.. 38 LIB_SUBDIRS += $(LITEOS_DRIVERS_HDF) 39 HDF_FRAMEWORKS_PATH:= $(LITEOSTOPDIR)/../../drivers/hdf_core/framework 40 LITEOS_BASELIB += -lhdf 41 LITEOS_DRIVERS_HDF_INCLUDE += -I $(HDF_FRAMEWORKS_PATH)/core/common/include/manager 42 LITEOS_DRIVERS_HDF_INCLUDE += -I $(HDF_FRAMEWORKS_PATH)/core/common/include/host 43 LITEOS_DRIVERS_HDF_INCLUDE += -I $(HDF_FRAMEWORKS_PATH)/model/storage/include 44 LITEOS_DRIVERS_HDF_INCLUDE += -I $(HDF_FRAMEWORKS_PATH)/model/storage/include/mmc 45 LITEOS_DRIVERS_HDF_INCLUDE += -I $(HDF_FRAMEWORKS_PATH)/model/storage/include/mtd 46 LITEOS_DRIVERS_HDF_INCLUDE += -I $(HDF_FRAMEWORKS_PATH)/include/core 47 LITEOS_DRIVERS_HDF_INCLUDE += -I $(HDF_FRAMEWORKS_PATH)/include/utils 48 LITEOS_DRIVERS_HDF_INCLUDE += -I $(HDF_FRAMEWORKS_PATH)/include/osal 49 LITEOS_DRIVERS_HDF_INCLUDE += -I $(LITEOS_SOURCE_ROOT)/drivers/hdf_core/interfaces/inner_api/core 50 LITEOS_DRIVERS_HDF_INCLUDE += -I $(LITEOS_SOURCE_ROOT)/drivers/hdf_core/interfaces/inner_api/utils 51 LITEOS_DRIVERS_HDF_INCLUDE += -I $(LITEOS_SOURCE_ROOT)/drivers/hdf_core/interfaces/inner_api/osal/shared 52 LITEOS_DRIVERS_HDF_INCLUDE += -I $(LITEOS_SOURCE_ROOT)/drivers/hdf_core/interfaces/inner_api/host/shared 53 LITEOS_DRIVERS_HDF_INCLUDE += -I $(HDF_FRAMEWORKS_PATH)/utils/include 54 LITEOS_DRIVERS_HDF_INCLUDE += -I $(LITEOS_DRIVERS_HDF)/osal/include 55 LITEOS_DRIVERS_HDF_INCLUDE += -I $(LITEOS_DRIVERS_HDF)/model/storage/include 56 LITEOS_DRIVERS_HDF_INCLUDE += -I $(LITEOS_DRIVERS_HDF)/model/storage/include/mmc 57 LITEOS_DRIVERS_HDF_INCLUDE += -I $(LITEOS_DRIVERS_HDF)/model/storage/include/mtd 58 59# platform 60ifeq ($(LOSCFG_DRIVERS_HDF_PLATFORM), y) 61 LITEOS_BASELIB += -lhdf_platform 62 LIB_SUBDIRS += $(LITEOS_DRIVERS_HDF)/platform 63 LITEOS_DRIVERS_HDF_INCLUDE += -I $(HDF_FRAMEWORKS_PATH)/include/platform 64 LITEOS_DRIVERS_HDF_INCLUDE += -I $(HDF_FRAMEWORKS_PATH)/support/platform/include 65 LITEOS_DRIVERS_HDF_INCLUDE += -I $(HDF_FRAMEWORKS_PATH)/support/platform/include/fwk 66 LITEOS_DRIVERS_HDF_INCLUDE += -I $(HDF_FRAMEWORKS_PATH)/support/platform/include/hdmi 67 #LITEOS_DRIVERS_HDF_INCLUDE += -I $(HDF_FRAMEWORKS_PATH)/support/platform/include/mmc 68endif 69 70# models 71ifeq ($(LOSCFG_DRIVERS_HDF_WIFI), y) 72 LITEOS_BASELIB += -lhdf_wifi_model 73 LIB_SUBDIRS += $(LITEOS_DRIVERS_HDF)/model/network/wifi 74endif 75 76ifeq ($(LOSCFG_DRIVERS_HIETH_SF), y) 77 LITEOS_BASELIB += -lhdf_eth_model 78 LIB_SUBDIRS += $(LITEOS_DRIVERS_HDF)/model/network/ethernet 79endif 80 81ifeq ($(LOSCFG_DRIVERS_HDF_USB), y) 82 LITEOS_DRIVERS_HDF_INCLUDE += -I $(LITEOS_DRIVERS_HDF)/model/bus/usb/include 83 LITEOS_BASELIB += -lhdf_usb 84 LIB_SUBDIRS += $(LITEOS_DRIVERS_HDF)/model/bus/usb 85endif 86 87ifeq ($(LOSCFG_DRIVERS_HDF_DISP), y) 88 LITEOS_BASELIB += -lhdf_display 89 LIB_SUBDIRS += $(LITEOS_DRIVERS_HDF)/model/display 90endif 91 92ifeq ($(LOSCFG_DRIVERS_HDF_INPUT), y) 93 LITEOS_BASELIB += -lhdf_input_driver 94 LIB_SUBDIRS += $(LITEOS_DRIVERS_HDF)/model/input 95endif 96 97ifeq ($(LOSCFG_DRIVERS_HDF_AUDIO), y) 98 LITEOS_BASELIB += -lhdf_audio_driver 99 LIB_SUBDIRS += $(LITEOS_DRIVERS_HDF)/model/audio 100endif 101 102ifeq ($(LOSCFG_DRIVERS_HDF_SENSOR), y) 103 LITEOS_BASELIB += -lhdf_sensor_driver 104 LIB_SUBDIRS += $(LITEOS_DRIVERS_HDF)/model/sensor 105endif 106 107ifeq ($(LOSCFG_DRIVERS_HDF_STORAGE), y) 108 LITEOS_BASELIB += -lhdf_storage_driver 109 LIB_SUBDIRS += $(LITEOS_DRIVERS_HDF)/model/storage 110endif 111 112ifeq ($(LOSCFG_DRIVERS_HDF_LIGHT), y) 113 LITEOS_BASELIB += -lhdf_light_driver 114 LIB_SUBDIRS += $(LITEOS_DRIVERS_HDF)/model/misc/light 115endif 116 117ifeq ($(LOSCFG_DRIVERS_HDF_VIBRATOR), y) 118 LITEOS_BASELIB += -lhdf_vibrator_driver 119 LIB_SUBDIRS += $(LITEOS_DRIVERS_HDF)/model/misc/vibrator 120endif 121 122ifeq ($(LOSCFG_DRIVERS_HDF_USB_DDK_HOST), y) 123 LITEOS_DRIVERS_HDF_INCLUDE += -I $(HDF_FRAMEWORKS_PATH)/model/usb/include 124 LITEOS_DRIVERS_HDF_INCLUDE += -I $(LITEOS_DRIVERS_HDF)/model/usb/host/include 125 LITEOS_BASELIB += -lhdf_usb_ddk_host 126 LIB_SUBDIRS += $(LITEOS_DRIVERS_HDF)/model/usb/host 127endif 128 129ifeq ($(LOSCFG_DRIVERS_HDF_USB_DDK_DEVICE), y) 130 LITEOS_BASELIB += -lhdf_usb_ddk_device 131 LIB_SUBDIRS += $(LITEOS_DRIVERS_HDF)/model/usb/device 132endif 133 134ifeq ($(LOSCFG_DRIVERS_HDF_USB_DDK_DEVICE), y) 135ifeq ($(LOSCFG_DRIVERS_HDF_USBFN_MASTER), y) 136 LITEOS_BASELIB += -lhdf_usbfn_master 137 LIB_SUBDIRS += $(LITEOS_SOURCE_ROOT)/drivers/peripheral/usb/gadget/function/master 138endif 139 140ifeq ($(LOSCFG_DRIVERS_HDF_USBFN_CDCACM), y) 141 LITEOS_BASELIB += -lhdf_usbfn_cdcacm 142 LIB_SUBDIRS += $(LITEOS_SOURCE_ROOT)/drivers/peripheral/usb/gadget/function/acm 143endif 144 145ifeq ($(LOSCFG_DRIVERS_HDF_USBFN_CDCECM), y) 146 LITEOS_BASELIB += -lhdf_usbfn_cdcecm 147 LIB_SUBDIRS += $(LITEOS_SOURCE_ROOT)/drivers/peripheral/usb/gadget/function/ecm 148endif 149endif 150 151SOURCE_ROOT := $(abspath $(LITEOSTOPDIR)/../../) 152PRODUCT_CONFIG := $(PRODUCT_PATH)/hdf_config 153DEVICE_CONFIG := $(DEVICE_PATH)/hdf_config 154HAVE_PRODUCT_CONFIG := $(shell if [ -e $(PRODUCT_CONFIG)/Makefile ]; then echo y; else echo n; fi) 155 156ifeq ($(LOSCFG_DRIVERS_HDF_TEST), y) 157 # for test 158 include $(LITEOS_DRIVERS_HDF)/test/test_lite.mk 159 LITEOS_BASELIB += -lhdf_test 160 LIB_SUBDIRS += $(LITEOS_DRIVERS_HDF)/test 161 162 LITEOS_BASELIB += -lhdf_test_config 163 LIB_SUBDIRS += $(PRODUCT_CONFIG)/hdf_test 164 LITEOS_BASELIB += -lhdf_test_macro 165 LIB_SUBDIRS += $(PRODUCT_CONFIG)/hdf_test/hcs_macro_test 166else 167 LITEOS_BASELIB += -lhdf_config 168 ifeq ($(HAVE_PRODUCT_CONFIG), y) 169 LIB_SUBDIRS += $(PRODUCT_CONFIG) 170 else 171 LIB_SUBDIRS += $(DEVICE_CONFIG) 172 endif 173endif 174 175# vendor lib 176COMPANY_OF_SOC := $(patsubst "%",%,$(LOSCFG_DEVICE_COMPANY)) 177ifeq ($(COMPANY_OF_SOC), hisilicon) 178-include $(LITEOSTOPDIR)/../../device/soc/$(COMPANY_OF_SOC)/common/platform/lite.mk 179else ifeq ($(COMPANY_OF_SOC), st) 180-include $(LITEOSTOPDIR)/../../device/soc/$(COMPANY_OF_SOC)/common/platform/lite.mk 181else 182-include $(LITEOSTOPDIR)/../../device/$(COMPANY_OF_SOC)/drivers/lite.mk 183endif 184 185LITEOS_BASELIB += --no-whole-archive 186 187HC_GEN_DIR = $(abspath $(LITEOSTOPDIR)/../../drivers/hdf_core/framework/tools/hc-gen) 188HC_GEN = $(OUT)/hc_gen_build/hc-gen 189$(HC_GEN): 190 $(HIDE)make -j -C $(HC_GEN_DIR) BUILD_DIR=$(dir $@) 191$(LITEOS_LIBS_TARGET):$(HC_GEN) 192endif 193 194