| OLD | NEW |
| (Empty) | |
| 1 # Copyright 2017 The Fuchsia Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 import("//build/config/sysroot.gni") |
| 6 |
| 7 assert(current_os == "fuchsia") |
| 8 |
| 9 config("werror") { |
| 10 cflags = [ |
| 11 "-Werror", |
| 12 |
| 13 # Declarations marked as deprecated should cause build failures, rather |
| 14 # they should emit warnings to notify developers about the use of |
| 15 # deprecated interfaces. |
| 16 "-Wno-error=deprecated-declarations", |
| 17 |
| 18 # Do not add additional -Wno-error to this config. |
| 19 ] |
| 20 } |
| 21 |
| 22 config("icf") { |
| 23 # This changes C/C++ semantics and might be incompatible with third-party |
| 24 # code that relies on function pointers comparison. |
| 25 ldflags = [ "-Wl,--icf=all" ] |
| 26 } |
| 27 |
| 28 config("compiler") { |
| 29 cflags = [] |
| 30 cflags_c = [ "-std=c11" ] |
| 31 cflags_cc = [ "-std=c++14" ] |
| 32 ldflags = [ "-Wl,--threads" ] |
| 33 configs = [ |
| 34 ":compiler_sysroot", |
| 35 ":compiler_target", |
| 36 ":icf", |
| 37 ":werror", |
| 38 ] |
| 39 asmflags = cflags + cflags_c |
| 40 } |
| 41 |
| 42 config("compiler_sysroot") { |
| 43 # The sole purpose of SYSROOT_VERSION is to change the command line on every |
| 44 # sysroot update so as to force rebuilds. |
| 45 defines = [ "SYSROOT_VERSION=$sysroot_version" ] |
| 46 cflags = [ "--sysroot=" + rebase_path(sysroot, root_build_dir) ] |
| 47 ldflags = [ "--sysroot=" + rebase_path(sysroot, root_build_dir) ] |
| 48 asmflags = cflags |
| 49 } |
| 50 |
| 51 config("compiler_target") { |
| 52 cflags = [] |
| 53 ldflags = [] |
| 54 if (current_cpu == "arm64") { |
| 55 cflags += [ "--target=aarch64-fuchsia" ] |
| 56 ldflags += [ "--target=aarch64-fuchsia" ] |
| 57 } else if (current_cpu == "x64") { |
| 58 cflags += [ "--target=x86_64-fuchsia" ] |
| 59 ldflags += [ "--target=x86_64-fuchsia" ] |
| 60 } else { |
| 61 assert(false, "Unsupported architecture") |
| 62 } |
| 63 asmflags = cflags |
| 64 } |
| 65 |
| 66 config("shared_library_config") { |
| 67 cflags = [ "-fPIC" ] |
| 68 } |
| 69 |
| 70 config("mxio_config") { |
| 71 libs = [ "mxio" ] |
| 72 } |
| 73 |
| 74 config("executable_config") { |
| 75 } |
| OLD | NEW |