| # Copyright 2019 The Fuchsia 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("//build/zircon/migrated_targets.gni") |
| |
| zx_library("tftp") { |
| sdk = "static" |
| sdk_headers = [ "tftp/tftp.h" ] |
| |
| sources = [ "tftp.c" ] |
| if (is_efi_toolchain) { |
| defines = [ "TFTP_EFILIB" ] |
| |
| # If we are compiling with the physboot efi toolchain, we need to specify |
| # the c std library explicitly. In addition, there are a few other missing |
| # headers i.e. strings.h, arpa/inet.h. Since in the case of efi toolchain, |
| # the library is only used by gigaboot, we'll use the headers provided from |
| # the gigaboot. |
| if (current_toolchain == |
| "//zircon/kernel/phys/efi:kernel.efi_$target_cpu") { |
| public_deps = [ "//zircon/kernel/lib/libc" ] # c std headers |
| configs += [ "//src/firmware/gigaboot/cpp/legacy_c_gigaboot:includes" ] |
| } |
| } else if (is_host) { |
| defines = [ "TFTP_HOSTLIB" ] |
| } |
| if (!is_kernel && is_fuchsia) { |
| defines = [ "TFTP_USERLIB" ] |
| deps = [ "//src/zircon/lib/zircon" ] |
| } |
| |
| # TODO(https://fxbug.dev/42136089): delete the below and fix compiler warnings |
| configs += [ "//build/config:Wno-conversion" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ "test:tests" ] |
| } |
| |
| if (!is_kernel) { |
| zx_host_tool("tftp-example") { |
| sources = [ "tftp-example.c" ] |
| deps = [ ":tftp" ] |
| } |
| } |