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 \ |
Josh Gao | bf2dd48 | 2017-03-28 13:07:15 -0700 | [diff] [blame] | 11 | -DREBOOT_BOOTLOADER_ON_PANIC=1 \ |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 12 | -DWORLD_WRITABLE_KMSG=1 \ |
| 13 | -DDUMP_ON_UMOUNT_FAILURE=1 |
Elliott Hughes | c0e919c | 2015-02-04 14:46:36 -0800 | [diff] [blame] | 14 | else |
Tom Cherry | 663fdfc | 2017-03-10 14:46:38 -0800 | [diff] [blame] | 15 | init_options += \ |
| 16 | -DALLOW_LOCAL_PROP_OVERRIDE=0 \ |
| 17 | -DALLOW_PERMISSIVE_SELINUX=0 \ |
Josh Gao | bf2dd48 | 2017-03-28 13:07:15 -0700 | [diff] [blame] | 18 | -DREBOOT_BOOTLOADER_ON_PANIC=0 \ |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 19 | -DWORLD_WRITABLE_KMSG=0 \ |
| 20 | -DDUMP_ON_UMOUNT_FAILURE=0 |
Elliott Hughes | c0e919c | 2015-02-04 14:46:36 -0800 | [diff] [blame] | 21 | endif |
| 22 | |
Keun-young Park | c4ffa5c | 2017-03-28 09:41:36 -0700 | [diff] [blame] | 23 | ifneq (,$(filter eng,$(TARGET_BUILD_VARIANT))) |
| 24 | init_options += \ |
| 25 | -DSHUTDOWN_ZERO_TIMEOUT=1 |
| 26 | else |
| 27 | init_options += \ |
| 28 | -DSHUTDOWN_ZERO_TIMEOUT=0 |
| 29 | endif |
| 30 | |
Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 31 | init_options += -DLOG_UEVENTS=0 |
| 32 | |
| 33 | init_cflags += \ |
| 34 | $(init_options) \ |
| 35 | -Wall -Wextra \ |
| 36 | -Wno-unused-parameter \ |
| 37 | -Werror \ |
Tom Cherry | 2bc0014 | 2017-03-13 11:58:58 -0700 | [diff] [blame] | 38 | -std=gnu++1z \ |
Elliott Hughes | c0e919c | 2015-02-04 14:46:36 -0800 | [diff] [blame] | 39 | |
| 40 | # -- |
| 41 | |
Lee Campbell | 220ca84 | 2015-07-30 09:27:11 -0700 | [diff] [blame] | 42 | # If building on Linux, then build unit test for the host. |
| 43 | ifeq ($(HOST_OS),linux) |
| 44 | include $(CLEAR_VARS) |
| 45 | LOCAL_CPPFLAGS := $(init_cflags) |
| 46 | LOCAL_SRC_FILES:= \ |
| 47 | parser/tokenizer.cpp \ |
| 48 | |
| 49 | LOCAL_MODULE := libinit_parser |
| 50 | LOCAL_CLANG := true |
| 51 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 52 | |
| 53 | include $(CLEAR_VARS) |
| 54 | LOCAL_MODULE := init_parser_tests |
| 55 | LOCAL_SRC_FILES := \ |
| 56 | parser/tokenizer_test.cpp \ |
| 57 | |
James Hawkins | c8ac067 | 2017-02-14 19:20:20 +0000 | [diff] [blame] | 58 | LOCAL_STATIC_LIBRARIES := libinit_parser |
Lee Campbell | 220ca84 | 2015-07-30 09:27:11 -0700 | [diff] [blame] | 59 | LOCAL_CLANG := true |
| 60 | include $(BUILD_HOST_NATIVE_TEST) |
| 61 | endif |
| 62 | |
Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 63 | include $(CLEAR_VARS) |
Chih-Hung Hsieh | 7275802 | 2017-05-04 16:30:14 -0700 | [diff] [blame^] | 64 | # b/38002385, work around clang-tidy segmentation fault. |
| 65 | LOCAL_TIDY_CHECKS := -misc-forwarding-reference-overload |
Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 66 | LOCAL_CPPFLAGS := $(init_cflags) |
| 67 | LOCAL_SRC_FILES:= \ |
Tom Cherry | fa0c21c | 2015-07-23 17:53:11 -0700 | [diff] [blame] | 68 | action.cpp \ |
Jorge Lucangeli Obes | 24b2913 | 2016-10-27 10:33:03 -0400 | [diff] [blame] | 69 | capabilities.cpp \ |
Mark Salyzyn | 62767fe | 2016-10-27 07:45:34 -0700 | [diff] [blame] | 70 | descriptors.cpp \ |
Tom Cherry | c44f6a4 | 2017-04-05 15:58:31 -0700 | [diff] [blame] | 71 | devices.cpp \ |
Tom Cherry | b734990 | 2015-08-26 11:43:36 -0700 | [diff] [blame] | 72 | import_parser.cpp \ |
Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 73 | init_parser.cpp \ |
Elliott Hughes | da40c00 | 2015-03-27 23:20:44 -0700 | [diff] [blame] | 74 | log.cpp \ |
Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 75 | parser.cpp \ |
Tom Cherry | bac3299 | 2015-07-31 12:45:25 -0700 | [diff] [blame] | 76 | service.cpp \ |
Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 77 | util.cpp \ |
| 78 | |
Elliott Hughes | d8f9356 | 2017-04-14 19:47:05 +0000 | [diff] [blame] | 79 | LOCAL_STATIC_LIBRARIES := libbase libselinux liblog libprocessgroup |
Jorge Lucangeli Obes | 24b2913 | 2016-10-27 10:33:03 -0400 | [diff] [blame] | 80 | LOCAL_WHOLE_STATIC_LIBRARIES := libcap |
Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 81 | LOCAL_MODULE := libinit |
Nick Kralevich | f90b653 | 2015-08-15 15:24:23 +0000 | [diff] [blame] | 82 | LOCAL_SANITIZE := integer |
Elliott Hughes | 1115c25 | 2015-06-10 22:43:51 -0700 | [diff] [blame] | 83 | LOCAL_CLANG := true |
Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 84 | include $(BUILD_STATIC_LIBRARY) |
| 85 | |
| 86 | include $(CLEAR_VARS) |
Chih-Hung Hsieh | 7275802 | 2017-05-04 16:30:14 -0700 | [diff] [blame^] | 87 | # b/38002385, work around clang-tidy segmentation fault. |
| 88 | LOCAL_TIDY_CHECKS := -misc-forwarding-reference-overload |
Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 89 | LOCAL_CPPFLAGS := $(init_cflags) |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 90 | LOCAL_SRC_FILES:= \ |
Elliott Hughes | 2462790 | 2015-02-04 10:25:09 -0800 | [diff] [blame] | 91 | bootchart.cpp \ |
Elliott Hughes | f3cf438 | 2015-02-03 17:12:07 -0800 | [diff] [blame] | 92 | builtins.cpp \ |
Elliott Hughes | f3cf438 | 2015-02-03 17:12:07 -0800 | [diff] [blame] | 93 | init.cpp \ |
Bowgo Tsai | d262017 | 2017-04-17 22:17:09 +0800 | [diff] [blame] | 94 | init_first_stage.cpp \ |
Elliott Hughes | f3cf438 | 2015-02-03 17:12:07 -0800 | [diff] [blame] | 95 | keychords.cpp \ |
Elliott Hughes | f3cf438 | 2015-02-03 17:12:07 -0800 | [diff] [blame] | 96 | property_service.cpp \ |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 97 | reboot.cpp \ |
Elliott Hughes | f3cf438 | 2015-02-03 17:12:07 -0800 | [diff] [blame] | 98 | signal_handler.cpp \ |
| 99 | ueventd.cpp \ |
Elliott Hughes | f3cf438 | 2015-02-03 17:12:07 -0800 | [diff] [blame] | 100 | watchdogd.cpp \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 101 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 102 | LOCAL_MODULE:= init |
Andres Morales | db5f5d4 | 2015-05-08 08:30:33 -0700 | [diff] [blame] | 103 | LOCAL_C_INCLUDES += \ |
Andres Morales | db5f5d4 | 2015-05-08 08:30:33 -0700 | [diff] [blame] | 104 | system/core/mkbootimg |
| 105 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 106 | LOCAL_FORCE_STATIC_EXECUTABLE := true |
| 107 | LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) |
| 108 | LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED) |
| 109 | |
Kenny Root | b5982bf | 2012-10-16 23:07:05 -0700 | [diff] [blame] | 110 | LOCAL_STATIC_LIBRARIES := \ |
Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 111 | libinit \ |
Yabin Cui | 1051e10 | 2016-06-24 18:28:03 -0700 | [diff] [blame] | 112 | libbootloader_message \ |
Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 113 | libfs_mgr \ |
Sami Tolvanen | 99e3a92 | 2015-05-22 15:43:50 +0100 | [diff] [blame] | 114 | libfec \ |
| 115 | libfec_rs \ |
Mohamad Ayyash | 030ef359 | 2015-04-08 17:59:19 -0700 | [diff] [blame] | 116 | libsquashfs_utils \ |
Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 117 | liblogwrap \ |
Alex Deymo | 705353a | 2017-01-11 14:03:11 -0800 | [diff] [blame] | 118 | libext4_utils \ |
Bowgo Tsai | aaf70e7 | 2017-03-02 00:03:56 +0800 | [diff] [blame] | 119 | libcutils \ |
Jeff Sharkey | 3b9c83a | 2016-02-03 14:44:44 -0700 | [diff] [blame] | 120 | libbase \ |
Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 121 | libc \ |
| 122 | libselinux \ |
William Roberts | bd2d961 | 2015-08-04 14:23:04 -0700 | [diff] [blame] | 123 | liblog \ |
Josh Gao | 47763c3 | 2016-08-05 15:47:57 -0700 | [diff] [blame] | 124 | libcrypto_utils \ |
| 125 | libcrypto \ |
Paul Lawrence | b8c9d27 | 2015-03-26 15:49:42 +0000 | [diff] [blame] | 126 | libc++_static \ |
Ed Tam | 438443e | 2015-04-13 16:29:05 -0700 | [diff] [blame] | 127 | libdl \ |
Alex Deymo | b0c3959 | 2017-01-11 14:37:50 -0800 | [diff] [blame] | 128 | libsparse \ |
Collin Mulliner | f7e79b9 | 2016-06-01 21:03:55 +0000 | [diff] [blame] | 129 | libz \ |
Nick Kralevich | 8adb4d9 | 2017-01-03 08:37:54 -0800 | [diff] [blame] | 130 | libprocessgroup \ |
bowgotsai | b51722b | 2017-01-11 22:21:38 +0800 | [diff] [blame] | 131 | libavb |
Stephen Smalley | e46f9d5 | 2012-01-13 08:48:47 -0500 | [diff] [blame] | 132 | |
Jorge Lucangeli Obes | 24b2913 | 2016-10-27 10:33:03 -0400 | [diff] [blame] | 133 | # Create symlinks. |
Ying Wang | dbb78d6 | 2014-11-24 15:43:34 -0800 | [diff] [blame] | 134 | LOCAL_POST_INSTALL_CMD := $(hide) mkdir -p $(TARGET_ROOT_OUT)/sbin; \ |
| 135 | ln -sf ../init $(TARGET_ROOT_OUT)/sbin/ueventd; \ |
| 136 | ln -sf ../init $(TARGET_ROOT_OUT)/sbin/watchdogd |
Alex Ray | 18ccc1b | 2014-03-06 15:07:42 -0800 | [diff] [blame] | 137 | |
Nick Kralevich | f90b653 | 2015-08-15 15:24:23 +0000 | [diff] [blame] | 138 | LOCAL_SANITIZE := integer |
Elliott Hughes | 1115c25 | 2015-06-10 22:43:51 -0700 | [diff] [blame] | 139 | LOCAL_CLANG := true |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 140 | include $(BUILD_EXECUTABLE) |
Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 141 | |
| 142 | |
Jorge Lucangeli Obes | 24b2913 | 2016-10-27 10:33:03 -0400 | [diff] [blame] | 143 | # Unit tests. |
| 144 | # ========================================================= |
Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 145 | include $(CLEAR_VARS) |
Chih-Hung Hsieh | 7275802 | 2017-05-04 16:30:14 -0700 | [diff] [blame^] | 146 | # b/38002385, work around clang-tidy segmentation fault. |
| 147 | LOCAL_TIDY_CHECKS := -misc-forwarding-reference-overload |
Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 148 | LOCAL_MODULE := init_tests |
| 149 | LOCAL_SRC_FILES := \ |
Tom Cherry | c44f6a4 | 2017-04-05 15:58:31 -0700 | [diff] [blame] | 150 | devices_test.cpp \ |
Elliott Hughes | 8d82ea0 | 2015-02-06 20:15:18 -0800 | [diff] [blame] | 151 | init_parser_test.cpp \ |
Tom Cherry | ad54d09 | 2017-04-19 16:18:50 -0700 | [diff] [blame] | 152 | init_test.cpp \ |
Elliott Hughes | b005d90 | 2017-02-22 14:54:15 -0800 | [diff] [blame] | 153 | property_service_test.cpp \ |
Tom Cherry | 7da5485 | 2017-05-01 14:16:41 -0700 | [diff] [blame] | 154 | service_test.cpp \ |
Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 155 | util_test.cpp \ |
| 156 | |
| 157 | LOCAL_SHARED_LIBRARIES += \ |
Dan Albert | c007bc3 | 2015-03-16 10:08:46 -0700 | [diff] [blame] | 158 | libbase \ |
Tom Cherry | 060b74b | 2017-04-12 14:27:51 -0700 | [diff] [blame] | 159 | libcutils \ |
| 160 | libselinux \ |
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 |
Tom Cherry | ad54d09 | 2017-04-19 16:18:50 -0700 | [diff] [blame] | 165 | LOCAL_CPPFLAGS := -Wall -Wextra -Werror -std=gnu++1z |
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)) |