| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 1 | # Copyright 2005 The Android Open Source Project | 
|  | 2 |  | 
|  | 3 | LOCAL_PATH:= $(call my-dir) | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 4 |  | 
| Elliott Hughes | c0e919c | 2015-02-04 14:46:36 -0800 | [diff] [blame] | 5 | # -- | 
|  | 6 |  | 
| Elliott Hughes | c0e919c | 2015-02-04 14:46:36 -0800 | [diff] [blame] | 7 | ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) | 
| Tom Cherry | 663fdfc | 2017-03-10 14:46:38 -0800 | [diff] [blame] | 8 | init_options += \ | 
|  | 9 | -DALLOW_LOCAL_PROP_OVERRIDE=1 \ | 
|  | 10 | -DALLOW_PERMISSIVE_SELINUX=1 \ | 
|  | 11 | -DREBOOT_BOOTLOADER_ON_PANIC=1 | 
| Elliott Hughes | c0e919c | 2015-02-04 14:46:36 -0800 | [diff] [blame] | 12 | else | 
| Tom Cherry | 663fdfc | 2017-03-10 14:46:38 -0800 | [diff] [blame] | 13 | init_options += \ | 
|  | 14 | -DALLOW_LOCAL_PROP_OVERRIDE=0 \ | 
|  | 15 | -DALLOW_PERMISSIVE_SELINUX=0 \ | 
|  | 16 | -DREBOOT_BOOTLOADER_ON_PANIC=0 | 
| Elliott Hughes | c0e919c | 2015-02-04 14:46:36 -0800 | [diff] [blame] | 17 | endif | 
|  | 18 |  | 
| Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 19 | init_options += -DLOG_UEVENTS=0 | 
|  | 20 |  | 
|  | 21 | init_cflags += \ | 
|  | 22 | $(init_options) \ | 
|  | 23 | -Wall -Wextra \ | 
|  | 24 | -Wno-unused-parameter \ | 
|  | 25 | -Werror \ | 
| Tom Cherry | 2bc0014 | 2017-03-13 11:58:58 -0700 | [diff] [blame] | 26 | -std=gnu++1z \ | 
| Elliott Hughes | c0e919c | 2015-02-04 14:46:36 -0800 | [diff] [blame] | 27 |  | 
|  | 28 | # -- | 
|  | 29 |  | 
| Lee Campbell | 220ca84 | 2015-07-30 09:27:11 -0700 | [diff] [blame] | 30 | # If building on Linux, then build unit test for the host. | 
|  | 31 | ifeq ($(HOST_OS),linux) | 
|  | 32 | include $(CLEAR_VARS) | 
|  | 33 | LOCAL_CPPFLAGS := $(init_cflags) | 
|  | 34 | LOCAL_SRC_FILES:= \ | 
|  | 35 | parser/tokenizer.cpp \ | 
|  | 36 |  | 
|  | 37 | LOCAL_MODULE := libinit_parser | 
|  | 38 | LOCAL_CLANG := true | 
|  | 39 | include $(BUILD_HOST_STATIC_LIBRARY) | 
|  | 40 |  | 
|  | 41 | include $(CLEAR_VARS) | 
|  | 42 | LOCAL_MODULE := init_parser_tests | 
|  | 43 | LOCAL_SRC_FILES := \ | 
|  | 44 | parser/tokenizer_test.cpp \ | 
|  | 45 |  | 
| James Hawkins | c8ac067 | 2017-02-14 19:20:20 +0000 | [diff] [blame] | 46 | LOCAL_STATIC_LIBRARIES := libinit_parser | 
| Lee Campbell | 220ca84 | 2015-07-30 09:27:11 -0700 | [diff] [blame] | 47 | LOCAL_CLANG := true | 
|  | 48 | include $(BUILD_HOST_NATIVE_TEST) | 
|  | 49 | endif | 
|  | 50 |  | 
| Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 51 | include $(CLEAR_VARS) | 
|  | 52 | LOCAL_CPPFLAGS := $(init_cflags) | 
|  | 53 | LOCAL_SRC_FILES:= \ | 
| Tom Cherry | fa0c21c | 2015-07-23 17:53:11 -0700 | [diff] [blame] | 54 | action.cpp \ | 
| Jorge Lucangeli Obes | 24b2913 | 2016-10-27 10:33:03 -0400 | [diff] [blame] | 55 | capabilities.cpp \ | 
| Mark Salyzyn | 62767fe | 2016-10-27 07:45:34 -0700 | [diff] [blame] | 56 | descriptors.cpp \ | 
| Tom Cherry | b734990 | 2015-08-26 11:43:36 -0700 | [diff] [blame] | 57 | import_parser.cpp \ | 
| Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 58 | init_parser.cpp \ | 
| Elliott Hughes | da40c00 | 2015-03-27 23:20:44 -0700 | [diff] [blame] | 59 | log.cpp \ | 
| Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 60 | parser.cpp \ | 
| Tom Cherry | bac3299 | 2015-07-31 12:45:25 -0700 | [diff] [blame] | 61 | service.cpp \ | 
| Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 62 | util.cpp \ | 
|  | 63 |  | 
| Nick Kralevich | 8adb4d9 | 2017-01-03 08:37:54 -0800 | [diff] [blame] | 64 | LOCAL_STATIC_LIBRARIES := libbase libselinux liblog libprocessgroup libnl | 
| Jorge Lucangeli Obes | 24b2913 | 2016-10-27 10:33:03 -0400 | [diff] [blame] | 65 | LOCAL_WHOLE_STATIC_LIBRARIES := libcap | 
| Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 66 | LOCAL_MODULE := libinit | 
| Nick Kralevich | f90b653 | 2015-08-15 15:24:23 +0000 | [diff] [blame] | 67 | LOCAL_SANITIZE := integer | 
| Elliott Hughes | 1115c25 | 2015-06-10 22:43:51 -0700 | [diff] [blame] | 68 | LOCAL_CLANG := true | 
| Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 69 | include $(BUILD_STATIC_LIBRARY) | 
|  | 70 |  | 
|  | 71 | include $(CLEAR_VARS) | 
|  | 72 | LOCAL_CPPFLAGS := $(init_cflags) | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 73 | LOCAL_SRC_FILES:= \ | 
| Elliott Hughes | 2462790 | 2015-02-04 10:25:09 -0800 | [diff] [blame] | 74 | bootchart.cpp \ | 
| Elliott Hughes | f3cf438 | 2015-02-03 17:12:07 -0800 | [diff] [blame] | 75 | builtins.cpp \ | 
|  | 76 | devices.cpp \ | 
|  | 77 | init.cpp \ | 
| Elliott Hughes | f3cf438 | 2015-02-03 17:12:07 -0800 | [diff] [blame] | 78 | keychords.cpp \ | 
| Elliott Hughes | f3cf438 | 2015-02-03 17:12:07 -0800 | [diff] [blame] | 79 | property_service.cpp \ | 
| Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 80 | reboot.cpp \ | 
| Elliott Hughes | f3cf438 | 2015-02-03 17:12:07 -0800 | [diff] [blame] | 81 | signal_handler.cpp \ | 
|  | 82 | ueventd.cpp \ | 
|  | 83 | ueventd_parser.cpp \ | 
| Elliott Hughes | f3cf438 | 2015-02-03 17:12:07 -0800 | [diff] [blame] | 84 | watchdogd.cpp \ | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 85 |  | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 86 | LOCAL_MODULE:= init | 
| Andres Morales | db5f5d4 | 2015-05-08 08:30:33 -0700 | [diff] [blame] | 87 | LOCAL_C_INCLUDES += \ | 
| Andres Morales | db5f5d4 | 2015-05-08 08:30:33 -0700 | [diff] [blame] | 88 | system/core/mkbootimg | 
|  | 89 |  | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 90 | LOCAL_FORCE_STATIC_EXECUTABLE := true | 
|  | 91 | LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) | 
|  | 92 | LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED) | 
|  | 93 |  | 
| Kenny Root | b5982bf | 2012-10-16 23:07:05 -0700 | [diff] [blame] | 94 | LOCAL_STATIC_LIBRARIES := \ | 
| Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 95 | libinit \ | 
| Yabin Cui | 1051e10 | 2016-06-24 18:28:03 -0700 | [diff] [blame] | 96 | libbootloader_message \ | 
| Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 97 | libfs_mgr \ | 
| Sami Tolvanen | 99e3a92 | 2015-05-22 15:43:50 +0100 | [diff] [blame] | 98 | libfec \ | 
|  | 99 | libfec_rs \ | 
| Mohamad Ayyash | 030ef359 | 2015-04-08 17:59:19 -0700 | [diff] [blame] | 100 | libsquashfs_utils \ | 
| Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 101 | liblogwrap \ | 
|  | 102 | libcutils \ | 
| Alex Deymo | 705353a | 2017-01-11 14:03:11 -0800 | [diff] [blame] | 103 | libext4_utils \ | 
| Jeff Sharkey | 3b9c83a | 2016-02-03 14:44:44 -0700 | [diff] [blame] | 104 | libbase \ | 
| Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 105 | libc \ | 
|  | 106 | libselinux \ | 
| William Roberts | bd2d961 | 2015-08-04 14:23:04 -0700 | [diff] [blame] | 107 | liblog \ | 
| Josh Gao | 47763c3 | 2016-08-05 15:47:57 -0700 | [diff] [blame] | 108 | libcrypto_utils \ | 
|  | 109 | libcrypto \ | 
| Paul Lawrence | b8c9d27 | 2015-03-26 15:49:42 +0000 | [diff] [blame] | 110 | libc++_static \ | 
| Ed Tam | 438443e | 2015-04-13 16:29:05 -0700 | [diff] [blame] | 111 | libdl \ | 
| Alex Deymo | b0c3959 | 2017-01-11 14:37:50 -0800 | [diff] [blame] | 112 | libsparse \ | 
| Collin Mulliner | f7e79b9 | 2016-06-01 21:03:55 +0000 | [diff] [blame] | 113 | libz \ | 
| Nick Kralevich | 8adb4d9 | 2017-01-03 08:37:54 -0800 | [diff] [blame] | 114 | libprocessgroup \ | 
|  | 115 | libnl \ | 
| bowgotsai | b51722b | 2017-01-11 22:21:38 +0800 | [diff] [blame] | 116 | libavb | 
| Stephen Smalley | e46f9d5 | 2012-01-13 08:48:47 -0500 | [diff] [blame] | 117 |  | 
| Alex Klyubin | b51f9ab | 2017-03-02 12:53:32 -0800 | [diff] [blame] | 118 | # Include SELinux policy. We do this here because different modules | 
|  | 119 | # need to be included based on the value of PRODUCT_FULL_TREBLE. This | 
|  | 120 | # type of conditional inclusion cannot be done in top-level files such | 
|  | 121 | # as build/target/product/embedded.mk. | 
|  | 122 | # This conditional inclusion closely mimics the conditional logic | 
|  | 123 | # inside init/init.cpp for loading SELinux policy from files. | 
|  | 124 | ifeq ($(PRODUCT_FULL_TREBLE),true) | 
|  | 125 | # Use split SELinux policy | 
|  | 126 | LOCAL_REQUIRED_MODULES += \ | 
|  | 127 | mapping_sepolicy.cil \ | 
|  | 128 | nonplat_sepolicy.cil \ | 
|  | 129 | plat_sepolicy.cil \ | 
| Alex Klyubin | 2d19aeb | 2017-03-07 14:12:01 -0800 | [diff] [blame] | 130 | plat_sepolicy.cil.sha256 \ | 
| Jeff Vander Stoep | 0cbbb83 | 2017-03-08 15:17:21 -0800 | [diff] [blame] | 131 | secilc \ | 
|  | 132 | nonplat_file_contexts \ | 
|  | 133 | plat_file_contexts | 
| Alex Klyubin | 2d19aeb | 2017-03-07 14:12:01 -0800 | [diff] [blame] | 134 |  | 
|  | 135 | # Include precompiled policy, unless told otherwise | 
|  | 136 | ifneq ($(PRODUCT_PRECOMPILED_SEPOLICY),false) | 
|  | 137 | LOCAL_REQUIRED_MODULES += precompiled_sepolicy precompiled_sepolicy.plat.sha256 | 
|  | 138 | endif | 
|  | 139 |  | 
| Alex Klyubin | b51f9ab | 2017-03-02 12:53:32 -0800 | [diff] [blame] | 140 | else | 
|  | 141 | # Use monolithic SELinux policy | 
| Jeff Vander Stoep | 0cbbb83 | 2017-03-08 15:17:21 -0800 | [diff] [blame] | 142 | LOCAL_REQUIRED_MODULES += sepolicy \ | 
|  | 143 | file_contexts.bin | 
| Alex Klyubin | b51f9ab | 2017-03-02 12:53:32 -0800 | [diff] [blame] | 144 | endif | 
|  | 145 |  | 
| Jorge Lucangeli Obes | 24b2913 | 2016-10-27 10:33:03 -0400 | [diff] [blame] | 146 | # Create symlinks. | 
| Ying Wang | dbb78d6 | 2014-11-24 15:43:34 -0800 | [diff] [blame] | 147 | LOCAL_POST_INSTALL_CMD := $(hide) mkdir -p $(TARGET_ROOT_OUT)/sbin; \ | 
|  | 148 | ln -sf ../init $(TARGET_ROOT_OUT)/sbin/ueventd; \ | 
|  | 149 | ln -sf ../init $(TARGET_ROOT_OUT)/sbin/watchdogd | 
| Alex Ray | 18ccc1b | 2014-03-06 15:07:42 -0800 | [diff] [blame] | 150 |  | 
| Nick Kralevich | f90b653 | 2015-08-15 15:24:23 +0000 | [diff] [blame] | 151 | LOCAL_SANITIZE := integer | 
| Elliott Hughes | 1115c25 | 2015-06-10 22:43:51 -0700 | [diff] [blame] | 152 | LOCAL_CLANG := true | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 153 | include $(BUILD_EXECUTABLE) | 
| Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 154 |  | 
|  | 155 |  | 
| Jorge Lucangeli Obes | 24b2913 | 2016-10-27 10:33:03 -0400 | [diff] [blame] | 156 | # Unit tests. | 
|  | 157 | # ========================================================= | 
| Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 158 | include $(CLEAR_VARS) | 
|  | 159 | LOCAL_MODULE := init_tests | 
|  | 160 | LOCAL_SRC_FILES := \ | 
| Elliott Hughes | 8d82ea0 | 2015-02-06 20:15:18 -0800 | [diff] [blame] | 161 | init_parser_test.cpp \ | 
| Elliott Hughes | b005d90 | 2017-02-22 14:54:15 -0800 | [diff] [blame] | 162 | property_service_test.cpp \ | 
| Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 163 | util_test.cpp \ | 
|  | 164 |  | 
|  | 165 | LOCAL_SHARED_LIBRARIES += \ | 
|  | 166 | libcutils \ | 
| Dan Albert | c007bc3 | 2015-03-16 10:08:46 -0700 | [diff] [blame] | 167 | libbase \ | 
| Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 168 |  | 
|  | 169 | LOCAL_STATIC_LIBRARIES := libinit | 
| Nick Kralevich | f90b653 | 2015-08-15 15:24:23 +0000 | [diff] [blame] | 170 | LOCAL_SANITIZE := integer | 
| Elliott Hughes | 1115c25 | 2015-06-10 22:43:51 -0700 | [diff] [blame] | 171 | LOCAL_CLANG := true | 
| Mark Salyzyn | 62767fe | 2016-10-27 07:45:34 -0700 | [diff] [blame] | 172 | LOCAL_CPPFLAGS := -Wall -Wextra -Werror | 
| Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 173 | include $(BUILD_NATIVE_TEST) | 
| Jorge Lucangeli Obes | 28e980b | 2016-12-20 16:54:04 -0500 | [diff] [blame] | 174 |  | 
|  | 175 |  | 
|  | 176 | # Include targets in subdirs. | 
|  | 177 | # ========================================================= | 
|  | 178 | include $(call all-makefiles-under,$(LOCAL_PATH)) |