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.
13
14if (defined(ohos_lite)) {
15  executable("watchdog_service") {
16    sources = [
17      "//base/startup/init/services/log/init_commlog.c",
18      "//base/startup/init/watchdog/init_watchdog.c",
19    ]
20    deps = [
21      "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
22      "//base/startup/init/services/log:init_log",
23    ]
24    external_deps = [ "bounds_checking_function:libsec_static" ]
25    defines = [
26      "_GNU_SOURCE",
27      "OHOS_LITE_WATCHDOG",
28    ]
29    if (ohos_kernel_type == "linux") {
30      defines += [ "LINUX_WATCHDOG" ]
31    }
32  }
33} else {
34  import("//build/ohos.gni")
35  ohos_executable("watchdog_service") {
36    sources = [
37      "//base/startup/init/services/log/init_commlog.c",
38      "init_watchdog.c",
39    ]
40    deps = [ "//base/startup/init/services/log:init_log" ]
41
42    external_deps = [ "bounds_checking_function:libsec_shared" ]
43
44    defines = [ "LINUX_WATCHDOG" ]
45    defines += [ "_GNU_SOURCE" ]
46    install_enable = true
47    part_name = "init"
48    subsystem_name = "startup"
49  }
50}
51
52group("watchdog") {
53  if (defined(ohos_lite)) {
54    if (ohos_kernel_type == "linux" || ohos_kernel_type == "liteos_a") {
55      deps = [ ":watchdog_service" ]
56    } else {
57      deps = []
58    }
59  } else {
60    deps = [ ":watchdog_service" ]
61  }
62}
63