blob: d48f15232b67f61172bcace526b2e5260f8e2b04 [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 \
11 -DREBOOT_BOOTLOADER_ON_PANIC=1
Elliott Hughesc0e919c2015-02-04 14:46:36 -080012else
Tom Cherry663fdfc2017-03-10 14:46:38 -080013init_options += \
14 -DALLOW_LOCAL_PROP_OVERRIDE=0 \
15 -DALLOW_PERMISSIVE_SELINUX=0 \
16 -DREBOOT_BOOTLOADER_ON_PANIC=0
Elliott Hughesc0e919c2015-02-04 14:46:36 -080017endif
18
Elliott Hughesf682b472015-02-06 12:19:48 -080019init_options += -DLOG_UEVENTS=0
20
21init_cflags += \
22 $(init_options) \
23 -Wall -Wextra \
24 -Wno-unused-parameter \
25 -Werror \
Tom Cherry2bc00142017-03-13 11:58:58 -070026 -std=gnu++1z \
Elliott Hughesc0e919c2015-02-04 14:46:36 -080027
28# --
29
Lee Campbell220ca842015-07-30 09:27:11 -070030# If building on Linux, then build unit test for the host.
31ifeq ($(HOST_OS),linux)
32include $(CLEAR_VARS)
33LOCAL_CPPFLAGS := $(init_cflags)
34LOCAL_SRC_FILES:= \
35 parser/tokenizer.cpp \
36
37LOCAL_MODULE := libinit_parser
38LOCAL_CLANG := true
39include $(BUILD_HOST_STATIC_LIBRARY)
40
41include $(CLEAR_VARS)
42LOCAL_MODULE := init_parser_tests
43LOCAL_SRC_FILES := \
44 parser/tokenizer_test.cpp \
45
James Hawkinsc8ac0672017-02-14 19:20:20 +000046LOCAL_STATIC_LIBRARIES := libinit_parser
Lee Campbell220ca842015-07-30 09:27:11 -070047LOCAL_CLANG := true
48include $(BUILD_HOST_NATIVE_TEST)
49endif
50
Elliott Hughesf682b472015-02-06 12:19:48 -080051include $(CLEAR_VARS)
52LOCAL_CPPFLAGS := $(init_cflags)
53LOCAL_SRC_FILES:= \
Tom Cherryfa0c21c2015-07-23 17:53:11 -070054 action.cpp \
Jorge Lucangeli Obes24b29132016-10-27 10:33:03 -040055 capabilities.cpp \
Mark Salyzyn62767fe2016-10-27 07:45:34 -070056 descriptors.cpp \
Tom Cherryb7349902015-08-26 11:43:36 -070057 import_parser.cpp \
Elliott Hughesf682b472015-02-06 12:19:48 -080058 init_parser.cpp \
Elliott Hughesda40c002015-03-27 23:20:44 -070059 log.cpp \
Elliott Hughesf682b472015-02-06 12:19:48 -080060 parser.cpp \
Tom Cherrybac32992015-07-31 12:45:25 -070061 service.cpp \
Elliott Hughesf682b472015-02-06 12:19:48 -080062 util.cpp \
63
Nick Kralevich8adb4d92017-01-03 08:37:54 -080064LOCAL_STATIC_LIBRARIES := libbase libselinux liblog libprocessgroup libnl
Jorge Lucangeli Obes24b29132016-10-27 10:33:03 -040065LOCAL_WHOLE_STATIC_LIBRARIES := libcap
Elliott Hughesf682b472015-02-06 12:19:48 -080066LOCAL_MODULE := libinit
Nick Kralevichf90b6532015-08-15 15:24:23 +000067LOCAL_SANITIZE := integer
Elliott Hughes1115c252015-06-10 22:43:51 -070068LOCAL_CLANG := true
Elliott Hughesf682b472015-02-06 12:19:48 -080069include $(BUILD_STATIC_LIBRARY)
70
71include $(CLEAR_VARS)
72LOCAL_CPPFLAGS := $(init_cflags)
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080073LOCAL_SRC_FILES:= \
Elliott Hughes24627902015-02-04 10:25:09 -080074 bootchart.cpp \
Elliott Hughesf3cf4382015-02-03 17:12:07 -080075 builtins.cpp \
76 devices.cpp \
77 init.cpp \
Elliott Hughesf3cf4382015-02-03 17:12:07 -080078 keychords.cpp \
Elliott Hughesf3cf4382015-02-03 17:12:07 -080079 property_service.cpp \
80 signal_handler.cpp \
81 ueventd.cpp \
82 ueventd_parser.cpp \
Elliott Hughesf3cf4382015-02-03 17:12:07 -080083 watchdogd.cpp \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080084
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080085LOCAL_MODULE:= init
Andres Moralesdb5f5d42015-05-08 08:30:33 -070086LOCAL_C_INCLUDES += \
Andres Moralesdb5f5d42015-05-08 08:30:33 -070087 system/core/mkbootimg
88
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080089LOCAL_FORCE_STATIC_EXECUTABLE := true
90LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
91LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED)
92
Kenny Rootb5982bf2012-10-16 23:07:05 -070093LOCAL_STATIC_LIBRARIES := \
Elliott Hughesf682b472015-02-06 12:19:48 -080094 libinit \
Yabin Cui1051e102016-06-24 18:28:03 -070095 libbootloader_message \
Elliott Hughesf682b472015-02-06 12:19:48 -080096 libfs_mgr \
Sami Tolvanen99e3a922015-05-22 15:43:50 +010097 libfec \
98 libfec_rs \
Mohamad Ayyash030ef3592015-04-08 17:59:19 -070099 libsquashfs_utils \
Elliott Hughesf682b472015-02-06 12:19:48 -0800100 liblogwrap \
101 libcutils \
Alex Deymo705353a2017-01-11 14:03:11 -0800102 libext4_utils \
Jeff Sharkey3b9c83a2016-02-03 14:44:44 -0700103 libbase \
Elliott Hughesf682b472015-02-06 12:19:48 -0800104 libc \
105 libselinux \
William Robertsbd2d9612015-08-04 14:23:04 -0700106 liblog \
Josh Gao47763c32016-08-05 15:47:57 -0700107 libcrypto_utils \
108 libcrypto \
Paul Lawrenceb8c9d272015-03-26 15:49:42 +0000109 libc++_static \
Ed Tam438443e2015-04-13 16:29:05 -0700110 libdl \
Alex Deymob0c39592017-01-11 14:37:50 -0800111 libsparse \
Collin Mullinerf7e79b92016-06-01 21:03:55 +0000112 libz \
Nick Kralevich8adb4d92017-01-03 08:37:54 -0800113 libprocessgroup \
114 libnl \
bowgotsaib51722b2017-01-11 22:21:38 +0800115 libavb
Stephen Smalleye46f9d52012-01-13 08:48:47 -0500116
Alex Klyubinb51f9ab2017-03-02 12:53:32 -0800117# Include SELinux policy. We do this here because different modules
118# need to be included based on the value of PRODUCT_FULL_TREBLE. This
119# type of conditional inclusion cannot be done in top-level files such
120# as build/target/product/embedded.mk.
121# This conditional inclusion closely mimics the conditional logic
122# inside init/init.cpp for loading SELinux policy from files.
123ifeq ($(PRODUCT_FULL_TREBLE),true)
124# Use split SELinux policy
125LOCAL_REQUIRED_MODULES += \
126 mapping_sepolicy.cil \
127 nonplat_sepolicy.cil \
128 plat_sepolicy.cil \
Alex Klyubin2d19aeb2017-03-07 14:12:01 -0800129 plat_sepolicy.cil.sha256 \
Jeff Vander Stoep0cbbb832017-03-08 15:17:21 -0800130 secilc \
131 nonplat_file_contexts \
132 plat_file_contexts
Alex Klyubin2d19aeb2017-03-07 14:12:01 -0800133
134# Include precompiled policy, unless told otherwise
135ifneq ($(PRODUCT_PRECOMPILED_SEPOLICY),false)
136LOCAL_REQUIRED_MODULES += precompiled_sepolicy precompiled_sepolicy.plat.sha256
137endif
138
Alex Klyubinb51f9ab2017-03-02 12:53:32 -0800139else
140# Use monolithic SELinux policy
Jeff Vander Stoep0cbbb832017-03-08 15:17:21 -0800141LOCAL_REQUIRED_MODULES += sepolicy \
142 file_contexts.bin
Alex Klyubinb51f9ab2017-03-02 12:53:32 -0800143endif
144
Jorge Lucangeli Obes24b29132016-10-27 10:33:03 -0400145# Create symlinks.
Ying Wangdbb78d62014-11-24 15:43:34 -0800146LOCAL_POST_INSTALL_CMD := $(hide) mkdir -p $(TARGET_ROOT_OUT)/sbin; \
147 ln -sf ../init $(TARGET_ROOT_OUT)/sbin/ueventd; \
148 ln -sf ../init $(TARGET_ROOT_OUT)/sbin/watchdogd
Alex Ray18ccc1b2014-03-06 15:07:42 -0800149
Nick Kralevichf90b6532015-08-15 15:24:23 +0000150LOCAL_SANITIZE := integer
Elliott Hughes1115c252015-06-10 22:43:51 -0700151LOCAL_CLANG := true
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800152include $(BUILD_EXECUTABLE)
Elliott Hughesf682b472015-02-06 12:19:48 -0800153
154
Jorge Lucangeli Obes24b29132016-10-27 10:33:03 -0400155# Unit tests.
156# =========================================================
Elliott Hughesf682b472015-02-06 12:19:48 -0800157include $(CLEAR_VARS)
158LOCAL_MODULE := init_tests
159LOCAL_SRC_FILES := \
Elliott Hughes8d82ea02015-02-06 20:15:18 -0800160 init_parser_test.cpp \
Elliott Hughesb005d902017-02-22 14:54:15 -0800161 property_service_test.cpp \
Elliott Hughesf682b472015-02-06 12:19:48 -0800162 util_test.cpp \
163
164LOCAL_SHARED_LIBRARIES += \
165 libcutils \
Dan Albertc007bc32015-03-16 10:08:46 -0700166 libbase \
Elliott Hughesf682b472015-02-06 12:19:48 -0800167
168LOCAL_STATIC_LIBRARIES := libinit
Nick Kralevichf90b6532015-08-15 15:24:23 +0000169LOCAL_SANITIZE := integer
Elliott Hughes1115c252015-06-10 22:43:51 -0700170LOCAL_CLANG := true
Mark Salyzyn62767fe2016-10-27 07:45:34 -0700171LOCAL_CPPFLAGS := -Wall -Wextra -Werror
Elliott Hughesf682b472015-02-06 12:19:48 -0800172include $(BUILD_NATIVE_TEST)
Jorge Lucangeli Obes28e980b2016-12-20 16:54:04 -0500173
174
175# Include targets in subdirs.
176# =========================================================
177include $(call all-makefiles-under,$(LOCAL_PATH))