1 // Copyright (C) 2017 The Android Open Source Project 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 cc_defaults { 16 name: "wayland_defaults", 17 18 cflags: [ 19 "-Wall", 20 "-Wextra", 21 "-g", 22 "-Wstrict-prototypes", 23 "-Wmissing-prototypes", 24 "-fvisibility=hidden", 25 "-Wno-cast-qual", 26 "-Wno-pointer-arith", 27 "-Wno-unused-parameter", 28 ], 29 } 30 31 filegroup { 32 name: "wayland_core_protocol", 33 srcs: [ 34 "protocol/wayland.xml", 35 ], 36 } 37 38 // Generate wayland-version.h 39 genrule { 40 name: "wayland_version_header", 41 cmd: "$(location gen_wayland_version_header.sh) $(location configure.ac) < $(in) > $(out)", 42 srcs: ["src/wayland-version.h.in"], 43 out: ["wayland-version.h"], 44 tool_files: ["gen_wayland_version_header.sh", "configure.ac"], 45 } 46 47 // Build wayland_scanner, used to generate code 48 cc_binary_host { 49 name: "wayland_scanner", 50 defaults: ["wayland_defaults"], 51 srcs: ["src/scanner.c", "src/wayland-util.c"], 52 cflags: ["-Wall", "-Werror"], 53 static_libs: ["libexpat"], 54 generated_headers: ["wayland_version_header"], 55 } 56 57 // Generate protocol source files used by both client and server 58 genrule { 59 name: "wayland_core_protocol_sources", 60 cmd: "$(location wayland_scanner) code < $(in) > $(out)", 61 srcs: [":wayland_core_protocol"], 62 out: ["wayland-protocol.c"], 63 tools: ["wayland_scanner"], 64 } 65 66 // Generate protocol header files used by the client 67 genrule { 68 name: "wayland_core_client_protocol_headers", 69 cmd: "$(location wayland_scanner) client-header < $(in) > $(out)", 70 srcs: [":wayland_core_protocol"], 71 out: ["wayland-client-protocol.h"], 72 tools: ["wayland_scanner"], 73 } 74 75 // Build wayland_client 76 cc_library_static { 77 name: "libwayland_client", 78 vendor_available: true, 79 defaults: ["wayland_defaults"], 80 srcs: [ 81 "src/connection.c", 82 "src/wayland-client.c", 83 "src/wayland-os.c", 84 "src/wayland-util.c", 85 ], 86 cflags: ["-Wall", "-Werror"], 87 generated_sources: ["wayland_core_protocol_sources"], 88 static_libs: ["libffi"], 89 local_include_dirs: ["src"], 90 generated_headers: [ 91 "wayland_version_header", 92 "wayland_core_client_protocol_headers" 93 ], 94 export_include_dirs: ["src"], 95 export_generated_headers: [ 96 "wayland_version_header", 97 "wayland_core_client_protocol_headers" 98 ], 99 } 100