# Copyright (c) 2022 Huawei Device Co., Ltd.
#
# This software is licensed under the terms of the GNU General Public
# License version 2, as published by the Free Software Foundation, and
# may be copied, distributed, and modified under those terms.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

import("//build/config/clang/clang.gni")
import("//build/ohos.gni")
import("//build/ohos/kernel/kernel.gni")

action("module_make") {
  script = "./build/build_hdf_module.sh"
  outputs = [ "${target_out_dir}/hdf_test_helper.ko" ]
  args = [
    rebase_path("//"),  #ohos root path
    rebase_path("./src/"),  #source path
    rebase_path("${target_out_dir}"),  #out path
    rebase_path("$clang_base_path"),  #toolchain path
    linux_kernel_version,
  ]
  deps = [ "//kernel/linux/build:linux_kernel" ]
}

ohos_prebuilt_shared_library("hdf_test_helper") {
  deps = [ ":module_make" ]
  sources = get_target_outputs(":module_make")
  source = sources[0]
  module_install_dir = "modules"
  install_images = [ chipset_base_dir ]
  subsystem_name = "hdf"
  part_name = "hdf_core"
}

group("test_helper_module") {
  deps = [ ":hdf_test_helper" ]
}