1# Copyright (C) 2008 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14# Modified 2011 by InvenSense, Inc
15
16LOCAL_PATH := $(call my-dir)
17
18# Too many benign warnings to be fixed later.
19my_ignored_clang_warnings := \
20    -Wno-unused-private-field \
21    -Wno-gnu-designator
22
23# InvenSense fragment of the HAL
24include $(CLEAR_VARS)
25
26LOCAL_CLANG_CFLAGS += $(my_ignored_clang_warnings)
27LOCAL_MODULE := libinvensense_hal
28LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
29LOCAL_LICENSE_CONDITIONS := notice
30LOCAL_MODULE_TAGS := optional
31LOCAL_MODULE_OWNER := invensense
32
33LOCAL_CFLAGS := -DLOG_TAG=\"Sensors\" -Werror -Wall
34LOCAL_CFLAGS += -Wno-unused-parameter
35
36# ANDROID version check
37MAJOR_VERSION :=$(shell echo $(PLATFORM_VERSION) | cut -f1 -d.)
38MINOR_VERSION :=$(shell echo $(PLATFORM_VERSION) | cut -f2 -d.)
39VERSION_JB :=$(shell test $(MAJOR_VERSION) -gt 4 -o $(MAJOR_VERSION) -eq 4 -a $(MINOR_VERSION) -gt 0 && echo true)
40#ANDROID version check END
41VERSION_JB:=true
42ifeq ($(VERSION_JB),true)
43LOCAL_CFLAGS += -DANDROID_JELLYBEAN
44endif
45
46ifneq (,$(filter $(TARGET_BUILD_VARIANT),eng userdebug))
47ifneq ($(COMPILE_INVENSENSE_COMPASS_CAL),0)
48LOCAL_CFLAGS += -DINVENSENSE_COMPASS_CAL
49endif
50ifeq ($(COMPILE_THIRD_PARTY_ACCEL),1)
51LOCAL_CFLAGS += -DTHIRD_PARTY_ACCEL
52endif
53else # release builds, default
54LOCAL_CFLAGS += -DINVENSENSE_COMPASS_CAL
55endif
56
57LOCAL_SRC_FILES += SensorBase.cpp
58LOCAL_SRC_FILES += MPLSensor.cpp
59LOCAL_SRC_FILES += MPLSupport.cpp
60LOCAL_SRC_FILES += InputEventReader.cpp
61LOCAL_SRC_FILES += PressureSensor.IIO.secondary.cpp
62
63ifneq (,$(filter $(TARGET_BUILD_VARIANT),eng userdebug))
64ifeq ($(COMPILE_INVENSENSE_COMPASS_CAL),0)
65LOCAL_SRC_FILES += AkmSensor.cpp
66LOCAL_SRC_FILES += CompassSensor.AKM.cpp
67else ifeq ($(COMPILE_INVENSENSE_SENSOR_ON_PRIMARY_BUS), 1)
68LOCAL_SRC_FILES += CompassSensor.IIO.primary.cpp
69LOCAL_CFLAGS += -DSENSOR_ON_PRIMARY_BUS
70else
71LOCAL_SRC_FILES += CompassSensor.IIO.9150.cpp
72endif
73else # release builds, default
74LOCAL_SRC_FILES += CompassSensor.IIO.9150.cpp
75endif #userdebug
76
77LOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/mllite
78LOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/mllite/linux
79LOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/driver/include
80LOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/driver/include/linux
81
82LOCAL_SHARED_LIBRARIES := liblog
83LOCAL_SHARED_LIBRARIES += libcutils
84LOCAL_SHARED_LIBRARIES += libutils
85LOCAL_SHARED_LIBRARIES += libdl
86LOCAL_SHARED_LIBRARIES += libmllite
87
88# Additions for SysPed
89LOCAL_SHARED_LIBRARIES += libmplmpu
90LOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/mpl
91LOCAL_CPPFLAGS += -DLINUX=1
92
93LOCAL_SHARED_LIBRARIES += libmllite
94LOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/mllite
95LOCAL_CPPFLAGS += -DLINUX=1
96
97include $(BUILD_SHARED_LIBRARY)
98
99# Build a temporary HAL that links the InvenSense .so
100include $(CLEAR_VARS)
101
102LOCAL_CLANG_CFLAGS += $(my_ignored_clang_warnings)
103ifneq ($(filter dory guppy guppypdk, $(TARGET_DEVICE)),)
104LOCAL_MODULE := sensors.invensense
105LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
106LOCAL_LICENSE_CONDITIONS := notice
107else
108ifeq (,$(filter $(TARGET_BUILD_VARIANT),eng userdebug))
109ifneq ($(filter manta grouper tilapia, $(TARGET_DEVICE)),)
110#LOCAL_MODULE := sensors.invensense
111else
112LOCAL_MODULE := sensors.${TARGET_PRODUCT}
113LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
114LOCAL_LICENSE_CONDITIONS := notice
115endif
116else    # eng & userdebug builds
117LOCAL_MODULE := sensors.${TARGET_PRODUCT}
118LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
119LOCAL_LICENSE_CONDITIONS := notice
120endif   # eng & userdebug builds
121endif	# !guppy
122LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
123
124LOCAL_SHARED_LIBRARIES += libmplmpu
125LOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/mllite
126LOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/mllite/linux
127LOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/mpl
128LOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/driver/include
129LOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/driver/include/linux
130
131LOCAL_MODULE_TAGS := optional
132LOCAL_CFLAGS := -DLOG_TAG=\"Sensors\" -Werror -Wall
133LOCAL_CFLAGS += -Wno-unused-parameter
134
135ifeq ($(VERSION_JB),true)
136LOCAL_CFLAGS += -DANDROID_JELLYBEAN
137endif
138
139ifneq (,$(filter $(TARGET_BUILD_VARIANT),eng userdebug))
140ifneq ($(COMPILE_INVENSENSE_COMPASS_CAL),0)
141LOCAL_CFLAGS += -DINVENSENSE_COMPASS_CAL
142endif
143ifeq ($(COMPILE_THIRD_PARTY_ACCEL),1)
144LOCAL_CFLAGS += -DTHIRD_PARTY_ACCEL
145endif
146ifeq ($(COMPILE_INVENSENSE_SENSOR_ON_PRIMARY_BUS), 1)
147LOCAL_SRC_FILES += CompassSensor.IIO.primary.cpp
148LOCAL_CFLAGS += -DSENSOR_ON_PRIMARY_BUS
149else
150LOCAL_SRC_FILES += CompassSensor.IIO.9150.cpp
151endif
152else # release builds, default
153LOCAL_SRC_FILES += CompassSensor.IIO.9150.cpp
154endif # userdebug
155
156ifeq (,$(filter $(TARGET_BUILD_VARIANT),eng userdebug))
157ifneq ($(filter manta grouper tilapia, $(TARGET_DEVICE)),)
158# it's already defined in some other Makefile for production builds
159#LOCAL_SRC_FILES := sensors_mpl.cpp
160else
161LOCAL_SRC_FILES := sensors_mpl.cpp
162endif
163else    # eng & userdebug builds
164LOCAL_SRC_FILES := sensors_mpl.cpp
165endif   # eng & userdebug builds
166
167#LOCAL_STRIP_MODULE := false
168
169LOCAL_SHARED_LIBRARIES := libinvensense_hal
170LOCAL_SHARED_LIBRARIES += libcutils
171LOCAL_SHARED_LIBRARIES += libutils
172LOCAL_SHARED_LIBRARIES += libdl
173LOCAL_SHARED_LIBRARIES += liblog
174LOCAL_SHARED_LIBRARIES += libmllite
175include $(BUILD_SHARED_LIBRARY)
176
177include $(CLEAR_VARS)
178LOCAL_MODULE := libmplmpu
179LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
180LOCAL_LICENSE_CONDITIONS := notice
181LOCAL_SRC_FILES := libmplmpu.so
182LOCAL_MODULE_TAGS := optional
183LOCAL_MODULE_OWNER := invensense
184LOCAL_MODULE_SUFFIX := .so
185LOCAL_MODULE_CLASS := SHARED_LIBRARIES
186LOCAL_MODULE_PATH := $(TARGET_OUT)/lib
187OVERRIDE_BUILT_MODULE_PATH := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)
188LOCAL_STRIP_MODULE := true
189include $(BUILD_PREBUILT)
190
191include $(CLEAR_VARS)
192LOCAL_MODULE := libmllite
193LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
194LOCAL_LICENSE_CONDITIONS := notice
195LOCAL_SRC_FILES := libmllite.so
196LOCAL_MODULE_TAGS := optional
197LOCAL_MODULE_OWNER := invensense
198LOCAL_MODULE_SUFFIX := .so
199LOCAL_MODULE_CLASS := SHARED_LIBRARIES
200LOCAL_MODULE_PATH := $(TARGET_OUT)/lib
201OVERRIDE_BUILT_MODULE_PATH := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)
202LOCAL_STRIP_MODULE := true
203include $(BUILD_PREBUILT)
204
205my_ignored_clang_warnings :=
206