1package { 2 default_applicable_licenses: ["external_trace-cmd_license"], 3} 4 5// See: http://go/android-license-faq 6license { 7 name: "external_trace-cmd_license", 8 9 visibility: [":__subpackages__"], 10 11 license_kinds: [ 12 "SPDX-license-identifier-GPL-2.0", 13 "SPDX-license-identifier-GPL-2.0-only", 14 "SPDX-license-identifier-GPL-2.0+", 15 "SPDX-license-identifier-GPL-2.0-or-later", 16 "SPDX-license-identifier-LGPL-2.1+", 17 ], 18 19 license_text: [ 20 "LICENSE", 21 ], 22} 23 24genrule { 25 name: "tc_version_header", 26 srcs: ["Makefile"], 27 out: ["tc_version.h"], 28 cmd: "(" + 29 "VERSION=$$(grep '\\bTC_VERSION =' <$(in) | awk '{ print $$3 }') " + 30 "&& PATCHLEVEL=$$(grep '\\bTC_PATCHLEVEL =' <$(in) | awk '{ print $$3 }') " + 31 "&& VERSION_CODE=$$(expr $${VERSION} \\* 256 + $${PATCHLEVEL}) " + 32 "&& EXTRAVERSION=$$(grep '\\bTC_EXTRAVERSION =' <$(in) | awk '{ print $$3 }') " + 33 "&& echo '/* This file is automatically generated. Do not modify */' " + 34 "&& echo \"#define VERSION_CODE $${VERSION_CODE}\" " + 35 "&& echo \"#define EXTRAVERSION $${EXTRAVERSION}\" " + 36 "&& echo '#define VERSION_STRING \"'$${VERSION}.$${PATCHLEVEL}.$${EXTRAVERSION}'\"' " + 37 "&& echo '#define FILE_VERSION ' " + 38 "&& echo '#define VERSION_GIT \"not-a-git-repo\"' " + 39 ") > $(out)", 40} 41 42cc_library { 43 name: "libtracecmd", 44 45 // Restrict visibility due to GPL license 46 visibility: [ 47 "//external/trace-cmd:__subpackages__", 48 ], 49 50 local_include_dirs: [ 51 "lib/trace-cmd/include/private", 52 "lib/trace-cmd/include", 53 "include/trace-cmd", 54 "tracecmd/include", 55 "include", 56 ], 57 58 export_include_dirs: [ 59 "lib/trace-cmd/include", 60 ], 61 62 srcs: [ 63 "lib/trace-cmd/test.c", 64 "lib/trace-cmd/trace-blk-hack.c", 65 "lib/trace-cmd/trace-compress.c", 66 "lib/trace-cmd/trace-compress-zlib.c", 67 "lib/trace-cmd/trace-filter-hash.c", 68 "lib/trace-cmd/trace-ftrace.c", 69 "lib/trace-cmd/trace-hash.c", 70 "lib/trace-cmd/trace-hooks.c", 71 "lib/trace-cmd/trace-input.c", 72 "lib/trace-cmd/trace-msg.c", 73 "lib/trace-cmd/trace-output.c", 74 "lib/trace-cmd/trace-perf.c", 75 "lib/trace-cmd/trace-plugin.c", 76 "lib/trace-cmd/trace-recorder.c", 77 "lib/trace-cmd/trace-timesync.c", 78 "lib/trace-cmd/trace-timesync-kvm.c", 79 "lib/trace-cmd/trace-timesync-ptp.c", 80 "lib/trace-cmd/trace-util.c", 81 ], 82 83 shared: { 84 shared_libs: [ 85 "libtraceevent", 86 "libtracefs", 87 "libz", 88 ], 89 export_shared_lib_headers: [ 90 "libtraceevent", 91 "libtracefs", 92 "libz", 93 ], 94 }, 95 96 static: { 97 static_libs: [ 98 "libtraceevent", 99 "libtracefs", 100 "libz", 101 ], 102 export_static_lib_headers: [ 103 "libtraceevent", 104 "libtracefs", 105 "libz", 106 ], 107 }, 108 109 generated_headers: ["tc_version_header"], 110 111 export_generated_headers: ["tc_version_header"], 112 113 cflags: [ 114 "-D__bswap_64=__swap64", 115 "-D_GNU_SOURCE", 116 "-DPERF", 117 "-DVSOCK", 118 "-Wno-unused-parameter", 119 "-Wno-macro-redefined", 120 "-Wno-unused-but-set-variable", 121 "-Wno-user-defined-warnings", 122 "-Wno-visibility", 123 "-Wno-pointer-arith", 124 ], 125 126 c_std: "gnu99", 127} 128 129cc_binary { 130 name: "trace-cmd", 131 132 local_include_dirs: [ 133 "lib/trace-cmd/include/private", 134 "include/trace-cmd", 135 "tracecmd/include", 136 "include", 137 ], 138 139 srcs: ["tracecmd/*.c"], 140 141 static_libs: [ 142 "libtraceevent", 143 "libtracecmd", 144 "libtracefs", 145 ], 146 147 static_executable: true, 148 149 cflags: [ 150 "-D_GNU_SOURCE", 151 "-DNO_AUDIT", 152 "-DVSOCK", 153 "-Wno-unused-parameter", 154 "-Wno-macro-redefined", 155 "-Wno-visibility", 156 "-Wno-pointer-arith", 157 ], 158 159 c_std: "gnu99", 160} 161