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: { |
Tom Cherry | 2ffd65e | 2017-07-26 14:17:09 -0700 | [diff] [blame] | 21 | misc_undefined: ["signed-integer-overflow"], |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 22 | }, |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 23 | cppflags: [ |
| 24 | "-DLOG_UEVENTS=0", |
| 25 | "-Wall", |
| 26 | "-Wextra", |
| 27 | "-Wno-unused-parameter", |
| 28 | "-Werror", |
| 29 | "-DALLOW_LOCAL_PROP_OVERRIDE=0", |
| 30 | "-DALLOW_PERMISSIVE_SELINUX=0", |
| 31 | "-DREBOOT_BOOTLOADER_ON_PANIC=0", |
| 32 | "-DWORLD_WRITABLE_KMSG=0", |
| 33 | "-DDUMP_ON_UMOUNT_FAILURE=0", |
| 34 | "-DSHUTDOWN_ZERO_TIMEOUT=0", |
| 35 | ], |
| 36 | product_variables: { |
| 37 | debuggable: { |
| 38 | cppflags: [ |
| 39 | "-UALLOW_LOCAL_PROP_OVERRIDE", |
| 40 | "-DALLOW_LOCAL_PROP_OVERRIDE=1", |
| 41 | "-UALLOW_PERMISSIVE_SELINUX", |
| 42 | "-DALLOW_PERMISSIVE_SELINUX=1", |
| 43 | "-UREBOOT_BOOTLOADER_ON_PANIC", |
| 44 | "-DREBOOT_BOOTLOADER_ON_PANIC=1", |
| 45 | "-UWORLD_WRITABLE_KMSG", |
| 46 | "-DWORLD_WRITABLE_KMSG=1", |
| 47 | "-UDUMP_ON_UMOUNT_FAILURE", |
| 48 | "-DDUMP_ON_UMOUNT_FAILURE=1", |
| 49 | ], |
| 50 | }, |
| 51 | eng: { |
| 52 | cppflags: [ |
| 53 | "-USHUTDOWN_ZERO_TIMEOUT", |
| 54 | "-DSHUTDOWN_ZERO_TIMEOUT=1", |
| 55 | ], |
| 56 | }, |
| 57 | }, |
| 58 | } |
| 59 | |
| 60 | cc_library_static { |
| 61 | name: "libinit", |
| 62 | defaults: ["init_defaults"], |
| 63 | srcs: [ |
| 64 | "action.cpp", |
| 65 | "capabilities.cpp", |
| 66 | "descriptors.cpp", |
| 67 | "devices.cpp", |
Tom Cherry | ed506f7 | 2017-05-25 15:58:59 -0700 | [diff] [blame] | 68 | "firmware_handler.cpp", |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 69 | "import_parser.cpp", |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 70 | "log.cpp", |
| 71 | "parser.cpp", |
| 72 | "service.cpp", |
Tom Cherry | 67dee62 | 2017-07-27 12:54:48 -0700 | [diff] [blame] | 73 | "tokenizer.cpp", |
Tom Cherry | ed506f7 | 2017-05-25 15:58:59 -0700 | [diff] [blame] | 74 | "uevent_listener.cpp", |
| 75 | "ueventd_parser.cpp", |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 76 | "util.cpp", |
| 77 | ], |
| 78 | whole_static_libs: ["libcap"], |
| 79 | static_libs: [ |
| 80 | "libbase", |
| 81 | "libselinux", |
| 82 | "liblog", |
| 83 | "libprocessgroup", |
| 84 | ], |
| 85 | } |
| 86 | |
| 87 | /* |
| 88 | This is not yet ready, see the below TODOs for what is missing |
| 89 | |
| 90 | cc_binary { |
| 91 | // TODO: Missing, |
| 92 | //LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) |
| 93 | //LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED) |
| 94 | |
| 95 | name: "init", |
| 96 | defaults: ["init_defaults"], |
Jin Qian | 0045697 | 2017-07-06 11:43:45 -0700 | [diff] [blame] | 97 | required: [ |
| 98 | "e2fsdroid", |
| 99 | "mke2fs", |
| 100 | ], |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 101 | static_executable: true, |
| 102 | srcs: [ |
| 103 | "bootchart.cpp", |
| 104 | "builtins.cpp", |
| 105 | "init.cpp", |
| 106 | "init_first_stage.cpp", |
| 107 | "keychords.cpp", |
| 108 | "property_service.cpp", |
| 109 | "reboot.cpp", |
| 110 | "signal_handler.cpp", |
| 111 | "ueventd.cpp", |
| 112 | "watchdogd.cpp", |
| 113 | ], |
| 114 | include_dirs: [ |
| 115 | "system/core/mkbootimg" |
| 116 | ], |
| 117 | static_libs: [ |
| 118 | "libinit", |
| 119 | "libbootloader_message", |
| 120 | "libfs_mgr", |
| 121 | "libfec", |
| 122 | "libfec_rs", |
| 123 | "libsquashfs_utils", |
| 124 | "liblogwrap", |
| 125 | "libext4_utils", |
| 126 | "libcutils", |
| 127 | "libbase", |
| 128 | "libc", |
| 129 | "libselinux", |
| 130 | "liblog", |
| 131 | "libcrypto_utils", |
| 132 | "libcrypto", |
| 133 | "libc++_static", |
| 134 | "libdl", |
| 135 | "libsparse", |
| 136 | "libz", |
| 137 | "libprocessgroup", |
| 138 | "libavb", |
| 139 | "libkeyutils", |
| 140 | ], |
| 141 | symlinks: [ |
| 142 | "sbin/ueventd", |
| 143 | "sbin/watchdogd", |
| 144 | ], |
| 145 | } |
| 146 | */ |
| 147 | |
| 148 | // Tests |
| 149 | // ------------------------------------------------------------------------------ |
| 150 | |
| 151 | cc_test { |
| 152 | name: "init_tests", |
| 153 | defaults: ["init_defaults"], |
| 154 | srcs: [ |
| 155 | "devices_test.cpp", |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 156 | "init_test.cpp", |
| 157 | "property_service_test.cpp", |
| 158 | "service_test.cpp", |
Tom Cherry | c2e181c | 2017-07-14 16:29:23 -0700 | [diff] [blame] | 159 | "ueventd_test.cpp", |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 160 | "util_test.cpp", |
| 161 | ], |
| 162 | shared_libs: [ |
| 163 | "libbase", |
| 164 | "libcutils", |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 165 | ], |
Tom Cherry | 45a9d67 | 2017-08-09 17:09:04 -0700 | [diff] [blame^] | 166 | static_libs: [ |
| 167 | "libinit", |
| 168 | "libselinux", |
| 169 | "libcrypto", |
| 170 | ], |
Tom Cherry | 14fc013 | 2017-05-09 17:11:57 -0700 | [diff] [blame] | 171 | } |
| 172 | |
| 173 | subdirs = ["*"] |