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 += -DALLOW_LOCAL_PROP_OVERRIDE=1 -DALLOW_PERMISSIVE_SELINUX=1
9else
10init_options += -DALLOW_LOCAL_PROP_OVERRIDE=0 -DALLOW_PERMISSIVE_SELINUX=0
11endif
12
13init_options += -DLOG_UEVENTS=0
14
15init_cflags += \
16    $(init_options) \
17    -Wall -Wextra \
18    -Wno-unused-parameter \
19    -Werror \
20
21# --
22
23# If building on Linux, then build unit test for the host.
24ifeq ($(HOST_OS),linux)
25include $(CLEAR_VARS)
26LOCAL_CPPFLAGS := $(init_cflags)
27LOCAL_SRC_FILES:= \
28    parser/tokenizer.cpp \
29
30LOCAL_MODULE := libinit_parser
31LOCAL_CLANG := true
32include $(BUILD_HOST_STATIC_LIBRARY)
33
34include $(CLEAR_VARS)
35LOCAL_MODULE := init_parser_tests
36LOCAL_SRC_FILES := \
37    parser/tokenizer_test.cpp \
38
39LOCAL_STATIC_LIBRARIES := libinit_parser
40LOCAL_CLANG := true
41include $(BUILD_HOST_NATIVE_TEST)
42endif
43
44include $(CLEAR_VARS)
45LOCAL_CPPFLAGS := $(init_cflags)
46LOCAL_SRC_FILES:= \
47    action.cpp \
48    import_parser.cpp \
49    init_parser.cpp \
50    log.cpp \
51    parser.cpp \
52    service.cpp \
53    util.cpp \
54
55LOCAL_STATIC_LIBRARIES := libbase libselinux
56LOCAL_MODULE := libinit
57LOCAL_SANITIZE := integer
58LOCAL_CLANG := true
59include $(BUILD_STATIC_LIBRARY)
60
61include $(CLEAR_VARS)
62LOCAL_CPPFLAGS := $(init_cflags)
63LOCAL_SRC_FILES:= \
64    bootchart.cpp \
65    builtins.cpp \
66    devices.cpp \
67    init.cpp \
68    keychords.cpp \
69    property_service.cpp \
70    signal_handler.cpp \
71    ueventd.cpp \
72    ueventd_parser.cpp \
73    watchdogd.cpp \
74
75LOCAL_MODULE:= init
76LOCAL_C_INCLUDES += \
77    system/extras/ext4_utils \
78    system/core/mkbootimg
79
80LOCAL_FORCE_STATIC_EXECUTABLE := true
81LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
82LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED)
83
84LOCAL_STATIC_LIBRARIES := \
85    libinit \
86    libbootloader_message_writer \
87    libfs_mgr \
88    libfec \
89    libfec_rs \
90    libsquashfs_utils \
91    liblogwrap \
92    libcutils \
93    libext4_utils_static \
94    libbase \
95    libutils \
96    libc \
97    libselinux \
98    liblog \
99    libmincrypt \
100    libcrypto_static \
101    libc++_static \
102    libdl \
103    libsparse_static \
104    libz
105
106# Create symlinks
107LOCAL_POST_INSTALL_CMD := $(hide) mkdir -p $(TARGET_ROOT_OUT)/sbin; \
108    ln -sf ../init $(TARGET_ROOT_OUT)/sbin/ueventd; \
109    ln -sf ../init $(TARGET_ROOT_OUT)/sbin/watchdogd
110
111LOCAL_SANITIZE := integer
112LOCAL_CLANG := true
113include $(BUILD_EXECUTABLE)
114
115
116
117
118include $(CLEAR_VARS)
119LOCAL_MODULE := init_tests
120LOCAL_SRC_FILES := \
121    init_parser_test.cpp \
122    util_test.cpp \
123
124LOCAL_SHARED_LIBRARIES += \
125    libcutils \
126    libbase \
127
128LOCAL_STATIC_LIBRARIES := libinit
129LOCAL_SANITIZE := integer
130LOCAL_CLANG := true
131include $(BUILD_NATIVE_TEST)
132