Home | History | Annotate | Download | only in sensorhal
      1 # Copyright (C) 2015 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 
     15 #
     16 # Nanohub sensor HAL usage instructions:
     17 #
     18 # Add the following to your device.mk file.
     19 #
     20 # # Enable the nanohub sensor HAL
     21 # TARGET_USES_NANOHUB_SENSORHAL := true
     22 #
     23 # # Nanohub sensor list source file
     24 # NANOHUB_SENSORHAL_SENSORLIST := $(LOCAL_PATH)/sensorhal/sensorlist.cpp
     25 #
     26 # # Sensor HAL name override (optional)
     27 # NANOHUB_SENSORHAL_NAME_OVERRIDE := sensors.nanohub
     28 #
     29 # # Enable lid-state reporting (optional)
     30 # NANOHUB_SENSORHAL_LID_STATE_ENABLED := true
     31 #
     32 # # Enable mag-bias reporting (optional)
     33 # NANOHUB_SENSORHAL_USB_MAG_BIAS_ENABLED := true
     34 #
     35 
     36 LOCAL_PATH := $(call my-dir)
     37 
     38 ifeq ($(TARGET_USES_NANOHUB_SENSORHAL), true)
     39 
     40 COMMON_CFLAGS := -Wall -Werror -Wextra
     41 
     42 ################################################################################
     43 
     44 include $(CLEAR_VARS)
     45 
     46 ifeq ($(NANOHUB_SENSORHAL_NAME_OVERRIDE),)
     47 ifeq ($(TARGET_DEVICE),angler_treble)
     48 LOCAL_MODULE := sensors.angler
     49 else
     50 ifeq ($(TARGET_DEVICE),bullhead_treble)
     51 LOCAL_MODULE := sensors.bullhead
     52 else
     53 LOCAL_MODULE := sensors.$(TARGET_DEVICE)
     54 endif
     55 endif
     56 else
     57 LOCAL_MODULE := $(NANOHUB_SENSORHAL_NAME_OVERRIDE)
     58 endif
     59 
     60 LOCAL_MODULE_RELATIVE_PATH := hw
     61 LOCAL_MODULE_TAGS := optional
     62 LOCAL_MODULE_OWNER := google
     63 LOCAL_PROPRIETARY_MODULE := true
     64 
     65 LOCAL_CFLAGS += $(COMMON_CFLAGS)
     66 
     67 LOCAL_C_INCLUDES += \
     68 	device/google/contexthub/firmware/os/inc \
     69 	device/google/contexthub/util/common
     70 
     71 LOCAL_SRC_FILES := \
     72 	sensors.cpp \
     73 	../../../../$(NANOHUB_SENSORHAL_SENSORLIST)
     74 
     75 LOCAL_SHARED_LIBRARIES := \
     76 	liblog \
     77 	libcutils \
     78 	libhubconnection \
     79 	libstagefright_foundation \
     80 	libutils
     81 
     82 ifeq ($(NANOHUB_SENSORHAL_DIRECT_REPORT_ENABLED), true)
     83 LOCAL_CFLAGS += -DDIRECT_REPORT_ENABLED
     84 endif
     85 
     86 ifeq ($(NANOHUB_SENSORHAL_DYNAMIC_SENSOR_EXT_ENABLED), true)
     87 LOCAL_CFLAGS += -DDYNAMIC_SENSOR_EXT_ENABLED
     88 LOCAL_SHARED_LIBRARIES += libdynamic_sensor_ext
     89 endif
     90 
     91 ifeq ($(NANOHUB_SENSORHAL_LEFTY_SERVICE_ENABLED), true)
     92 LOCAL_CFLAGS += -DLEFTY_SERVICE_ENABLED
     93 LOCAL_SHARED_LIBRARIES += liblefty_service_nanohub
     94 endif
     95 
     96 include $(BUILD_SHARED_LIBRARY)
     97 
     98 ################################################################################
     99 
    100 include $(CLEAR_VARS)
    101 
    102 LOCAL_MODULE := activity_recognition.$(TARGET_DEVICE)
    103 LOCAL_MODULE_RELATIVE_PATH := hw
    104 LOCAL_MODULE_TAGS := optional
    105 LOCAL_MODULE_OWNER := google
    106 LOCAL_PROPRIETARY_MODULE := true
    107 
    108 LOCAL_CFLAGS += $(COMMON_CFLAGS)
    109 
    110 LOCAL_C_INCLUDES += \
    111 	device/google/contexthub/firmware/os/inc \
    112 	device/google/contexthub/util/common
    113 
    114 LOCAL_SRC_FILES := \
    115 	activity.cpp
    116 
    117 LOCAL_SHARED_LIBRARIES := \
    118 	libcutils \
    119 	libhubconnection \
    120 	liblog \
    121 	libstagefright_foundation \
    122 	libutils
    123 
    124 include $(BUILD_SHARED_LIBRARY)
    125 
    126 ################################################################################
    127 
    128 include $(CLEAR_VARS)
    129 
    130 LOCAL_MODULE := libhubconnection
    131 LOCAL_MODULE_TAGS := optional
    132 LOCAL_MODULE_OWNER := google
    133 LOCAL_PROPRIETARY_MODULE := true
    134 
    135 LOCAL_CFLAGS += $(COMMON_CFLAGS)
    136 ifeq ($(PRODUCT_FULL_TREBLE),true)
    137 LOCAL_CFLAGS += -DUSE_SENSORSERVICE_TO_GET_FIFO
    138 endif
    139 
    140 ifeq ($(NANOHUB_SENSORHAL_LID_STATE_ENABLED), true)
    141 LOCAL_CFLAGS += -DLID_STATE_REPORTING_ENABLED
    142 endif
    143 
    144 ifeq ($(NANOHUB_SENSORHAL_USB_MAG_BIAS_ENABLED), true)
    145 LOCAL_CFLAGS += -DUSB_MAG_BIAS_REPORTING_ENABLED
    146 endif
    147 
    148 ifeq ($(NANOHUB_SENSORHAL_DOUBLE_TOUCH_ENABLED), true)
    149 LOCAL_CFLAGS += -DDOUBLE_TOUCH_ENABLED
    150 endif
    151 
    152 ifeq ($(NANOHUB_SENSORHAL_DIRECT_REPORT_ENABLED), true)
    153 LOCAL_CFLAGS += -DDIRECT_REPORT_ENABLED
    154 endif
    155 
    156 LOCAL_C_INCLUDES += \
    157     device/google/contexthub/firmware/os/inc
    158 
    159 LOCAL_SRC_FILES := \
    160     hubconnection.cpp \
    161     directchannel.cpp
    162 
    163 LOCAL_STATIC_LIBRARIES := \
    164     libhubutilcommon
    165 
    166 LOCAL_SHARED_LIBRARIES := \
    167     android.frameworks.schedulerservice (a] 1.0 \
    168     libcutils \
    169     libhardware \
    170     libhardware_legacy \
    171     libhidlbase \
    172     libhidltransport \
    173     liblog \
    174     libstagefright_foundation \
    175     libutils \
    176 
    177 include $(BUILD_SHARED_LIBRARY)
    178 
    179 ################################################################################
    180 
    181 endif
    182