1# File: Makefile 2# 3# Copyright 2008-2022 NXP 4# 5# This software file (the File) is distributed by NXP 6# under the terms of the GNU General Public License Version 2, June 1991 7# (the License). You may use, redistribute and/or modify the File in 8# accordance with the terms and conditions of the License, a copy of which 9# is available by writing to the Free Software Foundation, Inc., 10# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the 11# worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. 12# 13# THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE 14# IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE 15# ARE EXPRESSLY DISCLAIMED. The License provides additional details about 16# this warranty disclaimer. 17# 18 19############################################################################# 20# Configuration Options 21############################################################################# 22# Multi-chipsets 23CONFIG_SD8887=n 24CONFIG_SD8897=n 25CONFIG_USB8897=n 26CONFIG_PCIE8897=n 27CONFIG_SD8977=n 28CONFIG_SD8978=n 29CONFIG_USB8978=n 30CONFIG_SD8997=n 31CONFIG_USB8997=n 32CONFIG_PCIE8997=n 33CONFIG_SD8987=y 34CONFIG_SD9097=n 35CONFIG_SD9177=n 36CONFIG_SD8801=n 37CONFIG_USB8801=n 38CONFIG_USB9097=n 39CONFIG_PCIE9097=n 40CONFIG_SD9098=n 41CONFIG_USB9098=n 42CONFIG_PCIE9098=n 43CONFIG_SDNW62X=n 44CONFIG_PCIENW62X=n 45CONFIG_USBNW62X=n 46 47 48# Debug Option 49# DEBUG LEVEL n/1/2: 50# n: NO DEBUG 51# 1: Only PRINTM(MMSG,...), PRINTM(MFATAL,...), ... 52# 2: All PRINTM() 53CONFIG_DEBUG=1 54 55# Enable STA mode support 56CONFIG_STA_SUPPORT=y 57 58# Enable uAP mode support 59CONFIG_UAP_SUPPORT=y 60 61# Enable WIFIDIRECT support 62CONFIG_WIFI_DIRECT_SUPPORT=y 63 64 65# Re-association in driver 66CONFIG_REASSOCIATION=y 67 68 69# Manufacturing firmware support 70CONFIG_MFG_CMD_SUPPORT=y 71 72# OpenWrt support 73CONFIG_OPENWRT_SUPPORT=n 74 75# Big-endian platform 76CONFIG_BIG_ENDIAN=n 77 78 79 80ifeq ($(CONFIG_DRV_EMBEDDED_SUPPLICANT), y) 81CONFIG_EMBEDDED_SUPP_AUTH=y 82else 83ifeq ($(CONFIG_DRV_EMBEDDED_AUTHENTICATOR), y) 84CONFIG_EMBEDDED_SUPP_AUTH=y 85endif 86endif 87 88#ifdef SDIO_MMC 89# SDIO suspend/resume 90CONFIG_SDIO_SUSPEND_RESUME=y 91#endif 92 93# DFS testing support 94CONFIG_DFS_TESTING_SUPPORT=y 95 96 97 98 99CONFIG_ANDROID_KERNEL=n 100 101#32bit app over 64bit kernel support 102CONFIG_USERSPACE_32BIT_OVER_KERNEL_64BIT=n 103 104 105############################################################################# 106# Select Platform Tools 107############################################################################# 108 109MODEXT = ko 110ccflags-y += -I$(M)/mlan 111ccflags-y += -DLINUX 112 113LD += -S 114 115############################################################################# 116# Compiler Flags 117############################################################################# 118 119 ccflags-y += -DFPNUM='"92"' 120 121ifeq ($(CONFIG_DEBUG),1) 122 ccflags-y += -DDEBUG_LEVEL1 123endif 124 125ifeq ($(CONFIG_DEBUG),2) 126 ccflags-y += -DDEBUG_LEVEL1 127 ccflags-y += -DDEBUG_LEVEL2 128 DBG= -dbg 129endif 130 131ifeq ($(CONFIG_64BIT), y) 132 ccflags-y += -DMLAN_64BIT 133endif 134 135ifeq ($(CONFIG_STA_SUPPORT),y) 136 ccflags-y += -DSTA_SUPPORT 137ifeq ($(CONFIG_REASSOCIATION),y) 138 ccflags-y += -DREASSOCIATION 139endif 140else 141CONFIG_WIFI_DIRECT_SUPPORT=n 142CONFIG_STA_WEXT=n 143CONFIG_STA_CFG80211=n 144endif 145 146ifeq ($(CONFIG_UAP_SUPPORT),y) 147 ccflags-y += -DUAP_SUPPORT 148else 149CONFIG_WIFI_DIRECT_SUPPORT=n 150CONFIG_UAP_WEXT=n 151CONFIG_UAP_CFG80211=n 152endif 153 154ifeq ($(CONFIG_WIFI_DIRECT_SUPPORT),y) 155 ccflags-y += -DWIFI_DIRECT_SUPPORT 156endif 157 158ifeq ($(CONFIG_MFG_CMD_SUPPORT),y) 159 ccflags-y += -DMFG_CMD_SUPPORT 160endif 161 162ifeq ($(CONFIG_BIG_ENDIAN),y) 163 ccflags-y += -DBIG_ENDIAN_SUPPORT 164endif 165 166ifeq ($(CONFIG_USERSPACE_32BIT_OVER_KERNEL_64BIT),y) 167 ccflags-y += -DUSERSPACE_32BIT_OVER_KERNEL_64BIT 168endif 169 170#ifdef SDIO_MMC 171ifeq ($(CONFIG_SDIO_SUSPEND_RESUME),y) 172 ccflags-y += -DSDIO_SUSPEND_RESUME 173endif 174#endif 175 176 177ifeq ($(CONFIG_DFS_TESTING_SUPPORT),y) 178 ccflags-y += -DDFS_TESTING_SUPPORT 179endif 180 181 182ifeq ($(CONFIG_ANDROID_KERNEL), y) 183 ccflags-y += -DANDROID_KERNEL 184endif 185 186ifeq ($(CONFIG_OPENWRT_SUPPORT), y) 187 ccflags-y += -DOPENWRT 188endif 189 190ifeq ($(CONFIG_T50), y) 191 ccflags-y += -DT50 192 ccflags-y += -DT40 193 ccflags-y += -DT3T 194endif 195 196ifeq ($(CONFIG_SD8887),y) 197 CONFIG_SDIO=y 198 ccflags-y += -DSD8887 199endif 200ifeq ($(CONFIG_SD8897),y) 201 CONFIG_SDIO=y 202 ccflags-y += -DSD8897 203endif 204ifeq ($(CONFIG_SD8977),y) 205 CONFIG_SDIO=y 206 ccflags-y += -DSD8977 207endif 208ifeq ($(CONFIG_SD8978),y) 209 CONFIG_SDIO=y 210 ccflags-y += -DSD8978 211endif 212ifeq ($(CONFIG_SD8997),y) 213 CONFIG_SDIO=y 214 ccflags-y += -DSD8997 215endif 216ifeq ($(CONFIG_SD8987),y) 217 CONFIG_SDIO=y 218 ccflags-y += -DSD8987 219endif 220ifeq ($(CONFIG_SD9097),y) 221 CONFIG_SDIO=y 222 ccflags-y += -DSD9097 223endif 224ifeq ($(CONFIG_SDNW62X),y) 225 CONFIG_SDIO=y 226 ccflags-y += -DSDNW62X 227endif 228ifeq ($(CONFIG_SD9177),y) 229 CONFIG_SDIO=y 230 ccflags-y += -DSD9177 231endif 232ifeq ($(CONFIG_SD8801),y) 233 CONFIG_SDIO=y 234 ccflags-y += -DSD8801 235endif 236ifeq ($(CONFIG_SD9098),y) 237 CONFIG_SDIO=y 238 ccflags-y += -DSD9098 239endif 240ifeq ($(CONFIG_USB8801),y) 241 CONFIG_MUSB=y 242 ccflags-y += -DUSB8801 243endif 244ifeq ($(CONFIG_USB8897),y) 245 CONFIG_MUSB=y 246 ccflags-y += -DUSB8897 247endif 248ifeq ($(CONFIG_USB8997),y) 249 CONFIG_MUSB=y 250 ccflags-y += -DUSB8997 251endif 252ifeq ($(CONFIG_USB8978),y) 253 CONFIG_MUSB=y 254 ccflags-y += -DUSB8978 255endif 256ifeq ($(CONFIG_USB9097),y) 257 CONFIG_MUSB=y 258 ccflags-y += -DUSB9097 259endif 260ifeq ($(CONFIG_USBNW62X),y) 261 CONFIG_MUSB=y 262 ccflags-y += -DUSBNW62X 263endif 264ifeq ($(CONFIG_USB9098),y) 265 CONFIG_MUSB=y 266 ccflags-y += -DUSB9098 267endif 268ifeq ($(CONFIG_PCIE8897),y) 269 CONFIG_PCIE=y 270 ccflags-y += -DPCIE8897 271endif 272ifeq ($(CONFIG_PCIE8997),y) 273 CONFIG_PCIE=y 274 ccflags-y += -DPCIE8997 275endif 276ifeq ($(CONFIG_PCIE9097),y) 277 CONFIG_PCIE=y 278 ccflags-y += -DPCIE9097 279endif 280ifeq ($(CONFIG_PCIE9098),y) 281 CONFIG_PCIE=y 282 ccflags-y += -DPCIE9098 283endif 284ifeq ($(CONFIG_PCIENW62X),y) 285 CONFIG_PCIE=y 286 ccflags-y += -DPCIENW62X 287endif 288ifeq ($(CONFIG_SDIO),y) 289 ccflags-y += -DSDIO 290 ccflags-y += -DSDIO_MMC 291endif 292ifeq ($(CONFIG_MUSB),y) 293 ccflags-y += -DUSB 294endif 295ifeq ($(CONFIG_PCIE),y) 296 ccflags-y += -DPCIE 297endif 298 299ifeq ($(CONFIG_MAC80211_SUPPORT),y) 300 ccflags-y += -DMAC80211_SUPPORT 301endif 302ifeq ($(CONFIG_MAC80211_SUPPORT_UAP),y) 303 ccflags-y += -DMAC80211_SUPPORT_UAP 304endif 305ifeq ($(CONFIG_MAC80211_SUPPORT_MESH),y) 306 ccflags-y += -DMAC80211_SUPPORT_MESH 307endif 308 309# add -Wno-packed-bitfield-compat when GCC version greater than 4.4 310GCC_VERSION := $(shell echo `gcc -dumpversion | cut -f1-2 -d.` \>= 4.4 | sed -e 's/\./*100+/g' | bc ) 311ifeq ($(GCC_VERSION),1) 312 ccflags-y += -Wno-packed-bitfield-compat 313endif 314ccflags-y += -Wno-stringop-overflow 315ccflags-y += -Wno-tautological-compare 316ccflags-y += -Wno-packed-bitfield-compat 317ccflags-y += -Wno-stringop-truncation 318 319#ccflags-y += -Wunused-but-set-variable 320#ccflags-y += -Wmissing-prototypes 321#ccflags-y += -Wold-style-definition 322#ccflags-y += -Wtype-limits 323#ccflags-y += -Wsuggest-attribute=format 324#ccflags-y += -Wmissing-include-dirs 325#ccflags-y += -Wshadow 326#ccflags-y += -Wsign-compare 327#ccflags-y += -Wunused-macros 328#ccflags-y += -Wmissing-field-initializers 329#ccflags-y += -Wstringop-truncation 330#ccflags-y += -Wmisleading-indentation 331#ccflags-y += -Wunused-const-variable 332#ccflags-y += -Wno-array-bounds 333############################################################################# 334# Make Targets 335############################################################################# 336 337ifeq ($(CONFIG_WIRELESS_EXT),y) 338ifeq ($(CONFIG_WEXT_PRIV),y) 339 # Enable WEXT for STA 340 CONFIG_STA_WEXT=y 341 # Enable WEXT for uAP 342 CONFIG_UAP_WEXT=y 343else 344# Disable WEXT for STA 345 CONFIG_STA_WEXT=n 346# Disable WEXT for uAP 347 CONFIG_UAP_WEXT=n 348endif 349endif 350 351# Enable CFG80211 for STA 352ifeq ($(CONFIG_CFG80211),y) 353 CONFIG_STA_CFG80211=y 354else 355ifeq ($(CONFIG_CFG80211),m) 356 CONFIG_STA_CFG80211=y 357else 358 CONFIG_STA_CFG80211=n 359endif 360endif 361 362# OpenWrt 363ifeq ($(CONFIG_OPENWRT_SUPPORT), y) 364ifeq ($(CPTCFG_CFG80211),y) 365 CONFIG_STA_CFG80211=y 366else 367ifeq ($(CPTCFG_CFG80211),m) 368 CONFIG_STA_CFG80211=y 369else 370 CONFIG_STA_CFG80211=n 371endif 372endif 373endif 374 375# Enable CFG80211 for uAP 376ifeq ($(CONFIG_CFG80211),y) 377 CONFIG_UAP_CFG80211=y 378else 379ifeq ($(CONFIG_CFG80211),m) 380 CONFIG_UAP_CFG80211=y 381else 382 CONFIG_UAP_CFG80211=n 383endif 384endif 385 386# OpenWrt 387ifeq ($(CONFIG_OPENWRT_SUPPORT), y) 388ifeq ($(CPTCFG_CFG80211),y) 389 CONFIG_STA_CFG80211=y 390else 391ifeq ($(CPTCFG_CFG80211),m) 392 CONFIG_STA_CFG80211=y 393else 394 CONFIG_STA_CFG80211=n 395endif 396endif 397endif 398 399ifneq ($(CONFIG_STA_SUPPORT),y) 400 CONFIG_WIFI_DIRECT_SUPPORT=n 401 CONFIG_STA_WEXT=n 402 CONFIG_STA_CFG80211=n 403endif 404 405ifneq ($(CONFIG_UAP_SUPPORT),y) 406 CONFIG_WIFI_DIRECT_SUPPORT=n 407 CONFIG_UAP_WEXT=n 408 CONFIG_UAP_CFG80211=n 409endif 410 411ifeq ($(CONFIG_STA_SUPPORT),y) 412ifeq ($(CONFIG_STA_WEXT),y) 413 ccflags-y += -DSTA_WEXT 414endif 415ifeq ($(CONFIG_STA_CFG80211),y) 416 ccflags-y += -DSTA_CFG80211 417endif 418endif 419ifeq ($(CONFIG_UAP_SUPPORT),y) 420ifeq ($(CONFIG_UAP_WEXT),y) 421 ccflags-y += -DUAP_WEXT 422endif 423ifeq ($(CONFIG_UAP_CFG80211),y) 424 ccflags-y += -DUAP_CFG80211 425endif 426endif 427 428print: 429ifeq ($(CONFIG_STA_SUPPORT),y) 430ifeq ($(CONFIG_STA_WEXT),n) 431ifeq ($(CONFIG_STA_CFG80211),n) 432 @echo "Can not build STA without WEXT or CFG80211" 433 exit 2 434endif 435endif 436endif 437ifeq ($(CONFIG_UAP_SUPPORT),y) 438ifeq ($(CONFIG_UAP_WEXT),n) 439ifeq ($(CONFIG_UAP_CFG80211),n) 440 @echo "Can not build UAP without WEXT or CFG80211" 441 exit 2 442endif 443endif 444endif 445 446MOALOBJS = mlinux/moal_main.o \ 447 mlinux/moal_ioctl.o \ 448 mlinux/moal_shim.o \ 449 mlinux/moal_eth_ioctl.o \ 450 mlinux/moal_init.o 451 452MLANOBJS = mlan/mlan_shim.o mlan/mlan_init.o \ 453 mlan/mlan_txrx.o \ 454 mlan/mlan_cmdevt.o mlan/mlan_misc.o \ 455 mlan/mlan_cfp.o \ 456 mlan/mlan_module.o 457 458MLANOBJS += mlan/mlan_wmm.o 459ifeq ($(CONFIG_MUSB),y) 460MLANOBJS += mlan/mlan_usb.o 461endif 462ifeq ($(CONFIG_SDIO),y) 463MLANOBJS += mlan/mlan_sdio.o 464endif 465ifeq ($(CONFIG_PCIE),y) 466MLANOBJS += mlan/mlan_pcie.o 467endif 468MLANOBJS += mlan/mlan_11n_aggr.o 469MLANOBJS += mlan/mlan_11n_rxreorder.o 470MLANOBJS += mlan/mlan_11n.o 471MLANOBJS += mlan/mlan_11ac.o 472MLANOBJS += mlan/mlan_11ax.o 473MLANOBJS += mlan/mlan_11d.o 474MLANOBJS += mlan/mlan_11h.o 475ifeq ($(CONFIG_STA_SUPPORT),y) 476MLANOBJS += mlan/mlan_meas.o 477MLANOBJS += mlan/mlan_scan.o \ 478 mlan/mlan_sta_ioctl.o \ 479 mlan/mlan_sta_rx.o \ 480 mlan/mlan_sta_tx.o \ 481 mlan/mlan_sta_event.o \ 482 mlan/mlan_sta_cmd.o \ 483 mlan/mlan_sta_cmdresp.o \ 484 mlan/mlan_join.o 485ifeq ($(CONFIG_STA_WEXT),y) 486MOALOBJS += mlinux/moal_priv.o \ 487 mlinux/moal_wext.o 488endif 489endif 490ifeq ($(CONFIG_UAP_SUPPORT),y) 491MLANOBJS += mlan/mlan_uap_ioctl.o 492MLANOBJS += mlan/mlan_uap_cmdevent.o 493MLANOBJS += mlan/mlan_uap_txrx.o 494MOALOBJS += mlinux/moal_uap.o 495ifeq ($(CONFIG_UAP_WEXT),y) 496MOALOBJS += mlinux/moal_uap_priv.o 497MOALOBJS += mlinux/moal_uap_wext.o 498endif 499endif 500ifeq ($(CONFIG_STA_CFG80211),y) 501MOALOBJS += mlinux/moal_cfg80211.o 502MOALOBJS += mlinux/moal_cfg80211_util.o 503MOALOBJS += mlinux/moal_sta_cfg80211.o 504endif 505ifeq ($(CONFIG_UAP_CFG80211),y) 506MOALOBJS += mlinux/moal_cfg80211.o 507MOALOBJS += mlinux/moal_cfg80211_util.o 508MOALOBJS += mlinux/moal_uap_cfg80211.o 509endif 510 511ifdef CONFIG_PROC_FS 512MOALOBJS += mlinux/moal_proc.o 513MOALOBJS += mlinux/moal_debug.o 514endif 515 516ifeq ($(CONFIG_MAC80211_SUPPORT),y) 517MOALOBJS += mlinux/moal_mac80211.o 518MLANOBJS += mlan/mlan_mac80211.o 519endif 520 521 522 523 524 525 526 527obj-$(CONFIG_MXMWIFIEX) := mlan.o 528mlan-objs := $(MLANOBJS) 529 530ifeq ($(CONFIG_MUSB),y) 531MOALOBJS += mlinux/moal_usb.o 532endif 533ifeq ($(CONFIG_SDIO),y) 534MOALOBJS += mlinux/moal_sdio_mmc.o 535endif 536ifeq ($(CONFIG_PCIE),y) 537MOALOBJS += mlinux/moal_pcie.o 538endif 539obj-$(CONFIG_MXMWIFIEX) += moal.o 540moal-objs := $(MOALOBJS) 541 542clean: 543 -find . -name "*.o" -exec rm {} \; 544 -find . -name "*.ko" -exec rm {} \; 545 -find . -name ".*.cmd" -exec rm {} \; 546 -find . -name "*.mod.c" -exec rm {} \; 547 -find . -name "*.mod" -exec rm {} \; 548 -find . -name "Module.symvers" -exec rm {} \; 549 -find . -name "Module.markers" -exec rm {} \; 550 -find . -name "modules.order" -exec rm {} \; 551 -find . -name ".*.dwo" -exec rm {} \; 552 -find . -name "*dwo" -exec rm {} \; 553 -rm -rf .tmp_versions 554 555distclean: 556 -find . -name "*.o" -exec rm {} \; 557 -find . -name "*.orig" -exec rm {} \; 558 -find . -name "*.swp" -exec rm {} \; 559 -find . -name "*.*~" -exec rm {} \; 560 -find . -name "*~" -exec rm {} \; 561 -find . -name "*.d" -exec rm {} \; 562 -find . -name "*.a" -exec rm {} \; 563 -find . -name "tags" -exec rm {} \; 564 -find . -name ".*" -exec rm -rf 2> /dev/null \; 565 -find . -name "*.ko" -exec rm {} \; 566 -find . -name ".*.cmd" -exec rm {} \; 567 -find . -name "*.mod.c" -exec rm {} \; 568 -find . -name ".*.dwo" -exec rm {} \; 569 -find . -name "*dwo" -exec rm {} \; 570 -rm -rf .tmp_versions 571