blob: c82a19e26a66af468cf7c939f283a43930ad0e71 [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 \
Keun-young Park8d01f632017-03-13 11:54:47 -070080 reboot.cpp \
Elliott Hughesf3cf4382015-02-03 17:12:07 -080081 signal_handler.cpp \
82 ueventd.cpp \
83 ueventd_parser.cpp \
Elliott Hughesf3cf4382015-02-03 17:12:07 -080084 watchdogd.cpp \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080085
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080086LOCAL_MODULE:= init
Andres Moralesdb5f5d42015-05-08 08:30:33 -070087LOCAL_C_INCLUDES += \
Andres Moralesdb5f5d42015-05-08 08:30:33 -070088 system/core/mkbootimg
89
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080090LOCAL_FORCE_STATIC_EXECUTABLE := true
91LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
92LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED)
93
Kenny Rootb5982bf2012-10-16 23:07:05 -070094LOCAL_STATIC_LIBRARIES := \
Elliott Hughesf682b472015-02-06 12:19:48 -080095 libinit \
Yabin Cui1051e102016-06-24 18:28:03 -070096 libbootloader_message \
Elliott Hughesf682b472015-02-06 12:19:48 -080097 libfs_mgr \
Sami Tolvanen99e3a922015-05-22 15:43:50 +010098 libfec \
99 libfec_rs \
Mohamad Ayyash030ef3592015-04-08 17:59:19 -0700100 libsquashfs_utils \
Elliott Hughesf682b472015-02-06 12:19:48 -0800101 liblogwrap \
102 libcutils \
Alex Deymo705353a2017-01-11 14:03:11 -0800103 libext4_utils \
Jeff Sharkey3b9c83a2016-02-03 14:44:44 -0700104 libbase \
Elliott Hughesf682b472015-02-06 12:19:48 -0800105 libc \
106 libselinux \
William Robertsbd2d9612015-08-04 14:23:04 -0700107 liblog \
Josh Gao47763c32016-08-05 15:47:57 -0700108 libcrypto_utils \
109 libcrypto \
Paul Lawrenceb8c9d272015-03-26 15:49:42 +0000110 libc++_static \
Ed Tam438443e2015-04-13 16:29:05 -0700111 libdl \
Alex Deymob0c39592017-01-11 14:37:50 -0800112 libsparse \
Collin Mullinerf7e79b92016-06-01 21:03:55 +0000113 libz \
Nick Kralevich8adb4d92017-01-03 08:37:54 -0800114 libprocessgroup \
115 libnl \
bowgotsaib51722b2017-01-11 22:21:38 +0800116 libavb
Stephen Smalleye46f9d52012-01-13 08:48:47 -0500117
Alex Klyubinb51f9ab2017-03-02 12:53:32 -0800118# 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.
124ifeq ($(PRODUCT_FULL_TREBLE),true)
125# Use split SELinux policy
126LOCAL_REQUIRED_MODULES += \
127 mapping_sepolicy.cil \
128 nonplat_sepolicy.cil \
129 plat_sepolicy.cil \
Alex Klyubin2d19aeb2017-03-07 14:12:01 -0800130 plat_sepolicy.cil.sha256 \
Jeff Vander Stoep0cbbb832017-03-08 15:17:21 -0800131 secilc \
132 nonplat_file_contexts \
133 plat_file_contexts
Alex Klyubin2d19aeb2017-03-07 14:12:01 -0800134
135# Include precompiled policy, unless told otherwise
136ifneq ($(PRODUCT_PRECOMPILED_SEPOLICY),false)
137LOCAL_REQUIRED_MODULES += precompiled_sepolicy precompiled_sepolicy.plat.sha256
138endif
139
Alex Klyubinb51f9ab2017-03-02 12:53:32 -0800140else
141# Use monolithic SELinux policy
Jeff Vander Stoep0cbbb832017-03-08 15:17:21 -0800142LOCAL_REQUIRED_MODULES += sepolicy \
143 file_contexts.bin
Alex Klyubinb51f9ab2017-03-02 12:53:32 -0800144endif
145
Jorge Lucangeli Obes24b29132016-10-27 10:33:03 -0400146# Create symlinks.
Ying Wangdbb78d62014-11-24 15:43:34 -0800147LOCAL_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 Ray18ccc1b2014-03-06 15:07:42 -0800150
Nick Kralevichf90b6532015-08-15 15:24:23 +0000151LOCAL_SANITIZE := integer
Elliott Hughes1115c252015-06-10 22:43:51 -0700152LOCAL_CLANG := true
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800153include $(BUILD_EXECUTABLE)
Elliott Hughesf682b472015-02-06 12:19:48 -0800154
155
Jorge Lucangeli Obes24b29132016-10-27 10:33:03 -0400156# Unit tests.
157# =========================================================
Elliott Hughesf682b472015-02-06 12:19:48 -0800158include $(CLEAR_VARS)
159LOCAL_MODULE := init_tests
160LOCAL_SRC_FILES := \
Elliott Hughes8d82ea02015-02-06 20:15:18 -0800161 init_parser_test.cpp \
Elliott Hughesb005d902017-02-22 14:54:15 -0800162 property_service_test.cpp \
Elliott Hughesf682b472015-02-06 12:19:48 -0800163 util_test.cpp \
164
165LOCAL_SHARED_LIBRARIES += \
166 libcutils \
Dan Albertc007bc32015-03-16 10:08:46 -0700167 libbase \
Elliott Hughesf682b472015-02-06 12:19:48 -0800168
169LOCAL_STATIC_LIBRARIES := libinit
Nick Kralevichf90b6532015-08-15 15:24:23 +0000170LOCAL_SANITIZE := integer
Elliott Hughes1115c252015-06-10 22:43:51 -0700171LOCAL_CLANG := true
Mark Salyzyn62767fe2016-10-27 07:45:34 -0700172LOCAL_CPPFLAGS := -Wall -Wextra -Werror
Elliott Hughesf682b472015-02-06 12:19:48 -0800173include $(BUILD_NATIVE_TEST)
Jorge Lucangeli Obes28e980b2016-12-20 16:54:04 -0500174
175
176# Include targets in subdirs.
177# =========================================================
178include $(call all-makefiles-under,$(LOCAL_PATH))