1# Copyright (c) 2021-2022 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.
13base_sources = [ "init_log.c" ]
14
15config("exported_header_files") {
16  visibility = [ ":*" ]
17  include_dirs = [
18    "//base/startup/init/interfaces/innerkits/include",
19    "//base/startup/init/services/log",
20    "//base/startup/init/interfaces/innerkits/include",
21  ]
22}
23
24if (defined(ohos_lite)) {
25  static_library("init_log") {
26    sources = base_sources
27    defines = [
28      "_GNU_SOURCE",
29      "OHOS_LITE",
30    ]
31    public_configs = [ ":exported_header_files" ]
32
33    if (ohos_kernel_type == "linux") {
34      defines += [ "INIT_DMESG" ]
35    }
36    if (ohos_kernel_type == "liteos_m") {
37      defines += [ "__LITEOS_M__" ]
38    }
39    include_dirs = [ "//base/hiviewdfx/hilog_lite/interfaces/native/kits" ]
40    external_deps = [ "bounds_checking_function:libsec_shared" ]
41  }
42} else {
43  import("//build/ohos.gni")
44  ohos_static_library("init_log") {
45    sources = base_sources
46    defines = [ "INIT_DMESG" ]
47    public_configs = [ ":exported_header_files" ]
48
49    external_deps = [ "bounds_checking_function:libsec_static" ]
50    part_name = "init"
51    subsystem_name = "startup"
52  }
53
54  ohos_static_library("agent_log") {
55    sources = base_sources
56    defines = [ "INIT_AGENT" ]
57    public_configs = [ ":exported_header_files" ]
58    external_deps = [ "bounds_checking_function:libsec_static" ]
59    external_deps += [ "hilog:libhilog_base" ]
60    part_name = "init"
61    subsystem_name = "startup"
62  }
63}
64