1# Copyright 2005 The Android Open Source Project
2
3LOCAL_PATH:= $(call my-dir)
4
5# --
6
7ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
8init_options += \
9    -DALLOW_LOCAL_PROP_OVERRIDE=1 \
10    -DALLOW_PERMISSIVE_SELINUX=1 \
11    -DREBOOT_BOOTLOADER_ON_PANIC=1 \
12    -DWORLD_WRITABLE_KMSG=1 \
13    -DDUMP_ON_UMOUNT_FAILURE=1
14else
15init_options += \
16    -DALLOW_LOCAL_PROP_OVERRIDE=0 \
17    -DALLOW_PERMISSIVE_SELINUX=0 \
18    -DREBOOT_BOOTLOADER_ON_PANIC=0 \
19    -DWORLD_WRITABLE_KMSG=0 \
20    -DDUMP_ON_UMOUNT_FAILURE=0
21endif
22
23ifneq (,$(filter eng,$(TARGET_BUILD_VARIANT)))
24init_options += \
25    -DSHUTDOWN_ZERO_TIMEOUT=1
26else
27init_options += \
28    -DSHUTDOWN_ZERO_TIMEOUT=0
29endif
30
31init_options += -DLOG_UEVENTS=0
32
33init_cflags += \
34    $(init_options) \
35    -Wall -Wextra \
36    -Wno-unused-parameter \
37    -Werror \
38    -std=gnu++1z \
39
40# --
41
42include $(CLEAR_VARS)
43LOCAL_CPPFLAGS := $(init_cflags)
44LOCAL_SRC_FILES := main.cpp
45
46LOCAL_MODULE:= init
47
48LOCAL_FORCE_STATIC_EXECUTABLE := true
49LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
50LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED)
51
52LOCAL_STATIC_LIBRARIES := \
53    libinit \
54    libbootloader_message \
55    libfs_mgr \
56    libfec \
57    libfec_rs \
58    libhidl-gen-utils \
59    libsquashfs_utils \
60    liblogwrap \
61    libext4_utils \
62    libcutils \
63    libbase \
64    libc \
65    libseccomp_policy \
66    libselinux \
67    liblog \
68    libcrypto_utils \
69    libcrypto \
70    libc++_static \
71    libdl \
72    libsparse \
73    libz \
74    libprocessgroup \
75    libavb \
76    libkeyutils \
77    libprotobuf-cpp-lite \
78    libpropertyinfoserializer \
79    libpropertyinfoparser \
80
81LOCAL_REQUIRED_MODULES := \
82    e2fsdroid \
83    mke2fs \
84    sload_f2fs \
85    make_f2fs \
86
87# Create symlinks.
88LOCAL_POST_INSTALL_CMD := $(hide) mkdir -p $(TARGET_ROOT_OUT)/sbin; \
89    ln -sf ../init $(TARGET_ROOT_OUT)/sbin/ueventd; \
90    ln -sf ../init $(TARGET_ROOT_OUT)/sbin/watchdogd
91
92LOCAL_SANITIZE := signed-integer-overflow
93include $(BUILD_EXECUTABLE)
94