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(is_fuchsia) |
| 8 assert(is_posix) |
| 9 |
| 10 config("werror") { |
| 11 cflags = [ |
| 12 "-Werror", |
| 13 |
| 14 # Declarations marked as deprecated should cause build failures, rather |
| 15 # they should emit warnings to notify developers about the use of |
| 16 # deprecated interfaces. |
| 17 "-Wno-error=deprecated-declarations", |
| 18 |
| 19 # Do not add additional -Wno-error to this config. |
| 20 ] |
| 21 } |
| 22 |
| 23 config("icf") { |
| 24 # This changes C/C++ semantics and might be incompatible with third-party |
| 25 # code that relies on function pointers comparison. |
| 26 ldflags = [ "-Wl,--icf=all" ] |
| 27 } |
| 28 |
| 29 config("compiler") { |
| 30 cflags = [] |
| 31 cflags_c = [ "-std=c11" ] |
| 32 cflags_cc = [ "-std=c++14" ] |
| 33 ldflags = [ "-Wl,--threads" ] |
| 34 configs = [ |
| 35 ":compiler_sysroot", |
| 36 ":compiler_target", |
| 37 ":icf", |
| 38 ":werror", |
| 39 ] |
| 40 asmflags = cflags + cflags_c |
| 41 |
| 42 libs = [ |
| 43 "mxio", |
| 44 "magenta", |
| 45 "unwind", |
| 46 ] |
| 47 } |
| 48 |
| 49 config("compiler_sysroot") { |
| 50 # The sole purpose of SYSROOT_VERSION is to change the command line on every |
| 51 # sysroot update so as to force rebuilds. |
| 52 defines = [ "SYSROOT_VERSION=$sysroot_version" ] |
| 53 cflags = [ "--sysroot=" + rebase_path(sysroot, root_build_dir) ] |
| 54 ldflags = [ "--sysroot=" + rebase_path(sysroot, root_build_dir) ] |
| 55 asmflags = cflags |
| 56 } |
| 57 |
| 58 config("compiler_target") { |
| 59 cflags = [] |
| 60 ldflags = [] |
| 61 if (current_cpu == "arm64") { |
| 62 cflags += [ "--target=aarch64-fuchsia" ] |
| 63 ldflags += [ "--target=aarch64-fuchsia" ] |
| 64 } else if (current_cpu == "x64") { |
| 65 cflags += [ "--target=x86_64-fuchsia" ] |
| 66 ldflags += [ "--target=x86_64-fuchsia" ] |
| 67 } else { |
| 68 assert(false, "Unsupported architecture") |
| 69 } |
| 70 asmflags = cflags |
| 71 } |
OLD | NEW |