• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# Copyright (C) 2015 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17LOCAL_PATH := $(call my-dir)
18
19nativepowerman_CommonCFlags := -Wall -Werror -Wno-unused-parameter
20nativepowerman_CommonCFlags += -Wno-sign-promo  # for libchrome
21nativepowerman_CommonCIncludes := \
22  $(LOCAL_PATH)/../include \
23  external/gtest/include \
24
25nativepowerman_CommonSharedLibraries := \
26  libbinder \
27  libbinderwrapper \
28  libchrome \
29  libcutils \
30  libpowermanager \
31  libutils \
32
33# nativepowerman executable
34# ========================================================
35
36include $(CLEAR_VARS)
37# "nativepowermanager" would probably be a better name, but Android service
38# names are limited to 16 characters.
39LOCAL_MODULE := nativepowerman
40LOCAL_REQUIRED_MODULES := nativepowerman.rc
41LOCAL_CPP_EXTENSION := .cc
42LOCAL_CFLAGS := $(nativepowerman_CommonCFlags)
43LOCAL_STATIC_LIBRARIES := libnativepowerman
44LOCAL_SHARED_LIBRARIES := \
45  $(nativepowerman_CommonSharedLibraries) \
46  libbrillo \
47  libbrillo-binder \
48
49LOCAL_SRC_FILES := main.cc
50
51include $(BUILD_EXECUTABLE)
52
53# nativepowerman.rc script
54# ========================================================
55
56ifdef INITRC_TEMPLATE
57include $(CLEAR_VARS)
58LOCAL_MODULE := nativepowerman.rc
59LOCAL_MODULE_CLASS := ETC
60LOCAL_MODULE_PATH := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_INITRCD)
61
62include $(BUILD_SYSTEM)/base_rules.mk
63
64$(LOCAL_BUILT_MODULE): $(INITRC_TEMPLATE)
65	$(call generate-initrc-file,nativepowerman,,wakelock)
66endif
67
68# libnativepowerman client library (for daemon and tests)
69# ========================================================
70
71include $(CLEAR_VARS)
72LOCAL_MODULE := libnativepowerman
73LOCAL_CPP_EXTENSION := .cc
74LOCAL_CFLAGS := $(nativepowerman_CommonCFlags)
75LOCAL_C_INCLUDES := $(nativepowerman_CommonCIncludes)
76LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/../include
77LOCAL_SHARED_LIBRARIES := \
78  $(nativepowerman_CommonSharedLibraries) \
79  libbrillo \
80
81LOCAL_SRC_FILES := \
82  BnPowerManager.cc \
83  power_manager.cc \
84  system_property_setter.cc \
85  wake_lock_manager.cc \
86
87include $(BUILD_STATIC_LIBRARY)
88
89# nativepowerman_tests executable
90# ========================================================
91
92include $(CLEAR_VARS)
93LOCAL_MODULE := nativepowerman_tests
94ifdef BRILLO
95  LOCAL_MODULE_TAGS := eng
96endif
97LOCAL_CPP_EXTENSION := .cc
98LOCAL_CFLAGS := $(nativepowerman_CommonCFlags)
99LOCAL_STATIC_LIBRARIES := libnativepowerman libgtest libBionicGtestMain
100LOCAL_SHARED_LIBRARIES := \
101  $(nativepowerman_CommonSharedLibraries) \
102  libbinderwrapper_test_support \
103  libnativepower_test_support \
104
105LOCAL_SRC_FILES := \
106  power_manager_unittest.cc \
107  system_property_setter_stub.cc \
108  wake_lock_manager_unittest.cc \
109
110include $(BUILD_NATIVE_TEST)
111
112# libnativepower_test_support shared library
113# ========================================================
114
115include $(CLEAR_VARS)
116LOCAL_MODULE := libnativepower_test_support
117LOCAL_CPP_EXTENSION := .cc
118LOCAL_CFLAGS := $(nativepowerman_CommonCFlags)
119LOCAL_C_INCLUDES := $(nativepowerman_CommonCIncludes)
120LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/../include
121LOCAL_SHARED_LIBRARIES := $(nativepowerman_CommonSharedLibraries)
122LOCAL_SRC_FILES := \
123  BnPowerManager.cc \
124  power_manager_stub.cc \
125  wake_lock_manager.cc \
126  wake_lock_manager_stub.cc \
127
128include $(BUILD_SHARED_LIBRARY)
129