blob: 2a1ad9cdba9c2bc754935f5aef97c40afb46b4bd [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)))
Nick Kralevichd34e4072015-04-28 12:39:41 -07008init_options += -DALLOW_LOCAL_PROP_OVERRIDE=1 -DALLOW_PERMISSIVE_SELINUX=1
Elliott Hughesc0e919c2015-02-04 14:46:36 -08009else
Nick Kralevichd34e4072015-04-28 12:39:41 -070010init_options += -DALLOW_LOCAL_PROP_OVERRIDE=0 -DALLOW_PERMISSIVE_SELINUX=0
Elliott Hughesc0e919c2015-02-04 14:46:36 -080011endif
12
Elliott Hughesf682b472015-02-06 12:19:48 -080013init_options += -DLOG_UEVENTS=0
14
15init_cflags += \
16 $(init_options) \
17 -Wall -Wextra \
18 -Wno-unused-parameter \
19 -Werror \
Tom Cherry2bc00142017-03-13 11:58:58 -070020 -std=gnu++1z \
Elliott Hughesc0e919c2015-02-04 14:46:36 -080021
22# --
23
Lee Campbell220ca842015-07-30 09:27:11 -070024# If building on Linux, then build unit test for the host.
25ifeq ($(HOST_OS),linux)
26include $(CLEAR_VARS)
27LOCAL_CPPFLAGS := $(init_cflags)
28LOCAL_SRC_FILES:= \
29 parser/tokenizer.cpp \
30
31LOCAL_MODULE := libinit_parser
32LOCAL_CLANG := true
33include $(BUILD_HOST_STATIC_LIBRARY)
34
35include $(CLEAR_VARS)
36LOCAL_MODULE := init_parser_tests
37LOCAL_SRC_FILES := \
38 parser/tokenizer_test.cpp \
39
James Hawkinsc8ac0672017-02-14 19:20:20 +000040LOCAL_STATIC_LIBRARIES := libinit_parser
Lee Campbell220ca842015-07-30 09:27:11 -070041LOCAL_CLANG := true
42include $(BUILD_HOST_NATIVE_TEST)
43endif
44
Elliott Hughesf682b472015-02-06 12:19:48 -080045include $(CLEAR_VARS)
46LOCAL_CPPFLAGS := $(init_cflags)
47LOCAL_SRC_FILES:= \
Tom Cherryfa0c21c2015-07-23 17:53:11 -070048 action.cpp \
Jorge Lucangeli Obes24b29132016-10-27 10:33:03 -040049 capabilities.cpp \
Mark Salyzyn62767fe2016-10-27 07:45:34 -070050 descriptors.cpp \
Tom Cherryb7349902015-08-26 11:43:36 -070051 import_parser.cpp \
Elliott Hughesf682b472015-02-06 12:19:48 -080052 init_parser.cpp \
Elliott Hughesda40c002015-03-27 23:20:44 -070053 log.cpp \
Elliott Hughesf682b472015-02-06 12:19:48 -080054 parser.cpp \
Tom Cherrybac32992015-07-31 12:45:25 -070055 service.cpp \
Elliott Hughesf682b472015-02-06 12:19:48 -080056 util.cpp \
57
Nick Kralevich8adb4d92017-01-03 08:37:54 -080058LOCAL_STATIC_LIBRARIES := libbase libselinux liblog libprocessgroup libnl
Jorge Lucangeli Obes24b29132016-10-27 10:33:03 -040059LOCAL_WHOLE_STATIC_LIBRARIES := libcap
Elliott Hughesf682b472015-02-06 12:19:48 -080060LOCAL_MODULE := libinit
Nick Kralevichf90b6532015-08-15 15:24:23 +000061LOCAL_SANITIZE := integer
Elliott Hughes1115c252015-06-10 22:43:51 -070062LOCAL_CLANG := true
Elliott Hughesf682b472015-02-06 12:19:48 -080063include $(BUILD_STATIC_LIBRARY)
64
65include $(CLEAR_VARS)
66LOCAL_CPPFLAGS := $(init_cflags)
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080067LOCAL_SRC_FILES:= \
Elliott Hughes24627902015-02-04 10:25:09 -080068 bootchart.cpp \
Elliott Hughesf3cf4382015-02-03 17:12:07 -080069 builtins.cpp \
70 devices.cpp \
71 init.cpp \
Elliott Hughesf3cf4382015-02-03 17:12:07 -080072 keychords.cpp \
Elliott Hughesf3cf4382015-02-03 17:12:07 -080073 property_service.cpp \
74 signal_handler.cpp \
75 ueventd.cpp \
76 ueventd_parser.cpp \
Elliott Hughesf3cf4382015-02-03 17:12:07 -080077 watchdogd.cpp \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080078
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080079LOCAL_MODULE:= init
Andres Moralesdb5f5d42015-05-08 08:30:33 -070080LOCAL_C_INCLUDES += \
Andres Moralesdb5f5d42015-05-08 08:30:33 -070081 system/core/mkbootimg
82
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080083LOCAL_FORCE_STATIC_EXECUTABLE := true
84LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
85LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED)
86
Kenny Rootb5982bf2012-10-16 23:07:05 -070087LOCAL_STATIC_LIBRARIES := \
Elliott Hughesf682b472015-02-06 12:19:48 -080088 libinit \
Yabin Cui1051e102016-06-24 18:28:03 -070089 libbootloader_message \
Elliott Hughesf682b472015-02-06 12:19:48 -080090 libfs_mgr \
Sami Tolvanen99e3a922015-05-22 15:43:50 +010091 libfec \
92 libfec_rs \
Mohamad Ayyash030ef3592015-04-08 17:59:19 -070093 libsquashfs_utils \
Elliott Hughesf682b472015-02-06 12:19:48 -080094 liblogwrap \
95 libcutils \
Alex Deymo705353a2017-01-11 14:03:11 -080096 libext4_utils \
Jeff Sharkey3b9c83a2016-02-03 14:44:44 -070097 libbase \
Elliott Hughesf682b472015-02-06 12:19:48 -080098 libc \
99 libselinux \
William Robertsbd2d9612015-08-04 14:23:04 -0700100 liblog \
Josh Gao47763c32016-08-05 15:47:57 -0700101 libcrypto_utils \
102 libcrypto \
Paul Lawrenceb8c9d272015-03-26 15:49:42 +0000103 libc++_static \
Ed Tam438443e2015-04-13 16:29:05 -0700104 libdl \
Alex Deymob0c39592017-01-11 14:37:50 -0800105 libsparse \
Collin Mullinerf7e79b92016-06-01 21:03:55 +0000106 libz \
Nick Kralevich8adb4d92017-01-03 08:37:54 -0800107 libprocessgroup \
108 libnl \
bowgotsaib51722b2017-01-11 22:21:38 +0800109 libavb
Stephen Smalleye46f9d52012-01-13 08:48:47 -0500110
Alex Klyubinb51f9ab2017-03-02 12:53:32 -0800111# 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.
117ifeq ($(PRODUCT_FULL_TREBLE),true)
118# Use split SELinux policy
119LOCAL_REQUIRED_MODULES += \
120 mapping_sepolicy.cil \
121 nonplat_sepolicy.cil \
122 plat_sepolicy.cil \
Alex Klyubin2d19aeb2017-03-07 14:12:01 -0800123 plat_sepolicy.cil.sha256 \
Jeff Vander Stoep0cbbb832017-03-08 15:17:21 -0800124 secilc \
125 nonplat_file_contexts \
126 plat_file_contexts
Alex Klyubin2d19aeb2017-03-07 14:12:01 -0800127
128# Include precompiled policy, unless told otherwise
129ifneq ($(PRODUCT_PRECOMPILED_SEPOLICY),false)
130LOCAL_REQUIRED_MODULES += precompiled_sepolicy precompiled_sepolicy.plat.sha256
131endif
132
Alex Klyubinb51f9ab2017-03-02 12:53:32 -0800133else
134# Use monolithic SELinux policy
Jeff Vander Stoep0cbbb832017-03-08 15:17:21 -0800135LOCAL_REQUIRED_MODULES += sepolicy \
136 file_contexts.bin
Alex Klyubinb51f9ab2017-03-02 12:53:32 -0800137endif
138
Jorge Lucangeli Obes24b29132016-10-27 10:33:03 -0400139# Create symlinks.
Ying Wangdbb78d62014-11-24 15:43:34 -0800140LOCAL_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 Ray18ccc1b2014-03-06 15:07:42 -0800143
Nick Kralevichf90b6532015-08-15 15:24:23 +0000144LOCAL_SANITIZE := integer
Elliott Hughes1115c252015-06-10 22:43:51 -0700145LOCAL_CLANG := true
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800146include $(BUILD_EXECUTABLE)
Elliott Hughesf682b472015-02-06 12:19:48 -0800147
148
Jorge Lucangeli Obes24b29132016-10-27 10:33:03 -0400149# Unit tests.
150# =========================================================
Elliott Hughesf682b472015-02-06 12:19:48 -0800151include $(CLEAR_VARS)
152LOCAL_MODULE := init_tests
153LOCAL_SRC_FILES := \
Elliott Hughes8d82ea02015-02-06 20:15:18 -0800154 init_parser_test.cpp \
Elliott Hughesb005d902017-02-22 14:54:15 -0800155 property_service_test.cpp \
Elliott Hughesf682b472015-02-06 12:19:48 -0800156 util_test.cpp \
157
158LOCAL_SHARED_LIBRARIES += \
159 libcutils \
Dan Albertc007bc32015-03-16 10:08:46 -0700160 libbase \
Elliott Hughesf682b472015-02-06 12:19:48 -0800161
162LOCAL_STATIC_LIBRARIES := libinit
Nick Kralevichf90b6532015-08-15 15:24:23 +0000163LOCAL_SANITIZE := integer
Elliott Hughes1115c252015-06-10 22:43:51 -0700164LOCAL_CLANG := true
Mark Salyzyn62767fe2016-10-27 07:45:34 -0700165LOCAL_CPPFLAGS := -Wall -Wextra -Werror
Elliott Hughesf682b472015-02-06 12:19:48 -0800166include $(BUILD_NATIVE_TEST)
Jorge Lucangeli Obes28e980b2016-12-20 16:54:04 -0500167
168
169# Include targets in subdirs.
170# =========================================================
171include $(call all-makefiles-under,$(LOCAL_PATH))