Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame^] | 1 | // |
| 2 | // Copyright (C) 2017 The Android Open Source Project |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | // |
| 16 | |
| 17 | cc_defaults { |
| 18 | name: "init_defaults", |
| 19 | cpp_std: "experimental", |
| 20 | sanitize: { |
| 21 | misc_undefined: ["integer"], |
| 22 | }, |
| 23 | tidy_checks: ["-misc-forwarding-reference-overload"], |
| 24 | cppflags: [ |
| 25 | "-DLOG_UEVENTS=0", |
| 26 | "-Wall", |
| 27 | "-Wextra", |
| 28 | "-Wno-unused-parameter", |
| 29 | "-Werror", |
| 30 | "-DALLOW_LOCAL_PROP_OVERRIDE=0", |
| 31 | "-DALLOW_PERMISSIVE_SELINUX=0", |
| 32 | "-DREBOOT_BOOTLOADER_ON_PANIC=0", |
| 33 | "-DWORLD_WRITABLE_KMSG=0", |
| 34 | "-DDUMP_ON_UMOUNT_FAILURE=0", |
| 35 | "-DSHUTDOWN_ZERO_TIMEOUT=0", |
| 36 | ], |
| 37 | product_variables: { |
| 38 | debuggable: { |
| 39 | cppflags: [ |
| 40 | "-UALLOW_LOCAL_PROP_OVERRIDE", |
| 41 | "-DALLOW_LOCAL_PROP_OVERRIDE=1", |
| 42 | "-UALLOW_PERMISSIVE_SELINUX", |
| 43 | "-DALLOW_PERMISSIVE_SELINUX=1", |
| 44 | "-UREBOOT_BOOTLOADER_ON_PANIC", |
| 45 | "-DREBOOT_BOOTLOADER_ON_PANIC=1", |
| 46 | "-UWORLD_WRITABLE_KMSG", |
| 47 | "-DWORLD_WRITABLE_KMSG=1", |
| 48 | "-UDUMP_ON_UMOUNT_FAILURE", |
| 49 | "-DDUMP_ON_UMOUNT_FAILURE=1", |
| 50 | ], |
| 51 | }, |
| 52 | eng: { |
| 53 | cppflags: [ |
| 54 | "-USHUTDOWN_ZERO_TIMEOUT", |
| 55 | "-DSHUTDOWN_ZERO_TIMEOUT=1", |
| 56 | ], |
| 57 | }, |
| 58 | }, |
| 59 | } |
| 60 | |
| 61 | cc_library_static { |
| 62 | name: "libinit", |
| 63 | defaults: ["init_defaults"], |
| 64 | srcs: [ |
| 65 | "action.cpp", |
| 66 | "capabilities.cpp", |
| 67 | "descriptors.cpp", |
| 68 | "devices.cpp", |
| 69 | "import_parser.cpp", |
| 70 | "init_parser.cpp", |
| 71 | "log.cpp", |
| 72 | "parser.cpp", |
| 73 | "service.cpp", |
| 74 | "util.cpp", |
| 75 | ], |
| 76 | whole_static_libs: ["libcap"], |
| 77 | static_libs: [ |
| 78 | "libbase", |
| 79 | "libselinux", |
| 80 | "liblog", |
| 81 | "libprocessgroup", |
| 82 | ], |
| 83 | } |
| 84 | |
| 85 | /* |
| 86 | This is not yet ready, see the below TODOs for what is missing |
| 87 | |
| 88 | cc_binary { |
| 89 | // TODO: Missing, |
| 90 | //LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) |
| 91 | //LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED) |
| 92 | |
| 93 | name: "init", |
| 94 | defaults: ["init_defaults"], |
| 95 | static_executable: true, |
| 96 | srcs: [ |
| 97 | "bootchart.cpp", |
| 98 | "builtins.cpp", |
| 99 | "init.cpp", |
| 100 | "init_first_stage.cpp", |
| 101 | "keychords.cpp", |
| 102 | "property_service.cpp", |
| 103 | "reboot.cpp", |
| 104 | "signal_handler.cpp", |
| 105 | "ueventd.cpp", |
| 106 | "watchdogd.cpp", |
| 107 | ], |
| 108 | include_dirs: [ |
| 109 | "system/core/mkbootimg" |
| 110 | ], |
| 111 | static_libs: [ |
| 112 | "libinit", |
| 113 | "libbootloader_message", |
| 114 | "libfs_mgr", |
| 115 | "libfec", |
| 116 | "libfec_rs", |
| 117 | "libsquashfs_utils", |
| 118 | "liblogwrap", |
| 119 | "libext4_utils", |
| 120 | "libcutils", |
| 121 | "libbase", |
| 122 | "libc", |
| 123 | "libselinux", |
| 124 | "liblog", |
| 125 | "libcrypto_utils", |
| 126 | "libcrypto", |
| 127 | "libc++_static", |
| 128 | "libdl", |
| 129 | "libsparse", |
| 130 | "libz", |
| 131 | "libprocessgroup", |
| 132 | "libavb", |
| 133 | "libkeyutils", |
| 134 | ], |
| 135 | symlinks: [ |
| 136 | "sbin/ueventd", |
| 137 | "sbin/watchdogd", |
| 138 | ], |
| 139 | } |
| 140 | */ |
| 141 | |
| 142 | // Tests |
| 143 | // ------------------------------------------------------------------------------ |
| 144 | |
| 145 | cc_test { |
| 146 | name: "init_tests", |
| 147 | defaults: ["init_defaults"], |
| 148 | srcs: [ |
| 149 | "devices_test.cpp", |
| 150 | "init_parser_test.cpp", |
| 151 | "init_test.cpp", |
| 152 | "property_service_test.cpp", |
| 153 | "service_test.cpp", |
| 154 | "util_test.cpp", |
| 155 | ], |
| 156 | shared_libs: [ |
| 157 | "libbase", |
| 158 | "libcutils", |
| 159 | "libselinux", |
| 160 | ], |
| 161 | static_libs: ["libinit"], |
| 162 | } |
| 163 | |
| 164 | subdirs = ["*"] |