xref: /netbsd-src/external/apache2/llvm/dist/llvm/utils/gn/secondary/compiler-rt/lib/profile/BUILD.gn (revision 82d56013d7b633d116a93943de88e08335357a7c)
1import("//compiler-rt/target.gni")
2
3static_library("profile") {
4  output_dir = crt_current_out_dir
5  if (current_os == "mac") {
6    output_name = "clang_rt.profile_osx"
7  } else {
8    output_name = "clang_rt.profile$crt_current_target_suffix"
9  }
10
11  complete_static_lib = true
12  configs -= [ "//llvm/utils/gn/build:thin_archive" ]
13
14  cflags = []
15  if (current_os != "win") {
16    cflags = [
17      "-fPIC",
18      "-Wno-pedantic",
19    ]
20  } else {
21    # This appears to be a C-only warning banning the use of locals in
22    # aggregate initializers. All other compilers accept this, though.
23    #     nonstandard extension used : 'identifier' :
24    #     cannot be initialized using address of automatic variable
25    cflags += [ "/wd4221" ]
26  }
27
28  include_dirs = [
29    "..",
30    "../../include",
31  ]
32
33  sources = [
34    "GCDAProfiling.c",
35    "InstrProfiling.c",
36    "InstrProfiling.h",
37    "InstrProfilingBiasVar.c",
38    "InstrProfilingBuffer.c",
39    "InstrProfilingFile.c",
40    "InstrProfilingInternal.c",
41    "InstrProfilingInternal.h",
42    "InstrProfilingMerge.c",
43    "InstrProfilingMergeFile.c",
44    "InstrProfilingNameVar.c",
45    "InstrProfilingPlatformDarwin.c",
46    "InstrProfilingPlatformFuchsia.c",
47    "InstrProfilingPlatformLinux.c",
48    "InstrProfilingPlatformOther.c",
49    "InstrProfilingPlatformWindows.c",
50    "InstrProfilingPort.h",
51    "InstrProfilingRuntime.cpp",
52    "InstrProfilingUtil.c",
53    "InstrProfilingUtil.h",
54    "InstrProfilingValue.c",
55    "InstrProfilingVersionVar.c",
56    "InstrProfilingWriter.c",
57  ]
58  if (current_os == "win") {
59    sources += [
60      "WindowsMMap.c",
61      "WindowsMMap.h",
62    ]
63  }
64
65  if (current_os != "win") {
66    defines = [
67      "COMPILER_RT_HAS_UNAME",
68      "COMPILER_RT_HAS_ATOMICS",
69      "COMPILER_RT_HAS_FCNTL_LCK",
70    ]
71  }
72}
73