blob: 1ca88d7c5c1d83abe7d21d71ec8261e12aae7a08 [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
Keun-young Parkc4ffa5c2017-03-28 09:41:36 -070019ifneq (,$(filter eng,$(TARGET_BUILD_VARIANT)))
20init_options += \
21 -DSHUTDOWN_ZERO_TIMEOUT=1
22else
23init_options += \
24 -DSHUTDOWN_ZERO_TIMEOUT=0
25endif
26
Elliott Hughesf682b472015-02-06 12:19:48 -080027init_options += -DLOG_UEVENTS=0
28
29init_cflags += \
30 $(init_options) \
31 -Wall -Wextra \
32 -Wno-unused-parameter \
33 -Werror \
Tom Cherry2bc00142017-03-13 11:58:58 -070034 -std=gnu++1z \
Elliott Hughesc0e919c2015-02-04 14:46:36 -080035
36# --
37
Lee Campbell220ca842015-07-30 09:27:11 -070038# If building on Linux, then build unit test for the host.
39ifeq ($(HOST_OS),linux)
40include $(CLEAR_VARS)
41LOCAL_CPPFLAGS := $(init_cflags)
42LOCAL_SRC_FILES:= \
43 parser/tokenizer.cpp \
44
45LOCAL_MODULE := libinit_parser
46LOCAL_CLANG := true
47include $(BUILD_HOST_STATIC_LIBRARY)
48
49include $(CLEAR_VARS)
50LOCAL_MODULE := init_parser_tests
51LOCAL_SRC_FILES := \
52 parser/tokenizer_test.cpp \
53
James Hawkinsc8ac0672017-02-14 19:20:20 +000054LOCAL_STATIC_LIBRARIES := libinit_parser
Lee Campbell220ca842015-07-30 09:27:11 -070055LOCAL_CLANG := true
56include $(BUILD_HOST_NATIVE_TEST)
57endif
58
Elliott Hughesf682b472015-02-06 12:19:48 -080059include $(CLEAR_VARS)
60LOCAL_CPPFLAGS := $(init_cflags)
61LOCAL_SRC_FILES:= \
Tom Cherryfa0c21c2015-07-23 17:53:11 -070062 action.cpp \
Jorge Lucangeli Obes24b29132016-10-27 10:33:03 -040063 capabilities.cpp \
Mark Salyzyn62767fe2016-10-27 07:45:34 -070064 descriptors.cpp \
Tom Cherryb7349902015-08-26 11:43:36 -070065 import_parser.cpp \
Elliott Hughesf682b472015-02-06 12:19:48 -080066 init_parser.cpp \
Elliott Hughesda40c002015-03-27 23:20:44 -070067 log.cpp \
Elliott Hughesf682b472015-02-06 12:19:48 -080068 parser.cpp \
Tom Cherrybac32992015-07-31 12:45:25 -070069 service.cpp \
Elliott Hughesf682b472015-02-06 12:19:48 -080070 util.cpp \
71
Nick Kralevich8adb4d92017-01-03 08:37:54 -080072LOCAL_STATIC_LIBRARIES := libbase libselinux liblog libprocessgroup libnl
Jorge Lucangeli Obes24b29132016-10-27 10:33:03 -040073LOCAL_WHOLE_STATIC_LIBRARIES := libcap
Elliott Hughesf682b472015-02-06 12:19:48 -080074LOCAL_MODULE := libinit
Nick Kralevichf90b6532015-08-15 15:24:23 +000075LOCAL_SANITIZE := integer
Elliott Hughes1115c252015-06-10 22:43:51 -070076LOCAL_CLANG := true
Elliott Hughesf682b472015-02-06 12:19:48 -080077include $(BUILD_STATIC_LIBRARY)
78
79include $(CLEAR_VARS)
80LOCAL_CPPFLAGS := $(init_cflags)
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080081LOCAL_SRC_FILES:= \
Elliott Hughes24627902015-02-04 10:25:09 -080082 bootchart.cpp \
Elliott Hughesf3cf4382015-02-03 17:12:07 -080083 builtins.cpp \
84 devices.cpp \
85 init.cpp \
Elliott Hughesf3cf4382015-02-03 17:12:07 -080086 keychords.cpp \
Elliott Hughesf3cf4382015-02-03 17:12:07 -080087 property_service.cpp \
Keun-young Park8d01f632017-03-13 11:54:47 -070088 reboot.cpp \
Elliott Hughesf3cf4382015-02-03 17:12:07 -080089 signal_handler.cpp \
90 ueventd.cpp \
91 ueventd_parser.cpp \
Elliott Hughesf3cf4382015-02-03 17:12:07 -080092 watchdogd.cpp \
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080093
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080094LOCAL_MODULE:= init
Andres Moralesdb5f5d42015-05-08 08:30:33 -070095LOCAL_C_INCLUDES += \
Andres Moralesdb5f5d42015-05-08 08:30:33 -070096 system/core/mkbootimg
97
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080098LOCAL_FORCE_STATIC_EXECUTABLE := true
99LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
100LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED)
101
Kenny Rootb5982bf2012-10-16 23:07:05 -0700102LOCAL_STATIC_LIBRARIES := \
Elliott Hughesf682b472015-02-06 12:19:48 -0800103 libinit \
Yabin Cui1051e102016-06-24 18:28:03 -0700104 libbootloader_message \
Elliott Hughesf682b472015-02-06 12:19:48 -0800105 libfs_mgr \
Sami Tolvanen99e3a922015-05-22 15:43:50 +0100106 libfec \
107 libfec_rs \
Mohamad Ayyash030ef3592015-04-08 17:59:19 -0700108 libsquashfs_utils \
Elliott Hughesf682b472015-02-06 12:19:48 -0800109 liblogwrap \
110 libcutils \
Alex Deymo705353a2017-01-11 14:03:11 -0800111 libext4_utils \
Jeff Sharkey3b9c83a2016-02-03 14:44:44 -0700112 libbase \
Elliott Hughesf682b472015-02-06 12:19:48 -0800113 libc \
114 libselinux \
William Robertsbd2d9612015-08-04 14:23:04 -0700115 liblog \
Josh Gao47763c32016-08-05 15:47:57 -0700116 libcrypto_utils \
117 libcrypto \
Paul Lawrenceb8c9d272015-03-26 15:49:42 +0000118 libc++_static \
Ed Tam438443e2015-04-13 16:29:05 -0700119 libdl \
Alex Deymob0c39592017-01-11 14:37:50 -0800120 libsparse \
Collin Mullinerf7e79b92016-06-01 21:03:55 +0000121 libz \
Nick Kralevich8adb4d92017-01-03 08:37:54 -0800122 libprocessgroup \
123 libnl \
bowgotsaib51722b2017-01-11 22:21:38 +0800124 libavb
Stephen Smalleye46f9d52012-01-13 08:48:47 -0500125
Jorge Lucangeli Obes24b29132016-10-27 10:33:03 -0400126# Create symlinks.
Ying Wangdbb78d62014-11-24 15:43:34 -0800127LOCAL_POST_INSTALL_CMD := $(hide) mkdir -p $(TARGET_ROOT_OUT)/sbin; \
128 ln -sf ../init $(TARGET_ROOT_OUT)/sbin/ueventd; \
129 ln -sf ../init $(TARGET_ROOT_OUT)/sbin/watchdogd
Alex Ray18ccc1b2014-03-06 15:07:42 -0800130
Nick Kralevichf90b6532015-08-15 15:24:23 +0000131LOCAL_SANITIZE := integer
Elliott Hughes1115c252015-06-10 22:43:51 -0700132LOCAL_CLANG := true
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -0800133include $(BUILD_EXECUTABLE)
Elliott Hughesf682b472015-02-06 12:19:48 -0800134
135
Jorge Lucangeli Obes24b29132016-10-27 10:33:03 -0400136# Unit tests.
137# =========================================================
Elliott Hughesf682b472015-02-06 12:19:48 -0800138include $(CLEAR_VARS)
139LOCAL_MODULE := init_tests
140LOCAL_SRC_FILES := \
Elliott Hughes8d82ea02015-02-06 20:15:18 -0800141 init_parser_test.cpp \
Elliott Hughesb005d902017-02-22 14:54:15 -0800142 property_service_test.cpp \
Elliott Hughesf682b472015-02-06 12:19:48 -0800143 util_test.cpp \
144
145LOCAL_SHARED_LIBRARIES += \
146 libcutils \
Dan Albertc007bc32015-03-16 10:08:46 -0700147 libbase \
Elliott Hughesf682b472015-02-06 12:19:48 -0800148
149LOCAL_STATIC_LIBRARIES := libinit
Nick Kralevichf90b6532015-08-15 15:24:23 +0000150LOCAL_SANITIZE := integer
Elliott Hughes1115c252015-06-10 22:43:51 -0700151LOCAL_CLANG := true
Mark Salyzyn62767fe2016-10-27 07:45:34 -0700152LOCAL_CPPFLAGS := -Wall -Wextra -Werror
Elliott Hughesf682b472015-02-06 12:19:48 -0800153include $(BUILD_NATIVE_TEST)
Jorge Lucangeli Obes28e980b2016-12-20 16:54:04 -0500154
155
156# Include targets in subdirs.
157# =========================================================
158include $(call all-makefiles-under,$(LOCAL_PATH))