xref: /aosp_15_r20/hardware/invensense/65xx/libsensors_iio/Android.mk (revision 02424279a734a0cb64681cf11d5208a917662433)
1*02424279STreehugger Robot# Copyright (C) 2008 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# Too many benign warnings to be fixed later.
19*02424279STreehugger Robotmy_ignored_clang_warnings := \
20*02424279STreehugger Robot    -Wno-unused-private-field \
21*02424279STreehugger Robot    -Wno-gnu-designator
22*02424279STreehugger Robot
23*02424279STreehugger Robot# InvenSense fragment of the HAL
24*02424279STreehugger Robotinclude $(CLEAR_VARS)
25*02424279STreehugger Robot
26*02424279STreehugger RobotLOCAL_CLANG_CFLAGS += $(my_ignored_clang_warnings)
27*02424279STreehugger RobotLOCAL_MODULE := libinvensense_hal
28*02424279STreehugger RobotLOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
29*02424279STreehugger RobotLOCAL_LICENSE_CONDITIONS := notice
30*02424279STreehugger RobotLOCAL_MODULE_TAGS := optional
31*02424279STreehugger RobotLOCAL_MODULE_OWNER := invensense
32*02424279STreehugger Robot
33*02424279STreehugger RobotLOCAL_CFLAGS := -DLOG_TAG=\"Sensors\" -Werror -Wall
34*02424279STreehugger RobotLOCAL_CFLAGS += -Wno-unused-parameter
35*02424279STreehugger Robot
36*02424279STreehugger Robot# ANDROID version check
37*02424279STreehugger RobotMAJOR_VERSION :=$(shell echo $(PLATFORM_VERSION) | cut -f1 -d.)
38*02424279STreehugger RobotMINOR_VERSION :=$(shell echo $(PLATFORM_VERSION) | cut -f2 -d.)
39*02424279STreehugger RobotVERSION_JB :=$(shell test $(MAJOR_VERSION) -gt 4 -o $(MAJOR_VERSION) -eq 4 -a $(MINOR_VERSION) -gt 0 && echo true)
40*02424279STreehugger Robot#ANDROID version check END
41*02424279STreehugger RobotVERSION_JB:=true
42*02424279STreehugger Robotifeq ($(VERSION_JB),true)
43*02424279STreehugger RobotLOCAL_CFLAGS += -DANDROID_JELLYBEAN
44*02424279STreehugger Robotendif
45*02424279STreehugger Robot
46*02424279STreehugger Robotifneq (,$(filter $(TARGET_BUILD_VARIANT),eng userdebug))
47*02424279STreehugger Robotifneq ($(COMPILE_INVENSENSE_COMPASS_CAL),0)
48*02424279STreehugger RobotLOCAL_CFLAGS += -DINVENSENSE_COMPASS_CAL
49*02424279STreehugger Robotendif
50*02424279STreehugger Robotifeq ($(COMPILE_THIRD_PARTY_ACCEL),1)
51*02424279STreehugger RobotLOCAL_CFLAGS += -DTHIRD_PARTY_ACCEL
52*02424279STreehugger Robotendif
53*02424279STreehugger Robotelse # release builds, default
54*02424279STreehugger RobotLOCAL_CFLAGS += -DINVENSENSE_COMPASS_CAL
55*02424279STreehugger Robotendif
56*02424279STreehugger Robot
57*02424279STreehugger RobotLOCAL_SRC_FILES += SensorBase.cpp
58*02424279STreehugger RobotLOCAL_SRC_FILES += MPLSensor.cpp
59*02424279STreehugger RobotLOCAL_SRC_FILES += MPLSupport.cpp
60*02424279STreehugger RobotLOCAL_SRC_FILES += InputEventReader.cpp
61*02424279STreehugger RobotLOCAL_SRC_FILES += PressureSensor.IIO.secondary.cpp
62*02424279STreehugger Robot
63*02424279STreehugger Robotifneq (,$(filter $(TARGET_BUILD_VARIANT),eng userdebug))
64*02424279STreehugger Robotifeq ($(COMPILE_INVENSENSE_COMPASS_CAL),0)
65*02424279STreehugger RobotLOCAL_SRC_FILES += AkmSensor.cpp
66*02424279STreehugger RobotLOCAL_SRC_FILES += CompassSensor.AKM.cpp
67*02424279STreehugger Robotelse ifeq ($(COMPILE_INVENSENSE_SENSOR_ON_PRIMARY_BUS), 1)
68*02424279STreehugger RobotLOCAL_SRC_FILES += CompassSensor.IIO.primary.cpp
69*02424279STreehugger RobotLOCAL_CFLAGS += -DSENSOR_ON_PRIMARY_BUS
70*02424279STreehugger Robotelse
71*02424279STreehugger RobotLOCAL_SRC_FILES += CompassSensor.IIO.9150.cpp
72*02424279STreehugger Robotendif
73*02424279STreehugger Robotelse # release builds, default
74*02424279STreehugger RobotLOCAL_SRC_FILES += CompassSensor.IIO.9150.cpp
75*02424279STreehugger Robotendif #userdebug
76*02424279STreehugger Robot
77*02424279STreehugger RobotLOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/mllite
78*02424279STreehugger RobotLOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/mllite/linux
79*02424279STreehugger RobotLOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/driver/include
80*02424279STreehugger RobotLOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/driver/include/linux
81*02424279STreehugger Robot
82*02424279STreehugger RobotLOCAL_SHARED_LIBRARIES := liblog
83*02424279STreehugger RobotLOCAL_SHARED_LIBRARIES += libcutils
84*02424279STreehugger RobotLOCAL_SHARED_LIBRARIES += libutils
85*02424279STreehugger RobotLOCAL_SHARED_LIBRARIES += libdl
86*02424279STreehugger RobotLOCAL_SHARED_LIBRARIES += libmllite
87*02424279STreehugger Robot
88*02424279STreehugger Robot# Additions for SysPed
89*02424279STreehugger RobotLOCAL_SHARED_LIBRARIES += libmplmpu
90*02424279STreehugger RobotLOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/mpl
91*02424279STreehugger RobotLOCAL_CPPFLAGS += -DLINUX=1
92*02424279STreehugger Robot
93*02424279STreehugger RobotLOCAL_SHARED_LIBRARIES += libmllite
94*02424279STreehugger RobotLOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/mllite
95*02424279STreehugger RobotLOCAL_CPPFLAGS += -DLINUX=1
96*02424279STreehugger Robot
97*02424279STreehugger Robotinclude $(BUILD_SHARED_LIBRARY)
98*02424279STreehugger Robot
99*02424279STreehugger Robot# Build a temporary HAL that links the InvenSense .so
100*02424279STreehugger Robotinclude $(CLEAR_VARS)
101*02424279STreehugger Robot
102*02424279STreehugger RobotLOCAL_CLANG_CFLAGS += $(my_ignored_clang_warnings)
103*02424279STreehugger Robotifneq ($(filter dory guppy guppypdk, $(TARGET_DEVICE)),)
104*02424279STreehugger RobotLOCAL_MODULE := sensors.invensense
105*02424279STreehugger RobotLOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
106*02424279STreehugger RobotLOCAL_LICENSE_CONDITIONS := notice
107*02424279STreehugger Robotelse
108*02424279STreehugger Robotifeq (,$(filter $(TARGET_BUILD_VARIANT),eng userdebug))
109*02424279STreehugger Robotifneq ($(filter manta grouper tilapia, $(TARGET_DEVICE)),)
110*02424279STreehugger Robot#LOCAL_MODULE := sensors.invensense
111*02424279STreehugger Robotelse
112*02424279STreehugger RobotLOCAL_MODULE := sensors.${TARGET_PRODUCT}
113*02424279STreehugger RobotLOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
114*02424279STreehugger RobotLOCAL_LICENSE_CONDITIONS := notice
115*02424279STreehugger Robotendif
116*02424279STreehugger Robotelse    # eng & userdebug builds
117*02424279STreehugger RobotLOCAL_MODULE := sensors.${TARGET_PRODUCT}
118*02424279STreehugger RobotLOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
119*02424279STreehugger RobotLOCAL_LICENSE_CONDITIONS := notice
120*02424279STreehugger Robotendif   # eng & userdebug builds
121*02424279STreehugger Robotendif	# !guppy
122*02424279STreehugger RobotLOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
123*02424279STreehugger Robot
124*02424279STreehugger RobotLOCAL_SHARED_LIBRARIES += libmplmpu
125*02424279STreehugger RobotLOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/mllite
126*02424279STreehugger RobotLOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/mllite/linux
127*02424279STreehugger RobotLOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/mpl
128*02424279STreehugger RobotLOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/driver/include
129*02424279STreehugger RobotLOCAL_C_INCLUDES += $(LOCAL_PATH)/software/core/driver/include/linux
130*02424279STreehugger Robot
131*02424279STreehugger RobotLOCAL_MODULE_TAGS := optional
132*02424279STreehugger RobotLOCAL_CFLAGS := -DLOG_TAG=\"Sensors\" -Werror -Wall
133*02424279STreehugger RobotLOCAL_CFLAGS += -Wno-unused-parameter
134*02424279STreehugger Robot
135*02424279STreehugger Robotifeq ($(VERSION_JB),true)
136*02424279STreehugger RobotLOCAL_CFLAGS += -DANDROID_JELLYBEAN
137*02424279STreehugger Robotendif
138*02424279STreehugger Robot
139*02424279STreehugger Robotifneq (,$(filter $(TARGET_BUILD_VARIANT),eng userdebug))
140*02424279STreehugger Robotifneq ($(COMPILE_INVENSENSE_COMPASS_CAL),0)
141*02424279STreehugger RobotLOCAL_CFLAGS += -DINVENSENSE_COMPASS_CAL
142*02424279STreehugger Robotendif
143*02424279STreehugger Robotifeq ($(COMPILE_THIRD_PARTY_ACCEL),1)
144*02424279STreehugger RobotLOCAL_CFLAGS += -DTHIRD_PARTY_ACCEL
145*02424279STreehugger Robotendif
146*02424279STreehugger Robotifeq ($(COMPILE_INVENSENSE_SENSOR_ON_PRIMARY_BUS), 1)
147*02424279STreehugger RobotLOCAL_SRC_FILES += CompassSensor.IIO.primary.cpp
148*02424279STreehugger RobotLOCAL_CFLAGS += -DSENSOR_ON_PRIMARY_BUS
149*02424279STreehugger Robotelse
150*02424279STreehugger RobotLOCAL_SRC_FILES += CompassSensor.IIO.9150.cpp
151*02424279STreehugger Robotendif
152*02424279STreehugger Robotelse # release builds, default
153*02424279STreehugger RobotLOCAL_SRC_FILES += CompassSensor.IIO.9150.cpp
154*02424279STreehugger Robotendif # userdebug
155*02424279STreehugger Robot
156*02424279STreehugger Robotifeq (,$(filter $(TARGET_BUILD_VARIANT),eng userdebug))
157*02424279STreehugger Robotifneq ($(filter manta grouper tilapia, $(TARGET_DEVICE)),)
158*02424279STreehugger Robot# it's already defined in some other Makefile for production builds
159*02424279STreehugger Robot#LOCAL_SRC_FILES := sensors_mpl.cpp
160*02424279STreehugger Robotelse
161*02424279STreehugger RobotLOCAL_SRC_FILES := sensors_mpl.cpp
162*02424279STreehugger Robotendif
163*02424279STreehugger Robotelse    # eng & userdebug builds
164*02424279STreehugger RobotLOCAL_SRC_FILES := sensors_mpl.cpp
165*02424279STreehugger Robotendif   # eng & userdebug builds
166*02424279STreehugger Robot
167*02424279STreehugger Robot#LOCAL_STRIP_MODULE := false
168*02424279STreehugger Robot
169*02424279STreehugger RobotLOCAL_SHARED_LIBRARIES := libinvensense_hal
170*02424279STreehugger RobotLOCAL_SHARED_LIBRARIES += libcutils
171*02424279STreehugger RobotLOCAL_SHARED_LIBRARIES += libutils
172*02424279STreehugger RobotLOCAL_SHARED_LIBRARIES += libdl
173*02424279STreehugger RobotLOCAL_SHARED_LIBRARIES += liblog
174*02424279STreehugger RobotLOCAL_SHARED_LIBRARIES += libmllite
175*02424279STreehugger Robotinclude $(BUILD_SHARED_LIBRARY)
176*02424279STreehugger Robot
177*02424279STreehugger Robotinclude $(CLEAR_VARS)
178*02424279STreehugger RobotLOCAL_MODULE := libmplmpu
179*02424279STreehugger RobotLOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
180*02424279STreehugger RobotLOCAL_LICENSE_CONDITIONS := notice
181*02424279STreehugger RobotLOCAL_SRC_FILES := libmplmpu.so
182*02424279STreehugger RobotLOCAL_MODULE_TAGS := optional
183*02424279STreehugger RobotLOCAL_MODULE_OWNER := invensense
184*02424279STreehugger RobotLOCAL_MODULE_SUFFIX := .so
185*02424279STreehugger RobotLOCAL_MODULE_CLASS := SHARED_LIBRARIES
186*02424279STreehugger RobotLOCAL_MODULE_PATH := $(TARGET_OUT)/lib
187*02424279STreehugger RobotOVERRIDE_BUILT_MODULE_PATH := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)
188*02424279STreehugger RobotLOCAL_STRIP_MODULE := true
189*02424279STreehugger Robotinclude $(BUILD_PREBUILT)
190*02424279STreehugger Robot
191*02424279STreehugger Robotinclude $(CLEAR_VARS)
192*02424279STreehugger RobotLOCAL_MODULE := libmllite
193*02424279STreehugger RobotLOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
194*02424279STreehugger RobotLOCAL_LICENSE_CONDITIONS := notice
195*02424279STreehugger RobotLOCAL_SRC_FILES := libmllite.so
196*02424279STreehugger RobotLOCAL_MODULE_TAGS := optional
197*02424279STreehugger RobotLOCAL_MODULE_OWNER := invensense
198*02424279STreehugger RobotLOCAL_MODULE_SUFFIX := .so
199*02424279STreehugger RobotLOCAL_MODULE_CLASS := SHARED_LIBRARIES
200*02424279STreehugger RobotLOCAL_MODULE_PATH := $(TARGET_OUT)/lib
201*02424279STreehugger RobotOVERRIDE_BUILT_MODULE_PATH := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)
202*02424279STreehugger RobotLOCAL_STRIP_MODULE := true
203*02424279STreehugger Robotinclude $(BUILD_PREBUILT)
204*02424279STreehugger Robot
205*02424279STreehugger Robotmy_ignored_clang_warnings :=
206