blob: c7a41e392a5e3c31adc9eaa4b24d0613a3c3925c [file] [log] [blame]
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -08001# Copyright 2005 The Android Open Source Project
2
3LOCAL_PATH:= $(call my-dir)
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -08004
Elliott Hughesc0e919c2015-02-04 14:46:36 -08005# --
6
Elliott Hughesc0e919c2015-02-04 14:46:36 -08007ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
Tom Cherry663fdfc2017-03-10 14:46:38 -08008init_options += \
9 -DALLOW_LOCAL_PROP_OVERRIDE=1 \
10 -DALLOW_PERMISSIVE_SELINUX=1 \
Josh Gaobf2dd482017-03-28 13:07:15 -070011 -DREBOOT_BOOTLOADER_ON_PANIC=1 \
Keun-young Park2ba5c812017-03-29 12:54:40 -070012 -DWORLD_WRITABLE_KMSG=1 \
13 -DDUMP_ON_UMOUNT_FAILURE=1
Elliott Hughesc0e919c2015-02-04 14:46:36 -080014else
Tom Cherry663fdfc2017-03-10 14:46:38 -080015init_options += \
16 -DALLOW_LOCAL_PROP_OVERRIDE=0 \
17 -DALLOW_PERMISSIVE_SELINUX=0 \
Josh Gaobf2dd482017-03-28 13:07:15 -070018 -DREBOOT_BOOTLOADER_ON_PANIC=0 \
Keun-young Park2ba5c812017-03-29 12:54:40 -070019 -DWORLD_WRITABLE_KMSG=0 \
20 -DDUMP_ON_UMOUNT_FAILURE=0
Elliott Hughesc0e919c2015-02-04 14:46:36 -080021endif
22
Keun-young Parkc4ffa5c2017-03-28 09:41:36 -070023ifneq (,$(filter eng,$(TARGET_BUILD_VARIANT)))
24init_options += \
25 -DSHUTDOWN_ZERO_TIMEOUT=1
26else
27init_options += \
28 -DSHUTDOWN_ZERO_TIMEOUT=0
29endif
30
Elliott Hughesf682b472015-02-06 12:19:48 -080031init_options += -DLOG_UEVENTS=0
32
33init_cflags += \
34 $(init_options) \
35 -Wall -Wextra \
36 -Wno-unused-parameter \
37 -Werror \
Tom Cherry2bc00142017-03-13 11:58:58 -070038 -std=gnu++1z \
Elliott Hughesc0e919c2015-02-04 14:46:36 -080039
40# --
41
Lee Campbell220ca842015-07-30 09:27:11 -070042# If building on Linux, then build unit test for the host.
43ifeq ($(HOST_OS),linux)
44include $(CLEAR_VARS)
45LOCAL_CPPFLAGS := $(init_cflags)
46LOCAL_SRC_FILES:= \
47 parser/tokenizer.cpp \
48
49LOCAL_MODULE := libinit_parser
50LOCAL_CLANG := true
51include $(BUILD_HOST_STATIC_LIBRARY)
52
53include $(CLEAR_VARS)
54LOCAL_MODULE := init_parser_tests
55LOCAL_SRC_FILES := \
56 parser/tokenizer_test.cpp \
57
James Hawkinsc8ac0672017-02-14 19:20:20 +000058LOCAL_STATIC_LIBRARIES := libinit_parser
Lee Campbell220ca842015-07-30 09:27:11 -070059LOCAL_CLANG := true
60include $(BUILD_HOST_NATIVE_TEST)
61endif
62
Elliott Hughesf682b472015-02-06 12:19:48 -080063include $(CLEAR_VARS)
64LOCAL_CPPFLAGS := $(init_cflags)
65LOCAL_SRC_FILES:= \
Tom Cherryfa0c21c2015-07-23 17:53:11 -070066 action.cpp \
Jorge Lucangeli Obes24b29132016-10-27 10:33:03 -040067 capabilities.cpp \
Mark Salyzyn62767fe2016-10-27 07:45:34 -070068 descriptors.cpp \
Tom Cherryc44f6a42017-04-05 15:58:31 -070069 devices.cpp \
Tom Cherryb7349902015-08-26 11:43:36 -070070 import_parser.cpp \
Elliott Hughesf682b472015-02-06 12:19:48 -080071 init_parser.cpp \
Elliott Hughesda40c002015-03-27 23:20:44 -070072 log.cpp \
Elliott Hughesf682b472015-02-06 12:19:48 -080073 parser.cpp \
Tom Cherrybac32992015-07-31 12:45:25 -070074 service.cpp \
Elliott Hughesf682b472015-02-06 12:19:48 -080075 util.cpp \
76
Elliott Hughesd8f93562017-04-14 19:47:05 +000077LOCAL_STATIC_LIBRARIES := libbase libselinux liblog libprocessgroup
Jorge Lucangeli Obes24b29132016-10-27 10:33:03 -040078LOCAL_WHOLE_STATIC_LIBRARIES := libcap
Elliott Hughesf682b472015-02-06 12:19:48 -080079LOCAL_MODULE := libinit
Nick Kralevichf90b6532015-08-15 15:24:23 +000080LOCAL_SANITIZE := integer
Elliott Hughes1115c252015-06-10 22:43:51 -070081LOCAL_CLANG := true
Elliott Hughesf682b472015-02-06 12:19:48 -080082include $(BUILD_STATIC_LIBRARY)
83
84include $(CLEAR_VARS)
85LOCAL_CPPFLAGS := $(init_cflags)
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080086LOCAL_SRC_FILES:= \
Elliott Hughes24627902015-02-04 10:25:09 -080087 bootchart.cpp \
Elliott Hughesf3cf4382015-02-03 17:12:07 -080088 builtins.cpp \
Elliott Hughesf3cf4382015-02-03 17:12:07 -080089 init.cpp \
Bowgo Tsaid2620172017-04-17 22:17:09 +080090 init_first_stage.cpp \
Elliott Hughesf3cf4382015-02-03 17:12:07 -080091 keychords.cpp \
Elliott Hughesf3cf4382015-02-03 17:12:07 -080092 property_service.cpp \
Keun-young Park8d01f632017-03-13 11:54:47 -070093 reboot.cpp \
Elliott Hughesf3cf4382015-02-03 17:12:07 -080094 signal_handler.cpp \
95 ueventd.cpp \
Elliott Hughesf3cf4382015-02-03 17:12:07 -080096 watchdogd.cpp \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080097
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080098LOCAL_MODULE:= init
Andres Moralesdb5f5d42015-05-08 08:30:33 -070099LOCAL_C_INCLUDES += \
Andres Moralesdb5f5d42015-05-08 08:30:33 -0700100 system/core/mkbootimg
101
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800102LOCAL_FORCE_STATIC_EXECUTABLE := true
103LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
104LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED)
105
Kenny Rootb5982bf2012-10-16 23:07:05 -0700106LOCAL_STATIC_LIBRARIES := \
Elliott Hughesf682b472015-02-06 12:19:48 -0800107 libinit \
Yabin Cui1051e102016-06-24 18:28:03 -0700108 libbootloader_message \
Elliott Hughesf682b472015-02-06 12:19:48 -0800109 libfs_mgr \
Sami Tolvanen99e3a922015-05-22 15:43:50 +0100110 libfec \
111 libfec_rs \
Mohamad Ayyash030ef3592015-04-08 17:59:19 -0700112 libsquashfs_utils \
Elliott Hughesf682b472015-02-06 12:19:48 -0800113 liblogwrap \
Alex Deymo705353a2017-01-11 14:03:11 -0800114 libext4_utils \
Bowgo Tsaiaaf70e72017-03-02 00:03:56 +0800115 libcutils \
Jeff Sharkey3b9c83a2016-02-03 14:44:44 -0700116 libbase \
Elliott Hughesf682b472015-02-06 12:19:48 -0800117 libc \
118 libselinux \
William Robertsbd2d9612015-08-04 14:23:04 -0700119 liblog \
Josh Gao47763c32016-08-05 15:47:57 -0700120 libcrypto_utils \
121 libcrypto \
Paul Lawrenceb8c9d272015-03-26 15:49:42 +0000122 libc++_static \
Ed Tam438443e2015-04-13 16:29:05 -0700123 libdl \
Alex Deymob0c39592017-01-11 14:37:50 -0800124 libsparse \
Collin Mullinerf7e79b92016-06-01 21:03:55 +0000125 libz \
Nick Kralevich8adb4d92017-01-03 08:37:54 -0800126 libprocessgroup \
Elliott Hughesf8627ce2017-05-09 17:09:06 -0700127 libavb \
128 libkeyutils \
Stephen Smalleye46f9d52012-01-13 08:48:47 -0500129
Jorge Lucangeli Obes24b29132016-10-27 10:33:03 -0400130# Create symlinks.
Ying Wangdbb78d62014-11-24 15:43:34 -0800131LOCAL_POST_INSTALL_CMD := $(hide) mkdir -p $(TARGET_ROOT_OUT)/sbin; \
132 ln -sf ../init $(TARGET_ROOT_OUT)/sbin/ueventd; \
133 ln -sf ../init $(TARGET_ROOT_OUT)/sbin/watchdogd
Alex Ray18ccc1b2014-03-06 15:07:42 -0800134
Nick Kralevichf90b6532015-08-15 15:24:23 +0000135LOCAL_SANITIZE := integer
Elliott Hughes1115c252015-06-10 22:43:51 -0700136LOCAL_CLANG := true
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800137include $(BUILD_EXECUTABLE)
Elliott Hughesf682b472015-02-06 12:19:48 -0800138
139
Jorge Lucangeli Obes24b29132016-10-27 10:33:03 -0400140# Unit tests.
141# =========================================================
Elliott Hughesf682b472015-02-06 12:19:48 -0800142include $(CLEAR_VARS)
143LOCAL_MODULE := init_tests
144LOCAL_SRC_FILES := \
Tom Cherryc44f6a42017-04-05 15:58:31 -0700145 devices_test.cpp \
Elliott Hughes8d82ea02015-02-06 20:15:18 -0800146 init_parser_test.cpp \
Tom Cherryad54d092017-04-19 16:18:50 -0700147 init_test.cpp \
Elliott Hughesb005d902017-02-22 14:54:15 -0800148 property_service_test.cpp \
Tom Cherry7da54852017-05-01 14:16:41 -0700149 service_test.cpp \
Elliott Hughesf682b472015-02-06 12:19:48 -0800150 util_test.cpp \
151
152LOCAL_SHARED_LIBRARIES += \
Dan Albertc007bc32015-03-16 10:08:46 -0700153 libbase \
Tom Cherry060b74b2017-04-12 14:27:51 -0700154 libcutils \
155 libselinux \
Elliott Hughesf682b472015-02-06 12:19:48 -0800156
157LOCAL_STATIC_LIBRARIES := libinit
Nick Kralevichf90b6532015-08-15 15:24:23 +0000158LOCAL_SANITIZE := integer
Elliott Hughes1115c252015-06-10 22:43:51 -0700159LOCAL_CLANG := true
Tom Cherryad54d092017-04-19 16:18:50 -0700160LOCAL_CPPFLAGS := -Wall -Wextra -Werror -std=gnu++1z
Elliott Hughesf682b472015-02-06 12:19:48 -0800161include $(BUILD_NATIVE_TEST)
Jorge Lucangeli Obes28e980b2016-12-20 16:54:04 -0500162
163
164# Include targets in subdirs.
165# =========================================================
166include $(call all-makefiles-under,$(LOCAL_PATH))