summaryrefslogtreecommitdiffstats
path: root/init/Android.mk
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-02-06 12:19:48 -0800
committerElliott Hughes <enh@google.com>2015-02-06 14:20:30 -0800
commitf682b4786a4093efb23bf80d69bf80eb274b145b (patch)
tree8af209a035867fd30720e6e6da1b8b581aab871d /init/Android.mk
parentd558530ba90cb6218fe8e255c71a034c3fe1ea58 (diff)
downloadsystem_core-f682b4786a4093efb23bf80d69bf80eb274b145b.zip
system_core-f682b4786a4093efb23bf80d69bf80eb274b145b.tar.gz
system_core-f682b4786a4093efb23bf80d69bf80eb274b145b.tar.bz2
Clean up reading and writing in init.
This isn't particularly useful in and of itself, but it does introduce the first (trivial) unit test, improves the documentation (including details about how to debug init crashes), and made me aware of how unpleasant the existing parser is. I also fixed a bug in passing --- unless you thought the "peboot" and "pm" commands were features... Bug: 19217569 Change-Id: I6ab76129a543ce3ed3dab52ef2c638009874c3de
Diffstat (limited to 'init/Android.mk')
-rw-r--r--init/Android.mk72
1 files changed, 48 insertions, 24 deletions
diff --git a/init/Android.mk b/init/Android.mk
index bf8dea5..7f3788a 100644
--- a/init/Android.mk
+++ b/init/Android.mk
@@ -1,48 +1,55 @@
# Copyright 2005 The Android Open Source Project
LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
# --
ifeq ($(strip $(INIT_BOOTCHART)),true)
-LOCAL_CPPFLAGS += -DBOOTCHART=1
+init_options += -DBOOTCHART=1
else
-LOCAL_CPPFLAGS += -DBOOTCHART=0
+init_options += -DBOOTCHART=0
endif
ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
-LOCAL_CPPFLAGS += -DALLOW_LOCAL_PROP_OVERRIDE=1 -DALLOW_DISABLE_SELINUX=1
+init_options += -DALLOW_LOCAL_PROP_OVERRIDE=1 -DALLOW_DISABLE_SELINUX=1
else
-LOCAL_CPPFLAGS += -DALLOW_LOCAL_PROP_OVERRIDE=0 -DALLOW_DISABLE_SELINUX=0
+init_options += -DALLOW_LOCAL_PROP_OVERRIDE=0 -DALLOW_DISABLE_SELINUX=0
endif
-LOCAL_CPPFLAGS += -DLOG_UEVENTS=0
+init_options += -DLOG_UEVENTS=0
+
+init_cflags += \
+ $(init_options) \
+ -Wall -Wextra \
+ -Wno-unused-parameter \
+ -Werror \
# --
+include $(CLEAR_VARS)
+LOCAL_CPPFLAGS := $(init_cflags)
+LOCAL_SRC_FILES:= \
+ init_parser.cpp \
+ parser.cpp \
+ util.cpp \
+
+LOCAL_MODULE := libinit
+include $(BUILD_STATIC_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_CPPFLAGS := $(init_cflags)
LOCAL_SRC_FILES:= \
bootchart.cpp \
builtins.cpp \
devices.cpp \
init.cpp \
- init_parser.cpp \
keychords.cpp \
- parser.cpp \
property_service.cpp \
signal_handler.cpp \
ueventd.cpp \
ueventd_parser.cpp \
- util.cpp \
watchdogd.cpp \
-#LOCAL_CLANG := true
-
-LOCAL_CPPFLAGS += \
- -Wall -Wextra \
- -Werror -Wno-error=deprecated-declarations \
- -Wno-unused-parameter \
-
LOCAL_MODULE:= init
LOCAL_FORCE_STATIC_EXECUTABLE := true
@@ -50,14 +57,16 @@ LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED)
LOCAL_STATIC_LIBRARIES := \
- libfs_mgr \
- liblogwrap \
- libcutils \
- liblog \
- libc \
- libselinux \
- libmincrypt \
- libext4_utils_static
+ libinit \
+ libfs_mgr \
+ liblogwrap \
+ libcutils \
+ libutils \
+ liblog \
+ libc \
+ libselinux \
+ libmincrypt \
+ libext4_utils_static
# Create symlinks
LOCAL_POST_INSTALL_CMD := $(hide) mkdir -p $(TARGET_ROOT_OUT)/sbin; \
@@ -65,3 +74,18 @@ LOCAL_POST_INSTALL_CMD := $(hide) mkdir -p $(TARGET_ROOT_OUT)/sbin; \
ln -sf ../init $(TARGET_ROOT_OUT)/sbin/watchdogd
include $(BUILD_EXECUTABLE)
+
+
+
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := init_tests
+LOCAL_SRC_FILES := \
+ util_test.cpp \
+
+LOCAL_SHARED_LIBRARIES += \
+ libcutils \
+ libutils \
+
+LOCAL_STATIC_LIBRARIES := libinit
+include $(BUILD_NATIVE_TEST)