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