Christopher Wiley | 189a1ef | 2016-06-15 12:54:12 -0700 | [diff] [blame] | 1 | # Copyright (C) 2016 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 | LOCAL_PATH := $(call my-dir) |
Christopher Wiley | 189a1ef | 2016-06-15 12:54:12 -0700 | [diff] [blame] | 16 | |
Christopher Wiley | a591506 | 2016-06-16 16:31:01 -0700 | [diff] [blame] | 17 | wifi_hal_cflags := \ |
Christopher Wiley | 189a1ef | 2016-06-15 12:54:12 -0700 | [diff] [blame] | 18 | -Wall \ |
| 19 | -Werror \ |
| 20 | -Wextra \ |
| 21 | -Winit-self \ |
| 22 | -Wno-unused-function \ |
| 23 | -Wno-unused-parameter \ |
| 24 | -Wshadow \ |
| 25 | -Wunused-variable \ |
| 26 | -Wwrite-strings |
Christopher Wiley | a591506 | 2016-06-16 16:31:01 -0700 | [diff] [blame] | 27 | ifdef WIFI_DRIVER_MODULE_PATH |
| 28 | wifi_hal_cflags += -DWIFI_DRIVER_MODULE_PATH=\"$(WIFI_DRIVER_MODULE_PATH)\" |
| 29 | endif |
| 30 | ifdef WIFI_DRIVER_MODULE_ARG |
| 31 | wifi_hal_cflags += -DWIFI_DRIVER_MODULE_ARG=\"$(WIFI_DRIVER_MODULE_ARG)\" |
| 32 | endif |
| 33 | ifdef WIFI_DRIVER_MODULE_NAME |
| 34 | wifi_hal_cflags += -DWIFI_DRIVER_MODULE_NAME=\"$(WIFI_DRIVER_MODULE_NAME)\" |
| 35 | endif |
| 36 | ifdef WIFI_DRIVER_FW_PATH_STA |
| 37 | wifi_hal_cflags += -DWIFI_DRIVER_FW_PATH_STA=\"$(WIFI_DRIVER_FW_PATH_STA)\" |
| 38 | endif |
| 39 | ifdef WIFI_DRIVER_FW_PATH_AP |
| 40 | wifi_hal_cflags += -DWIFI_DRIVER_FW_PATH_AP=\"$(WIFI_DRIVER_FW_PATH_AP)\" |
| 41 | endif |
| 42 | ifdef WIFI_DRIVER_FW_PATH_P2P |
| 43 | wifi_hal_cflags += -DWIFI_DRIVER_FW_PATH_P2P=\"$(WIFI_DRIVER_FW_PATH_P2P)\" |
| 44 | endif |
Christopher Wiley | 1d3a41b | 2016-08-22 10:23:22 -0700 | [diff] [blame] | 45 | |
| 46 | # Some devices use a different path (e.g. devices with broadcom WiFi parts). |
Christopher Wiley | a591506 | 2016-06-16 16:31:01 -0700 | [diff] [blame] | 47 | ifdef WIFI_DRIVER_FW_PATH_PARAM |
| 48 | wifi_hal_cflags += -DWIFI_DRIVER_FW_PATH_PARAM=\"$(WIFI_DRIVER_FW_PATH_PARAM)\" |
Christopher Wiley | 1d3a41b | 2016-08-22 10:23:22 -0700 | [diff] [blame] | 49 | else |
| 50 | wifi_hal_cflags += -DWIFI_DRIVER_FW_PATH_PARAM=\"/sys/module/wlan/parameters/fwpath\" |
Christopher Wiley | a591506 | 2016-06-16 16:31:01 -0700 | [diff] [blame] | 51 | endif |
| 52 | |
| 53 | ifdef WIFI_DRIVER_STATE_CTRL_PARAM |
| 54 | wifi_hal_cflags += -DWIFI_DRIVER_STATE_CTRL_PARAM=\"$(WIFI_DRIVER_STATE_CTRL_PARAM)\" |
| 55 | endif |
| 56 | ifdef WIFI_DRIVER_STATE_ON |
| 57 | wifi_hal_cflags += -DWIFI_DRIVER_STATE_ON=\"$(WIFI_DRIVER_STATE_ON)\" |
| 58 | endif |
| 59 | ifdef WIFI_DRIVER_STATE_OFF |
| 60 | wifi_hal_cflags += -DWIFI_DRIVER_STATE_OFF=\"$(WIFI_DRIVER_STATE_OFF)\" |
| 61 | endif |
| 62 | |
| 63 | # Common code shared between the HALs. |
| 64 | # ============================================================ |
| 65 | include $(CLEAR_VARS) |
| 66 | LOCAL_MODULE := libwifi-hal-common |
Steven Moreland | 37e67e5 | 2017-04-13 14:26:45 -0700 | [diff] [blame] | 67 | LOCAL_VENDOR_MODULE := true |
Christopher Wiley | a591506 | 2016-06-16 16:31:01 -0700 | [diff] [blame] | 68 | LOCAL_CFLAGS := $(wifi_hal_cflags) |
Christopher Wiley | a591506 | 2016-06-16 16:31:01 -0700 | [diff] [blame] | 69 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/include |
Christopher Wiley | 86105fb | 2016-09-09 13:48:15 -0700 | [diff] [blame] | 70 | LOCAL_SHARED_LIBRARIES := libbase |
Steven Moreland | 0d73ef4 | 2017-04-17 17:54:27 -0700 | [diff] [blame] | 71 | LOCAL_HEADER_LIBRARIES := libcutils_headers |
Christopher Wiley | 86105fb | 2016-09-09 13:48:15 -0700 | [diff] [blame] | 72 | LOCAL_SRC_FILES := wifi_hal_common.cpp |
Christopher Wiley | a591506 | 2016-06-16 16:31:01 -0700 | [diff] [blame] | 73 | include $(BUILD_STATIC_LIBRARY) |
| 74 | |
| 75 | # A fallback "vendor" HAL library. |
| 76 | # Don't link this, link libwifi-hal. |
| 77 | # ============================================================ |
| 78 | include $(CLEAR_VARS) |
| 79 | LOCAL_MODULE := libwifi-hal-fallback |
Steven Moreland | 37e67e5 | 2017-04-13 14:26:45 -0700 | [diff] [blame] | 80 | LOCAL_VENDOR_MODULE := true |
Christopher Wiley | a591506 | 2016-06-16 16:31:01 -0700 | [diff] [blame] | 81 | LOCAL_CFLAGS := $(wifi_hal_cflags) |
Christopher Wiley | 189a1ef | 2016-06-15 12:54:12 -0700 | [diff] [blame] | 82 | LOCAL_SRC_FILES := wifi_hal_fallback.cpp |
Dan Willemsen | 398adb6 | 2017-04-04 21:40:29 -0700 | [diff] [blame] | 83 | LOCAL_HEADER_LIBRARIES := libhardware_legacy_headers |
Christopher Wiley | 189a1ef | 2016-06-15 12:54:12 -0700 | [diff] [blame] | 84 | include $(BUILD_STATIC_LIBRARY) |
| 85 | |
| 86 | # Pick a vendor provided HAL implementation library. |
| 87 | # ============================================================ |
| 88 | LIB_WIFI_HAL := libwifi-hal-fallback |
Etan Cohen | 8faa7c2 | 2017-05-03 09:11:44 -0700 | [diff] [blame] | 89 | VENDOR_LOCAL_SHARED_LIBRARIES := |
Christopher Wiley | 189a1ef | 2016-06-15 12:54:12 -0700 | [diff] [blame] | 90 | ifeq ($(BOARD_WLAN_DEVICE), bcmdhd) |
| 91 | LIB_WIFI_HAL := libwifi-hal-bcm |
| 92 | else ifeq ($(BOARD_WLAN_DEVICE), qcwcn) |
| 93 | LIB_WIFI_HAL := libwifi-hal-qcom |
Etan Cohen | 8faa7c2 | 2017-05-03 09:11:44 -0700 | [diff] [blame] | 94 | VENDOR_LOCAL_SHARED_LIBRARIES := libcld80211 |
Christopher Wiley | 189a1ef | 2016-06-15 12:54:12 -0700 | [diff] [blame] | 95 | else ifeq ($(BOARD_WLAN_DEVICE), mrvl) |
| 96 | # this is commented because none of the nexus devices |
| 97 | # that sport Marvell's wifi have support for HAL |
| 98 | # LIB_WIFI_HAL := libwifi-hal-mrvl |
| 99 | else ifeq ($(BOARD_WLAN_DEVICE), MediaTek) |
| 100 | # support MTK WIFI HAL |
| 101 | LIB_WIFI_HAL := libwifi-hal-mt66xx |
| 102 | endif |
| 103 | |
| 104 | # The WiFi HAL that you should be linking. |
| 105 | # ============================================================ |
| 106 | include $(CLEAR_VARS) |
| 107 | LOCAL_MODULE := libwifi-hal |
Roshan Pius | 2ca182b | 2017-02-24 19:38:12 -0800 | [diff] [blame] | 108 | LOCAL_PROPRIETARY_MODULE := true |
Christopher Wiley | 5edbffa | 2016-06-28 15:00:50 -0700 | [diff] [blame] | 109 | LOCAL_CFLAGS := $(wifi_hal_cflags) |
Christopher Wiley | 00aa56e | 2016-06-24 14:25:38 -0700 | [diff] [blame] | 110 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/include |
Christopher Wiley | a591506 | 2016-06-16 16:31:01 -0700 | [diff] [blame] | 111 | LOCAL_EXPORT_C_INCLUDE_DIRS := \ |
Dan Willemsen | 398adb6 | 2017-04-04 21:40:29 -0700 | [diff] [blame] | 112 | $(LOCAL_PATH)/include |
| 113 | LOCAL_EXPORT_HEADER_LIBRARY_HEADERS := libhardware_legacy_headers |
| 114 | LOCAL_HEADER_LIBRARIES := libhardware_legacy_headers |
Christopher Wiley | 189a1ef | 2016-06-15 12:54:12 -0700 | [diff] [blame] | 115 | LOCAL_SHARED_LIBRARIES := \ |
Christopher Wiley | f41e52f | 2016-09-09 13:28:03 -0700 | [diff] [blame] | 116 | libbase \ |
Christopher Wiley | a591506 | 2016-06-16 16:31:01 -0700 | [diff] [blame] | 117 | libcutils \ |
Christopher Wiley | 189a1ef | 2016-06-15 12:54:12 -0700 | [diff] [blame] | 118 | liblog \ |
| 119 | libnl \ |
Subhani Shaik | 09070fe | 2017-03-13 13:30:31 -0700 | [diff] [blame] | 120 | libutils \ |
Etan Cohen | 8faa7c2 | 2017-05-03 09:11:44 -0700 | [diff] [blame] | 121 | $(VENDOR_LOCAL_SHARED_LIBRARIES) |
Christopher Wiley | 00aa56e | 2016-06-24 14:25:38 -0700 | [diff] [blame] | 122 | LOCAL_SRC_FILES := \ |
Roshan Pius | 7df78ee | 2017-03-09 17:35:06 -0800 | [diff] [blame] | 123 | driver_tool.cpp \ |
| 124 | hal_tool.cpp |
Christopher Wiley | a591506 | 2016-06-16 16:31:01 -0700 | [diff] [blame] | 125 | LOCAL_WHOLE_STATIC_LIBRARIES := $(LIB_WIFI_HAL) libwifi-hal-common |
Christopher Wiley | 189a1ef | 2016-06-15 12:54:12 -0700 | [diff] [blame] | 126 | include $(BUILD_SHARED_LIBRARY) |
| 127 | |
Christopher Wiley | e9a0f2c | 2016-06-28 09:33:44 -0700 | [diff] [blame] | 128 | # Test utilities (e.g. mock classes) for libwifi-hal |
| 129 | # ============================================================ |
| 130 | include $(CLEAR_VARS) |
| 131 | LOCAL_MODULE := libwifi-hal-test |
| 132 | LOCAL_CFLAGS := $(wifi_hal_cflags) |
| 133 | LOCAL_C_INCLUDES := \ |
| 134 | $(LOCAL_PATH)/include \ |
| 135 | $(LOCAL_PATH)/testlib/include |
| 136 | LOCAL_STATIC_LIBRARIES := libgmock |
| 137 | LOCAL_EXPORT_C_INCLUDE_DIRS := \ |
| 138 | $(LOCAL_PATH)/include \ |
| 139 | $(LOCAL_PATH)/testlib/include |
| 140 | include $(BUILD_STATIC_LIBRARY) |