blob: 61c2ec8f1239b504a948ed1d480f71501dea8327 [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 Cherry663fdfc12017-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 \
12 -DWORLD_WRITABLE_KMSG=1
Elliott Hughesc0e919c2015-02-04 14:46:36 -080013else
Tom Cherry663fdfc12017-03-10 14:46:38 -080014init_options += \
15 -DALLOW_LOCAL_PROP_OVERRIDE=0 \
16 -DALLOW_PERMISSIVE_SELINUX=0 \
Josh Gaobf2dd482017-03-28 13:07:15 -070017 -DREBOOT_BOOTLOADER_ON_PANIC=0 \
18 -DWORLD_WRITABLE_KMSG=0
Elliott Hughesc0e919c2015-02-04 14:46:36 -080019endif
20
Keun-young Parkc4ffa5c2017-03-28 09:41:36 -070021ifneq (,$(filter eng,$(TARGET_BUILD_VARIANT)))
22init_options += \
23 -DSHUTDOWN_ZERO_TIMEOUT=1
24else
25init_options += \
26 -DSHUTDOWN_ZERO_TIMEOUT=0
27endif
28
Elliott Hughesf682b472015-02-06 12:19:48 -080029init_options += -DLOG_UEVENTS=0
30
31init_cflags += \
32 $(init_options) \
33 -Wall -Wextra \
34 -Wno-unused-parameter \
35 -Werror \
Tom Cherry2bc00142017-03-13 11:58:58 -070036 -std=gnu++1z \
Elliott Hughesc0e919c2015-02-04 14:46:36 -080037
38# --
39
Lee Campbell220ca842015-07-30 09:27:11 -070040# If building on Linux, then build unit test for the host.
41ifeq ($(HOST_OS),linux)
42include $(CLEAR_VARS)
43LOCAL_CPPFLAGS := $(init_cflags)
44LOCAL_SRC_FILES:= \
45 parser/tokenizer.cpp \
46
47LOCAL_MODULE := libinit_parser
48LOCAL_CLANG := true
49include $(BUILD_HOST_STATIC_LIBRARY)
50
51include $(CLEAR_VARS)
52LOCAL_MODULE := init_parser_tests
53LOCAL_SRC_FILES := \
54 parser/tokenizer_test.cpp \
55
James Hawkinsc8ac0672017-02-14 19:20:20 +000056LOCAL_STATIC_LIBRARIES := libinit_parser
Lee Campbell220ca842015-07-30 09:27:11 -070057LOCAL_CLANG := true
58include $(BUILD_HOST_NATIVE_TEST)
59endif
60
Elliott Hughesf682b472015-02-06 12:19:48 -080061include $(CLEAR_VARS)
62LOCAL_CPPFLAGS := $(init_cflags)
63LOCAL_SRC_FILES:= \
Tom Cherryfa0c21c2015-07-23 17:53:11 -070064 action.cpp \
Jorge Lucangeli Obes24b29132016-10-27 10:33:03 -040065 capabilities.cpp \
Mark Salyzyn62767fe2016-10-27 07:45:34 -070066 descriptors.cpp \
Tom Cherryb7349902015-08-26 11:43:36 -070067 import_parser.cpp \
Elliott Hughesf682b472015-02-06 12:19:48 -080068 init_parser.cpp \
Elliott Hughesda40c002015-03-27 23:20:44 -070069 log.cpp \
Elliott Hughesf682b472015-02-06 12:19:48 -080070 parser.cpp \
Tom Cherrybac32992015-07-31 12:45:25 -070071 service.cpp \
Elliott Hughesf682b472015-02-06 12:19:48 -080072 util.cpp \
73
Nick Kralevich8adb4d92017-01-03 08:37:54 -080074LOCAL_STATIC_LIBRARIES := libbase libselinux liblog libprocessgroup libnl
Jorge Lucangeli Obes24b29132016-10-27 10:33:03 -040075LOCAL_WHOLE_STATIC_LIBRARIES := libcap
Elliott Hughesf682b472015-02-06 12:19:48 -080076LOCAL_MODULE := libinit
Nick Kralevichf90b6532015-08-15 15:24:23 +000077LOCAL_SANITIZE := integer
Elliott Hughes1115c252015-06-10 22:43:51 -070078LOCAL_CLANG := true
Elliott Hughesf682b472015-02-06 12:19:48 -080079include $(BUILD_STATIC_LIBRARY)
80
81include $(CLEAR_VARS)
82LOCAL_CPPFLAGS := $(init_cflags)
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080083LOCAL_SRC_FILES:= \
Elliott Hughes24627902015-02-04 10:25:09 -080084 bootchart.cpp \
Elliott Hughesf3cf4382015-02-03 17:12:07 -080085 builtins.cpp \
86 devices.cpp \
87 init.cpp \
Elliott Hughesf3cf4382015-02-03 17:12:07 -080088 keychords.cpp \
Elliott Hughesf3cf4382015-02-03 17:12:07 -080089 property_service.cpp \
Keun-young Park8d01f632017-03-13 11:54:47 -070090 reboot.cpp \
Elliott Hughesf3cf4382015-02-03 17:12:07 -080091 signal_handler.cpp \
92 ueventd.cpp \
93 ueventd_parser.cpp \
Elliott Hughesf3cf4382015-02-03 17:12:07 -080094 watchdogd.cpp \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080095
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080096LOCAL_MODULE:= init
Andres Moralesdb5f5d42015-05-08 08:30:33 -070097LOCAL_C_INCLUDES += \
Andres Moralesdb5f5d42015-05-08 08:30:33 -070098 system/core/mkbootimg
99
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800100LOCAL_FORCE_STATIC_EXECUTABLE := true
101LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
102LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED)
103
Kenny Rootb5982bf2012-10-16 23:07:05 -0700104LOCAL_STATIC_LIBRARIES := \
Elliott Hughesf682b472015-02-06 12:19:48 -0800105 libinit \
Yabin Cui1051e102016-06-24 18:28:03 -0700106 libbootloader_message \
Elliott Hughesf682b472015-02-06 12:19:48 -0800107 libfs_mgr \
Sami Tolvanen99e3a922015-05-22 15:43:50 +0100108 libfec \
109 libfec_rs \
Mohamad Ayyash030ef3592015-04-08 17:59:19 -0700110 libsquashfs_utils \
Elliott Hughesf682b472015-02-06 12:19:48 -0800111 liblogwrap \
112 libcutils \
Alex Deymo705353a2017-01-11 14:03:11 -0800113 libext4_utils \
Jeff Sharkey3b9c83a2016-02-03 14:44:44 -0700114 libbase \
Elliott Hughesf682b472015-02-06 12:19:48 -0800115 libc \
116 libselinux \
William Robertsbd2d9612015-08-04 14:23:04 -0700117 liblog \
Josh Gao47763c32016-08-05 15:47:57 -0700118 libcrypto_utils \
119 libcrypto \
Paul Lawrenceb8c9d272015-03-26 15:49:42 +0000120 libc++_static \
Ed Tam438443e2015-04-13 16:29:05 -0700121 libdl \
Alex Deymob0c39592017-01-11 14:37:50 -0800122 libsparse \
Collin Mullinerf7e79b92016-06-01 21:03:55 +0000123 libz \
Nick Kralevich8adb4d92017-01-03 08:37:54 -0800124 libprocessgroup \
125 libnl \
bowgotsaib51722b2017-01-11 22:21:38 +0800126 libavb
Stephen Smalleye46f9d52012-01-13 08:48:47 -0500127
Jorge Lucangeli Obes24b29132016-10-27 10:33:03 -0400128# Create symlinks.
Ying Wangdbb78d62014-11-24 15:43:34 -0800129LOCAL_POST_INSTALL_CMD := $(hide) mkdir -p $(TARGET_ROOT_OUT)/sbin; \
130 ln -sf ../init $(TARGET_ROOT_OUT)/sbin/ueventd; \
131 ln -sf ../init $(TARGET_ROOT_OUT)/sbin/watchdogd
Alex Ray18ccc1b2014-03-06 15:07:42 -0800132
Nick Kralevichf90b6532015-08-15 15:24:23 +0000133LOCAL_SANITIZE := integer
Elliott Hughes1115c252015-06-10 22:43:51 -0700134LOCAL_CLANG := true
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800135include $(BUILD_EXECUTABLE)
Elliott Hughesf682b472015-02-06 12:19:48 -0800136
137
Jorge Lucangeli Obes24b29132016-10-27 10:33:03 -0400138# Unit tests.
139# =========================================================
Elliott Hughesf682b472015-02-06 12:19:48 -0800140include $(CLEAR_VARS)
141LOCAL_MODULE := init_tests
142LOCAL_SRC_FILES := \
Elliott Hughes8d82ea02015-02-06 20:15:18 -0800143 init_parser_test.cpp \
Elliott Hughesb005d902017-02-22 14:54:15 -0800144 property_service_test.cpp \
Elliott Hughesf682b472015-02-06 12:19:48 -0800145 util_test.cpp \
146
147LOCAL_SHARED_LIBRARIES += \
148 libcutils \
Dan Albertc007bc32015-03-16 10:08:46 -0700149 libbase \
Elliott Hughesf682b472015-02-06 12:19:48 -0800150
151LOCAL_STATIC_LIBRARIES := libinit
Nick Kralevichf90b6532015-08-15 15:24:23 +0000152LOCAL_SANITIZE := integer
Elliott Hughes1115c252015-06-10 22:43:51 -0700153LOCAL_CLANG := true
Mark Salyzyn62767fe2016-10-27 07:45:34 -0700154LOCAL_CPPFLAGS := -Wall -Wextra -Werror
Elliott Hughesf682b472015-02-06 12:19:48 -0800155include $(BUILD_NATIVE_TEST)
Jorge Lucangeli Obes28e980b2016-12-20 16:54:04 -0500156
157
158# Include targets in subdirs.
159# =========================================================
160include $(call all-makefiles-under,$(LOCAL_PATH))