blob: 337b20319d00d210a877dbfc77ededaf8737c630 [file] [log] [blame]
# Copyright 2018 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//common-mk/pkg_config.gni")
group("all") {
deps = [
":hammerd",
":libhammerd",
]
if (use.hammerd_api) {
deps += [ ":libhammerd-api" ]
}
if (use.test) {
deps += [ ":unittest_runner" ]
}
if (use.fuzzer) {
deps += [
":hammerd_load_ec_image_fuzzer",
":hammerd_update_fw_fuzzer",
]
}
}
pkg_config("target_defaults") {
# NOSORT
pkg_deps = [
"fmap",
"libbrillo",
"libchrome",
"libmetrics",
"libpcrecpp",
"openssl",
# system_api depends on protobuf (or protobuf-lite). It must appear
# before protobuf here or the linker flags won't be in the right
# order.
"system_api",
"protobuf-lite",
]
}
static_library("libhammerd") {
configs += [ ":target_defaults" ]
configs -= [ "//common-mk:pie" ]
sources = [
# TODO(crbug.com/649672): Upgrade to OpenSSL 1.1 support curve25519.
"curve25519.c",
"dbus_wrapper.cc",
"fmap_utils.cc",
"hammer_updater.cc",
"pair_utils.cc",
"process_lock.cc",
"update_fw.cc",
"usb_utils.cc",
]
cflags = [ "-fPIC" ]
}
executable("hammerd") {
configs += [ ":target_defaults" ]
sources = [ "main.cc" ]
deps = [ ":libhammerd" ]
}
if (use.hammerd_api) {
shared_library("libhammerd-api") {
configs += [ ":target_defaults" ]
sources = [ "hammerd_api.cc" ]
deps = [ ":libhammerd" ]
}
}
if (use.test) {
executable("unittest_runner") {
configs += [
# //common-mk:test should be at the top. crbug.com/887845
# TODO(crbug.com/887845): Remove this note after library order issue is resolved.
"//common-mk:test",
":target_defaults",
]
sources = [
"curve25519_test.cc",
"hammer_updater_test.cc",
"pair_utils_test.cc",
"update_fw_test.cc",
]
deps = [
":libhammerd",
"//common-mk/testrunner",
]
}
}
if (use.fuzzer) {
executable("hammerd_load_ec_image_fuzzer") {
configs += [
"//common-mk/common_fuzzer",
":target_defaults",
]
sources = [ "update_fw_load_ec_image_fuzzer.cc" ]
deps = [ ":libhammerd" ]
}
executable("hammerd_update_fw_fuzzer") {
configs += [
"//common-mk/common_fuzzer",
":target_defaults",
]
sources = [ "update_fw_fuzzer.cc" ]
deps = [ ":libhammerd" ]
}
}