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 // Generate protocol header files used by the server 76 genrule { 77 name: "wayland_core_server_protocol_headers", 78 cmd: "$(location wayland_scanner) server-header < $(in) > $(out)", 79 srcs: [":wayland_core_protocol"], 80 out: ["wayland-server-protocol.h"], 81 tools: ["wayland_scanner"], 82 } 83 84 // Build wayland_client 85 cc_library_static { 86 name: "libwayland_client", 87 vendor_available: true, 88 defaults: ["wayland_defaults"], 89 srcs: [ 90 "src/connection.c", 91 "src/wayland-client.c", 92 "src/wayland-os.c", 93 "src/wayland-util.c", 94 ], 95 cflags: ["-Wall", "-Werror"], 96 generated_sources: ["wayland_core_protocol_sources"], 97 static_libs: ["libffi"], 98 local_include_dirs: ["src"], 99 generated_headers: [ 100 "wayland_version_header", 101 "wayland_core_client_protocol_headers" 102 ], 103 export_include_dirs: ["src"], 104 export_generated_headers: [ 105 "wayland_version_header", 106 "wayland_core_client_protocol_headers" 107 ], 108 } 109 110 // Build wayland_server 111 cc_library_static { 112 name: "libwayland_server", 113 vendor_available: true, 114 defaults: ["wayland_defaults"], 115 srcs: [ 116 "src/connection.c", 117 "src/wayland-os.c", 118 "src/wayland-util.c", 119 "src/wayland-server.c", 120 "src/wayland-shm.c", 121 "src/event-loop.c", 122 ], 123 cflags: ["-Wall", "-Werror"], 124 generated_sources: ["wayland_core_protocol_sources"], 125 static_libs: ["libffi"], 126 local_include_dirs: ["src"], 127 generated_headers: [ 128 "wayland_version_header", 129 "wayland_core_server_protocol_headers", 130 ], 131 export_include_dirs: ["src"], 132 export_generated_headers: [ 133 "wayland_version_header", 134 "wayland_core_server_protocol_headers", 135 ], 136 } 137