xref: /aosp_15_r20/hardware/invensense/6515/libsensors_iio/Android.mk (revision 02424279a734a0cb64681cf11d5208a917662433)
1*02424279STreehugger Robot# Copyright (C) 2014 The Android Open Source Project
2*02424279STreehugger Robot#
3*02424279STreehugger Robot# Licensed under the Apache License, Version 2.0 (the "License");
4*02424279STreehugger Robot# you may not use this file except in compliance with the License.
5*02424279STreehugger Robot# You may obtain a copy of the License at
6*02424279STreehugger Robot#
7*02424279STreehugger Robot#      http://www.apache.org/licenses/LICENSE-2.0
8*02424279STreehugger Robot#
9*02424279STreehugger Robot# Unless required by applicable law or agreed to in writing, software
10*02424279STreehugger Robot# distributed under the License is distributed on an "AS IS" BASIS,
11*02424279STreehugger Robot# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*02424279STreehugger Robot# See the License for the specific language governing permissions and
13*02424279STreehugger Robot# limitations under the License.
14*02424279STreehugger Robot# Modified 2011 by InvenSense, Inc
15*02424279STreehugger Robot
16*02424279STreehugger RobotLOCAL_PATH := $(call my-dir)
17*02424279STreehugger Robot
18*02424279STreehugger Robot# InvenSense fragment of the HAL
19*02424279STreehugger Robotinclude $(CLEAR_VARS)
20*02424279STreehugger Robot
21*02424279STreehugger RobotLOCAL_MODULE := libinvensense_hal
22*02424279STreehugger RobotLOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-GPL-2.0 legacy_by_exception_only
23*02424279STreehugger RobotLOCAL_LICENSE_CONDITIONS := by_exception_only notice restricted
24*02424279STreehugger RobotLOCAL_MODULE_TAGS := optional
25*02424279STreehugger RobotLOCAL_MODULE_OWNER := invensense
26*02424279STreehugger Robot
27*02424279STreehugger RobotLOCAL_CFLAGS := -DLOG_TAG=\"Sensors\" -Werror -Wall
28*02424279STreehugger Robot
29*02424279STreehugger Robot# ANDROID version check
30*02424279STreehugger Robot$(info YD>>PLATFORM_VERSION=$(PLATFORM_VERSION))
31*02424279STreehugger RobotMAJOR_VERSION :=$(shell echo $(PLATFORM_VERSION) | cut -f1 -d.)
32*02424279STreehugger RobotMINOR_VERSION :=$(shell echo $(PLATFORM_VERSION) | cut -f2 -d.)
33*02424279STreehugger RobotVERSION_KK :=$(shell test $(MAJOR_VERSION) -eq 4 -a $(MINOR_VERSION) -gt 3 && echo true)
34*02424279STreehugger RobotVERSION_L  :=$(shell test $(MAJOR_VERSION) -eq 5 -a $(MINOR_VERSION) -eq 0 && echo true)
35*02424279STreehugger Robot
36*02424279STreehugger Robot#
37*02424279STreehugger Robot# Invensense uses the OS version to determine whether to include batch support,
38*02424279STreehugger Robot# but implemented it in a way that requires modifying the code each time we move
39*02424279STreehugger Robot# to a newer OS version.  I will fix this problem in a subsequent change, but for now,
40*02424279STreehugger Robot# hardcode to saying we're ANDROID_L so we can isolate this checkin to being
41*02424279STreehugger Robot# only changes coming from Invensense.
42*02424279STreehugger Robot#
43*02424279STreehugger Robot# Setting ANDROID_L to true is perfectly safe even on ANDROID_M because the code
44*02424279STreehugger Robot# just requires "ANDROID_L or newer"
45*02424279STreehugger Robot#
46*02424279STreehugger RobotVERSION_L :=true
47*02424279STreehugger Robot
48*02424279STreehugger Robot$(info YD>>ANDRIOD VERSION=$(MAJOR_VERSION).$(MINOR_VERSION))
49*02424279STreehugger Robot$(info YD>>VERSION_L=$(VERSION_L), VERSION_KK=$(VERSION_KK))
50*02424279STreehugger Robot#ANDROID version check END
51*02424279STreehugger Robot
52*02424279STreehugger Robotifeq ($(VERSION_KK),true)
53*02424279STreehugger RobotLOCAL_CFLAGS += -DANDROID_KITKAT
54*02424279STreehugger Robotelse
55*02424279STreehugger RobotLOCAL_CFLAGS += -DANDROID_LOLLIPOP
56*02424279STreehugger Robotendif
57*02424279STreehugger Robot
58*02424279STreehugger Robotifneq (,$(filter $(TARGET_BUILD_VARIANT),eng userdebug user))
59*02424279STreehugger Robotifneq ($(COMPILE_INVENSENSE_COMPASS_CAL),0)
60*02424279STreehugger RobotLOCAL_CFLAGS += -DINVENSENSE_COMPASS_CAL
61*02424279STreehugger Robotendif
62*02424279STreehugger Robotifeq ($(COMPILE_THIRD_PARTY_ACCEL),1)
63*02424279STreehugger RobotLOCAL_CFLAGS += -DTHIRD_PARTY_ACCEL
64*02424279STreehugger Robotendif
65*02424279STreehugger Robotelse # release builds, default
66*02424279STreehugger RobotLOCAL_CFLAGS += -DINVENSENSE_COMPASS_CAL
67*02424279STreehugger Robotendif
68*02424279STreehugger Robot
69*02424279STreehugger RobotLOCAL_SRC_FILES += SensorBase.cpp
70*02424279STreehugger RobotLOCAL_SRC_FILES += MPLSensor.cpp
71*02424279STreehugger RobotLOCAL_SRC_FILES += MPLSupport.cpp
72*02424279STreehugger RobotLOCAL_SRC_FILES += InputEventReader.cpp
73*02424279STreehugger RobotLOCAL_SRC_FILES += PressureSensor.IIO.secondary.cpp
74*02424279STreehugger Robot
75*02424279STreehugger Robotifneq (,$(filter $(TARGET_BUILD_VARIANT),eng userdebug user))
76*02424279STreehugger Robotifeq ($(COMPILE_INVENSENSE_COMPASS_CAL),0)
77*02424279STreehugger RobotLOCAL_SRC_FILES += AkmSensor.cpp
78*02424279STreehugger RobotLOCAL_SRC_FILES += CompassSensor.AKM.cpp
79*02424279STreehugger Robotelse ifeq ($(COMPILE_INVENSENSE_SENSOR_ON_PRIMARY_BUS), 1)
80*02424279STreehugger RobotLOCAL_SRC_FILES += CompassSensor.IIO.primary.cpp
81*02424279STreehugger RobotLOCAL_CFLAGS += -DSENSOR_ON_PRIMARY_BUS
82*02424279STreehugger Robotelse
83*02424279STreehugger RobotLOCAL_SRC_FILES += CompassSensor.IIO.9150.cpp
84*02424279STreehugger Robotendif
85*02424279STreehugger Robotelse # release builds, default
86*02424279STreehugger RobotLOCAL_SRC_FILES += CompassSensor.IIO.9150.cpp
87*02424279STreehugger Robotendif # eng, userdebug & user builds
88*02424279STreehugger Robot
89*02424279STreehugger RobotLOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/mllite
90*02424279STreehugger RobotLOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/mllite/linux
91*02424279STreehugger RobotLOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/driver/include
92*02424279STreehugger RobotLOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/driver/include/linux
93*02424279STreehugger Robot
94*02424279STreehugger RobotLOCAL_SHARED_LIBRARIES := liblog
95*02424279STreehugger RobotLOCAL_SHARED_LIBRARIES += libcutils
96*02424279STreehugger RobotLOCAL_SHARED_LIBRARIES += libutils
97*02424279STreehugger RobotLOCAL_SHARED_LIBRARIES += libdl
98*02424279STreehugger RobotLOCAL_SHARED_LIBRARIES += libmllite
99*02424279STreehugger Robot
100*02424279STreehugger Robot# Additions for SysPed
101*02424279STreehugger RobotLOCAL_SHARED_LIBRARIES += libmplmpu
102*02424279STreehugger RobotLOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/mpl
103*02424279STreehugger RobotLOCAL_CPPFLAGS += -DLINUX=1
104*02424279STreehugger Robot
105*02424279STreehugger RobotLOCAL_SHARED_LIBRARIES += libmllite
106*02424279STreehugger RobotLOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/mllite
107*02424279STreehugger RobotLOCAL_CPPFLAGS += -DLINUX=1
108*02424279STreehugger Robot
109*02424279STreehugger Robotinclude $(BUILD_SHARED_LIBRARY)
110*02424279STreehugger Robot
111*02424279STreehugger Robot# Build a temporary HAL that links the InvenSense .so
112*02424279STreehugger Robotinclude $(CLEAR_VARS)
113*02424279STreehugger Robotifeq ($(filter eng, userdebug, user, $(TARGET_BUILD_VARIANT)),)
114*02424279STreehugger Robotifneq ($(filter manta full_grouper tilapia, $(TARGET_PRODUCT)),)
115*02424279STreehugger RobotLOCAL_MODULE := sensors.full_grouper
116*02424279STreehugger RobotLOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-GPL-2.0 legacy_by_exception_only
117*02424279STreehugger RobotLOCAL_LICENSE_CONDITIONS := by_exception_only notice restricted
118*02424279STreehugger RobotLOCAL_MODULE_OWNER := invensense
119*02424279STreehugger Robotelse
120*02424279STreehugger Robotifneq ($(filter aosp_hammerhead, $(TARGET_PRODUCT)),)
121*02424279STreehugger RobotLOCAL_MODULE := sensors.hammerhead
122*02424279STreehugger RobotLOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-GPL-2.0 legacy_by_exception_only
123*02424279STreehugger RobotLOCAL_LICENSE_CONDITIONS := by_exception_only notice restricted
124*02424279STreehugger RobotLOCAL_MODULE_OWNER := invensense
125*02424279STreehugger Robotelse
126*02424279STreehugger Robotifneq ($(filter aosp_flounder, $(TARGET_PRODUCT)),)
127*02424279STreehugger RobotLOCAL_MODULE := sensors.flounder
128*02424279STreehugger RobotLOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-GPL-2.0 legacy_by_exception_only
129*02424279STreehugger RobotLOCAL_LICENSE_CONDITIONS := by_exception_only notice restricted
130*02424279STreehugger RobotLOCAL_MODULE_OWNER := invensense
131*02424279STreehugger Robotendif
132*02424279STreehugger Robotendif
133*02424279STreehugger Robotifneq ($(filter dory guppy, $(TARGET_DEVICE)),)
134*02424279STreehugger RobotLOCAL_MODULE := sensors.invensense
135*02424279STreehugger RobotLOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-GPL-2.0 legacy_by_exception_only
136*02424279STreehugger RobotLOCAL_LICENSE_CONDITIONS := by_exception_only notice restricted
137*02424279STreehugger RobotLOCAL_MODULE_OWNER := invensense
138*02424279STreehugger Robotendif
139*02424279STreehugger Robotendif
140*02424279STreehugger Robotelse    # eng, user, & userdebug builds
141*02424279STreehugger RobotLOCAL_MODULE := sensors.invensense
142*02424279STreehugger RobotLOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-GPL-2.0 legacy_by_exception_only
143*02424279STreehugger RobotLOCAL_LICENSE_CONDITIONS := by_exception_only notice restricted
144*02424279STreehugger Robotendif   # eng, user & userdebug builds
145*02424279STreehugger Robot$(info YD>>LOCAL_MODULE=$(LOCAL_MODULE))
146*02424279STreehugger Robot
147*02424279STreehugger Robotifdef TARGET_2ND_ARCH
148*02424279STreehugger RobotLOCAL_MODULE_RELATIVE_PATH := hw
149*02424279STreehugger Robotelse
150*02424279STreehugger RobotLOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
151*02424279STreehugger Robotendif
152*02424279STreehugger Robot
153*02424279STreehugger RobotLOCAL_SHARED_LIBRARIES += libmplmpu
154*02424279STreehugger RobotLOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/mllite
155*02424279STreehugger RobotLOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/mllite/linux
156*02424279STreehugger RobotLOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/mpl
157*02424279STreehugger RobotLOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/driver/include
158*02424279STreehugger RobotLOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/driver/include/linux
159*02424279STreehugger Robot
160*02424279STreehugger RobotLOCAL_MODULE_TAGS := optional
161*02424279STreehugger RobotLOCAL_CFLAGS := -DLOG_TAG=\"Sensors\" -Werror -Wall
162*02424279STreehugger Robot
163*02424279STreehugger Robotifeq ($(VERSION_KK),true)
164*02424279STreehugger RobotLOCAL_CFLAGS += -DANDROID_KITKAT
165*02424279STreehugger Robotelse
166*02424279STreehugger RobotLOCAL_CFLAGS += -DANDROID_LOLLIPOP
167*02424279STreehugger Robotendif
168*02424279STreehugger Robot
169*02424279STreehugger Robotifneq (,$(filter $(TARGET_BUILD_VARIANT),eng userdebug user))
170*02424279STreehugger Robotifneq ($(COMPILE_INVENSENSE_COMPASS_CAL),0)
171*02424279STreehugger RobotLOCAL_CFLAGS += -DINVENSENSE_COMPASS_CAL
172*02424279STreehugger Robotendif
173*02424279STreehugger Robotifeq ($(COMPILE_THIRD_PARTY_ACCEL),1)
174*02424279STreehugger RobotLOCAL_CFLAGS += -DTHIRD_PARTY_ACCEL
175*02424279STreehugger Robotendif
176*02424279STreehugger Robotifeq ($(COMPILE_INVENSENSE_SENSOR_ON_PRIMARY_BUS), 1)
177*02424279STreehugger RobotLOCAL_SRC_FILES += CompassSensor.IIO.primary.cpp
178*02424279STreehugger RobotLOCAL_CFLAGS += -DSENSOR_ON_PRIMARY_BUS
179*02424279STreehugger Robotelse
180*02424279STreehugger RobotLOCAL_SRC_FILES += CompassSensor.IIO.9150.cpp
181*02424279STreehugger Robotendif
182*02424279STreehugger Robotelse # release builds, default
183*02424279STreehugger RobotLOCAL_SRC_FILES += CompassSensor.IIO.9150.cpp
184*02424279STreehugger Robotendif # eng, userdebug & user
185*02424279STreehugger Robot
186*02424279STreehugger Robotifeq (,$(filter $(TARGET_BUILD_VARIANT),eng userdebug user))
187*02424279STreehugger Robotifneq ($(filter manta grouper tilapia, $(TARGET_DEVICE)),)
188*02424279STreehugger Robot# it's already defined in some other Makefile for production builds
189*02424279STreehugger Robot#LOCAL_SRC_FILES := sensors_mpl.cpp
190*02424279STreehugger Robotelse
191*02424279STreehugger RobotLOCAL_SRC_FILES := sensors_mpl.cpp
192*02424279STreehugger Robotendif
193*02424279STreehugger Robotelse    # eng, userdebug & user builds
194*02424279STreehugger RobotLOCAL_SRC_FILES := sensors_mpl.cpp
195*02424279STreehugger Robotendif   # eng, userdebug & user builds
196*02424279STreehugger Robot
197*02424279STreehugger RobotLOCAL_SHARED_LIBRARIES := libinvensense_hal
198*02424279STreehugger RobotLOCAL_SHARED_LIBRARIES += libcutils
199*02424279STreehugger RobotLOCAL_SHARED_LIBRARIES += libutils
200*02424279STreehugger RobotLOCAL_SHARED_LIBRARIES += libdl
201*02424279STreehugger RobotLOCAL_SHARED_LIBRARIES += liblog
202*02424279STreehugger RobotLOCAL_SHARED_LIBRARIES += libmllite
203*02424279STreehugger RobotLOCAL_SHARED_LIBRARIES += libhardware_legacy
204*02424279STreehugger Robot$(info YD>>LOCAL_MODULE=$(LOCAL_MODULE), LOCAL_SRC_FILES=$(LOCAL_SRC_FILES), LOCAL_SHARED_LIBRARIES=$(LOCAL_SHARED_LIBRARIES))
205*02424279STreehugger Robotinclude $(BUILD_SHARED_LIBRARY)
206*02424279STreehugger Robot
207*02424279STreehugger Robotinclude $(CLEAR_VARS)
208*02424279STreehugger RobotLOCAL_MODULE := libmplmpu
209*02424279STreehugger RobotLOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-GPL-2.0 legacy_by_exception_only
210*02424279STreehugger RobotLOCAL_LICENSE_CONDITIONS := by_exception_only notice restricted
211*02424279STreehugger RobotLOCAL_SRC_FILES := libmplmpu.so
212*02424279STreehugger RobotLOCAL_MODULE_TAGS := optional
213*02424279STreehugger RobotLOCAL_MODULE_OWNER := invensense
214*02424279STreehugger RobotLOCAL_MODULE_SUFFIX := .so
215*02424279STreehugger RobotLOCAL_MODULE_CLASS := SHARED_LIBRARIES
216*02424279STreehugger RobotLOCAL_MODULE_PATH := $(TARGET_OUT)/lib
217*02424279STreehugger RobotOVERRIDE_BUILT_MODULE_PATH := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)
218*02424279STreehugger RobotLOCAL_STRIP_MODULE := true
219*02424279STreehugger Robotinclude $(BUILD_PREBUILT)
220*02424279STreehugger Robot
221*02424279STreehugger Robotinclude $(CLEAR_VARS)
222*02424279STreehugger RobotLOCAL_MODULE := libmllite
223*02424279STreehugger RobotLOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-GPL-2.0 legacy_by_exception_only
224*02424279STreehugger RobotLOCAL_LICENSE_CONDITIONS := by_exception_only notice restricted
225*02424279STreehugger RobotLOCAL_SRC_FILES := libmllite.so
226*02424279STreehugger RobotLOCAL_MODULE_TAGS := optional
227*02424279STreehugger RobotLOCAL_MODULE_OWNER := invensense
228*02424279STreehugger RobotLOCAL_MODULE_SUFFIX := .so
229*02424279STreehugger RobotLOCAL_MODULE_CLASS := SHARED_LIBRARIES
230*02424279STreehugger RobotLOCAL_MODULE_PATH := $(TARGET_OUT)/lib
231*02424279STreehugger RobotOVERRIDE_BUILT_MODULE_PATH := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)
232*02424279STreehugger RobotLOCAL_STRIP_MODULE := true
233*02424279STreehugger Robotinclude $(BUILD_PREBUILT)
234