# Support Multiple Interface within single driver
HAS_MULTI_INF=n

# Support ATE function
HAS_ATE=n

# Support QA ATE function
HAS_QA_SUPPORT=n

#ifdef RSSI_FEEDBACK
HAS_RSSI_FEEDBACK=n
#endif // RSSI_FEEDBACK //

#ifdef XLINK_SUPPORT
# Support XLINK mode
HAS_XLINK=n
#endif // XLINK_SUPPORT //

#ifdef WSC_INCLUDED
# Support WSC function
HAS_WSC=n
#ifdef WSC_V2_SUPPORT
HAS_WSC_V2=n
#endif // WSC_V2_SUPPORT //
HAS_WSC_LED=n
HAS_WSC_NFC=n
#ifdef IWSC_SUPPORT
HAS_IWSC_SUPPORT=n
#endif // IWSC_SUPPORT //
#endif // WSC_INCLUDED //

#ifdef NINTENDO_AP
HAS_NINTENDO=n
#endif // NINTENDO_AP //

# Support LLTD function
HAS_LLTD=n


#ifdef HE_BD_CFG80211_SUPPORT
HAS_HE_BD_CFG80211_SUPPORT=n
#endif //HE_BD_CFG80211_SUPPORT // 

# Support HE BDP special Kernel version(old kernel)
#HAS_HE_BD_KERNEL_SUPPORT=n
#endif

#ifdef WDS_SUPPORT
# Support WDS function
HAS_WDS=n
#endif // WDS_SUPPORT //

#ifdef APCLI_SUPPORT
# Support AP-Client function
HAS_APCLI=n
#endif // APCLI_SUPPORT //
#ifdef WPA_SUPPLICANT_SUPPORT
# Support Wpa_Supplicant
# i.e. wpa_supplicant -Dralink
HAS_WPA_SUPPLICANT=y
#endif // WPA_SUPPLICANT_SUPPORT //


#ifdef NATIVE_WPA_SUPPLICANT_SUPPORT
# Support Native WpaSupplicant for Network Maganger
# i.e. wpa_supplicant -Dwext
HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=n
#endif // NATIVE_WPA_SUPPLICANT_SUPPORT //

#Support Net interface block while Tx-Sw queue full
HAS_BLOCK_NET_IF=n

#Support IGMP-Snooping function.
HAS_IGMP_SNOOP_SUPPORT=n

#Support DFS function
HAS_DFS_SUPPORT=n

#Support Carrier-Sense function
HAS_CS_SUPPORT=n

#ifeq ($(PLATFORM),MT85XX)
#Support HE_SUPPORT
HAS_HE_SUPPORT=n
HAS_HE_BD_SUPPORT=n
#endif

#ifdef WEPAUTO_OPEN_FIRST
#Support WEPAUTO mode try Open first then shared
HAS_WEPAUTO_OPEN_FIRST_SUPPORT=n
#endif

#ifdef ETH_CONVERT_SUPPORT
# Support for STA Ethernet Converter
HAS_ETH_CONVERT_SUPPORT=n
#endif // ETH_CONVERT_SUPPORT //

# Support user specific transmit rate of Multicast packet.
HAS_MCAST_RATE_SPECIFIC_SUPPORT=n

#ifdef MULTI_CARD
# Support for Multiple Cards
HAS_MC_SUPPORT=n
#endif // MULTI_CARD //

#Support for PCI-MSI
HAS_MSI_SUPPORT=n

#ifdef WMM_ACM_SUPPORT
# Support for WMM ACM v1.1
HAS_WMM_ACM_SUPPORT=n
#endif // WMM_ACM_SUPPORT //

#Support for IEEE802.11e DLS
HAS_QOS_DLS_SUPPORT=n

#Support for EXT_CHANNEL
HAS_EXT_BUILD_CHANNEL_LIST=n

#Support for IDS 
HAS_IDS_SUPPORT=n

#ifdef MESH_SUPPORT
#Support for MESH
HAS_MESH_SUPPORT=n
#endif // MESH_SUPPORT //

#Support for Net-SNMP
HAS_SNMP_SUPPORT=n

#ifdef DOT11N_DRAFT3
#Support features of 802.11n Draft3
HAS_DOT11N_DRAFT3_SUPPORT=y
#endif // DOT11N_DRAFT3 //

#Support features of Single SKU. 
HAS_SINGLE_SKU_SUPPORT=n

#Support features of Single SKU. 
HAS_SINGLE_SKU_V2_SUPPORT=n

#ifdef DOT11_N_SUPPORT
#Support features of 802.11n
HAS_DOT11_N_SUPPORT=y
#endif // DOT11_N_SUPPORT //

#ifdef DOT11_VHT_SUPPORT
#Support for 802.11ac VHT
HAS_DOT11_VHT_SUPPORT=n
#endif // DOT11_VHT_SUPPORT //

#ifdef WAPI_SUPPORT
#Support for WAPI
HAS_WAPI_SUPPORT=n
#endif // WAPI_SUPPORT //

#ifdef DOT11R_FT_SUPPORT
#Support for dot11r FT
HAS_DOT11R_FT_SUPPORT=n
#endif // DOT11R_FT_SUPPORT //

#Support for 2860/2880 co-exist 
HAS_RT2880_RT2860_COEXIST=n

HAS_KTHREAD_SUPPORT=n

#ifdef DOT11K_RRM_SUPPORT
#Support for dot11k RRM
HAS_DOT11K_RRM_SUPPORT=n
#endif // DOT11K_RRM_SUPPORT //

#ifdef DOT11V_WNM_SUPPORT
#Support for dot 11v WNM
HAS_DOT11V_WNM_SUPPORT=n
#endif // DOT11V_WNM_SUPPORT //

#ifdef DOT11Z_TDLS_SUPPORT
#Support for dot11z TDLS
HAS_DOT11Z_TDLS_SUPPORT=n
#endif // DOT11Z_TDLS_SUPPORT //

#ifdef P2P_SUPPORT
#Support for WiFi-Driect(Peer to Peer)
HAS_P2P_SUPPORT=n
HAS_P2P_ODD_MAC_ADJUST=n
HAS_P2P_SPECIFIC_WIRELESS_EVENT=n
#endif // P2P_SUPPORT //

#Support for WiFi Display
HAS_WFD_SUPPORT=n

#Support for Auto channel select enhance
HAS_AUTO_CH_SELECT_ENHANCE=n

#Support statistics count
HAS_STATS_COUNT=y

#Support TSSI Antenna Variation
HAS_TSSI_ANTENNA_VARIATION=n

#Support USB_BULK_BUF_ALIGMENT
HAS_USB_BULK_BUF_ALIGMENT=n

#Support for USB_SUPPORT_SELECTIVE_SUSPEND
HAS_USB_SUPPORT_SELECTIVE_SUSPEND=n

#Support USB load firmware by multibyte
HAS_USB_FIRMWARE_MULTIBYTE_WRITE=n


#Support ANDROID_SUPPORT (2.X with WEXT-based)
HAS_ANDROID_SUPPORT=n

#HAS_IFUP_IN_PROBE_SUPPORT
HAS_IFUP_IN_PROBE_SUPPORT=n


#ifdef DOT11W_PMF_SUPPORT
#Support for dot11w Protected Management Frame
HAS_DOT11W_PMF_SUPPORT=n
#endif // DOT11W_PMF_SUPPORT //

#ifdef ANT_DIVERSITY_SUPPORT
#Support Antenna Diversity
HAS_ANTENNA_DIVERSITY_SUPPORT=n
#endif // ANT_DIVERSITY_SUPPORT //

#ifdef TXRX_SW_ANTDIV_SUPPORT
#Support TXRX SW Antenna Diversity
HAS_TXRX_SW_ANTDIV_SUPPORT=n
#endif // TXRX_SW_ANTDIV_SUPPORT //

#Client support WDS function
HAS_CLIENT_WDS_SUPPORT=n

#Support for Bridge Fast Path & Bridge Fast Path function open to other module
HAS_BGFP_SUPPORT=n
HAS_BGFP_OPEN_SUPPORT=n

# Support HOSTAPD function
HAS_HOSTAPD_SUPPORT=n

#Support GreenAP function
HAS_GREENAP_SUPPORT=n

#Support cfg80211 function with Linux Only.
#Please make sure insmod the cfg80211.ko before our driver,
#our driver references to its symbol.
HAS_CFG80211_SUPPORT=y
#smooth the scan signal for cfg80211 based driver
HAS_CFG80211_SCAN_SIGNAL_AVG_SUPPORT=n
#control two STA using wpa_supplicant
HAS_CFG80211_MULTI_STA_SUPPORT=n
#Cfg80211-based P2P Support
HAS_CFG80211_P2P_SUPPORT=y
#Cfg80211-based P2P Mode Selection (must one be chosen)
HAS_CFG80211_P2P_CONCURRENT_DEVICE=y
HAS_CFG80211_P2P_SINGLE_DEVICE=n
HAS_CFG80211_P2P_STATIC_CONCURRENT_DEVICE=n
HAS_CFG80211_BUILD_CHANNEL_LIST=y
HAS_CFG80211_P2P_MULTI_CHAN_SUPPORT=n

#Cfg80211-based TDLS support
HAS_CFG80211_TDLS_SUPPORT=n
#For android wifi priv-lib (cfg80211_based wpa_supplicant cmd expansion)
HAS_CFG80211_ANDROID_PRIV_LIB_SUPPORT=n

#Support RFKILL hardware block/unblock LINUX-only function
HAS_RFKILL_HW_SUPPORT=n

#ifdef EASY_CONFIG_SETUP
HAS_EASY_CONFIG_SETUP_SUPPORT=n
#endif // EASY_CONFIG_SETUP //

#ifdef RELEASE_EXCLUDE
#Support GPL Cryptography
HAS_GPL_ALGORITHM_SUPPORT=n

#ifdef HW_COEXISTENCE_SUPPORT
HAS_HW_COEXISTENCE_SUPPORT=n
#endif // HW_COEXISTENCE_SUPPORT //

#ifdef BT_COEXISTENCE_SUPPORT
HAS_BT_COEXISTENCE_SUPPORT=n
#endif // BT_COEXISTENCE_SUPPORT //
#endif //RELEASE_EXCLUDE //

#ifdef MT76XX_BT_COEXISTENCE_SUPPORT
HAS_MT76XX_BT_COEXISTENCE_SUPPORT=n
#endif // MT76XX_BT_COEXISTENCE_SUPPORT //

HAS_APCLI_WPA_SUPPLICANT=n

HAS_RTMP_FLASH_SUPPORT=n

#when ht40 set to short gi 
HAS_HT40_DISABLE_SHORT_GI=n
#when 20/40 coex management bit set to zero
HAS_BSS_COEX_DISABLE=n


#ifdef OS_ABL_FUNC_SUPPORT
ifeq ($(OSABL),YES)
HAS_OSABL_FUNC_SUPPORT=y
HAS_OSABL_OS_PCI_SUPPORT=y
HAS_OSABL_OS_USB_SUPPORT=y
HAS_OSABL_OS_RBUS_SUPPORT=n
HAS_OSABL_OS_AP_SUPPORT=y
HAS_OSABL_OS_STA_SUPPORT=y
endif
#endif // OS_ABL_FUNC_SUPPORT //

#ifdef LED_CONTROL_SUPPORT
HAS_LED_CONTROL_SUPPORT=n
#endif // LED_CONTROL_SUPPORT //

#ifdef CONFIG_WIFI_LED_SHARE 
HAS_WIFI_LED_SHARE=n
#endif // CONFIG_WIFI_LED_SHARE //

#Support WIDI feature
#Must enable HAS_WSC at the same time.
#ifdef WIDI_SUPPORT
HAS_WIDI_SUPPORT=n
HAS_INTEL_L2SD_TOGGLE_SCAN_SUPPORT=n
HAS_INTEL_WFD_SUPPORT=n
HAS_WFA_WFD_SUPPORT=n
#endif // HAS_WIDI_SUPPORT //

#ifdef TXBF_SUPPORT
HAS_TXBF_SUPPORT=n
HAS_VHT_TXBF_SUPPORT=n
HAS_STA_ITXBF_SUPPORT=n
#endif // TXBF_SUPPORT //

#ifdef STREAM_MODE_SUPPORT
HAS_STREAM_MODE_SUPPORT=n
#endif // STREAM_MODE_SUPPORT //

#ifdef NEW_RATE_ADAPT_SUPPORT
HAS_NEW_RATE_ADAPT_SUPPORT=n
#endif // NEW_RATE_ADAPT_SUPPORT //

#ifdef AGS_SUPPORT
HAS_RATE_ADAPT_AGS_SUPPORT=n
#endif // AGS_SUPPORT //

#ifdef DPA_S
HAS_DPA_S_SUPPORT=n
#endif 

#ifdef DPA_T
HAS_DPA_T_SUPPORT=n
#endif

#ifdef CONFIG_CSO_SUPPORT
#RT5572 RT5592
HAS_CSO_SUPPORT=n
#endif

#ifdef CONFIG_RX_CSO_SUPPORT
#MT7601
HAS_RX_CSO_SUPPORT=n
#endif

#ifdef CONFIG_TSO_SUPPORT
#RT6590 RT6570
HAS_TSO_SUPPORT=n
#endif

#ifdef WOW_SUPPORT
HAS_7603_WOW_SUPPORT=n
#endif

#ifdef THERMAL_PROTECT_SUPPORT
HAS_THERMAL_PROTECT_SUPPORT=n
#endif

#ifdef ANDES_FIRMWARE_SUPPORT
HAS_ANDES_FIRMWARE_SUPPORT=n
#endif

#ifdef HDR_TRANS_SUPPORT
HAS_HDR_TRANS_SUPPORT=n
#endif

#ifdef CONFIG_MULTI_CHANNEL
HAS_MULTI_CHANNEL=n
#endif /* CONFIG_MULTI_CHANNEL */

#ifdef MICROWAVE_OVEN_SUPPORT
HAS_MICROWAVE_OVEN_SUPPORT=n
#endif

#ifdef MAC_REPEATER_SUPPORT
HAS_MAC_REPEATER_SUPPORT=n
#endif

#ifdef CONFIG_SWITCH_CHANNEL_OFFLOAD
HAS_SWITCH_CHANNEL_OFFLOAD=n
#endif

HAS_RESOURCE_PRE_ALLOC=n
HAS_RESOURCE_BOOT_ALLOC=n
HAS_CONFIG_PRE_ALLOC=n

#ifdef CONFIG_FPGA_MODE
HAS_FPGA_MODE=n
#endif

#ifdef CONFIG_WIFI_TEST
HAS_WIFI_TEST=n
#endif

#ifdef CONFIG_SNIFFER_SUPPORT
HAS_SNIFFER_SUPPORT=n
#endif

#ifdef CONFIG_HOTSPOT
HAS_HOTSPOT_SUPPORT=n
#endif

#ifdef CONFIG_CALIBRATION_COLLECTION
HAS_CALIBRATION_COLLECTION_SUPPORT=y
#endif

#ifdef CONFIG_CAL_FREE_IC_SUPPORT
HAS_CAL_FREE_IC_SUPPORT=y
#endif

#ifdef CONFIG_TRACE_SUPPORT
HAS_TRACE_SUPPORT=n
#endif

#ifdef WIFI_REGION32_HIDDEN_SSID_SUPPORT
HAS_WIFI_REGION32_HIDDEN_SSID_SUPPORT=n
#endif // WIFI_REGION32_HIDDEN_SSID_SUPPORT //

#ifdef UAPSD_SUPPORT
HAS_UAPSD_SUPPORT=y
#endif

#ifdef MT_PS
HAS_MT_PS_SUPPORT=n
#endif

#Load FW one time
HAS_LOAD_FW_ONE_TIME=n

HAS_P2P_CHANNEL_LIST_SEPARATE=n

ifeq ($(PLATFORM),MSTAR)
#HAS_WSC=n
#HAS_WSC_V2=n
#HAS_IWSC_SUPPORT=n
#HAS_HE_SUPPORT=y
#HAS_HE_TV_SUPPORT=y
HAS_CFG80211_SUPPORT=y
HAS_CFG80211_P2P_SUPPORT=y
HAS_CFG80211_P2P_CONCURRENT_DEVICE=y
HAS_HE_BD_CFG80211_SUPPORT=n
HAS_MULTI_CHANNEL=n
HAS_WOW_IFDOWN_SUPPORT=y
HAS_MT_WOW_SUPPORT=y
#HAS_USB_BULK_BUF_ALIGMENT=y
#EXTRA_CFLAGS := $(WFLAGS)
endif
ifeq ($(PLATFORM),MT53XX)
#Support HE_SUPPORT
HAS_HE_SUPPORT=y
HAS_HE_TV_SUPPORT=y
HAS_7603_WOW_SUPPORT=y
HAS_USE_CHIP_DEPENDENT_PROFILE_NAME=y
endif


#ifdef WOW_SUPPORT
#HAS_WOW_SUPPORT: WOW function for old ralink chips
#HAS_NEW_WOW_SUPPORT: WOW function for 7601/7610/7662
#HAS_MT_WOW_SUPPORT: WOW function for 7603
#HAS_WOW_IFDOWN_SUPPORT: Enter WOW mode while ifconfig interface down
ifeq ($(HAS_7603_WOW_SUPPORT),y)
HAS_WOW_SUPPORT=n
HAS_WOW_IFDOWN_SUPPORT=y
HAS_NEW_WOW_SUPPORT=n
HAS_MT_WOW_SUPPORT=y
endif
#endif
#################################################

CC := $(CROSS_COMPILE)gcc
LD := $(CROSS_COMPILE)ld

WFLAGS := -Wall -Wstrict-prototypes -Wno-trigraphs
WFLAGS += -DAGGREGATION_SUPPORT -DPIGGYBACK_SUPPORT -DWMM_SUPPORT  -DLINUX -DENHANCED_STAT_DISPLAY
WFLAGS += -DSYSTEM_LOG_SUPPORT -DRT28xx_MODE=$(RT28xx_MODE) -DCHIPSET=$(MODULE) -DRESOURCE_PRE_ALLOC 
#WFLAGS += -DDBG_DIAGNOSE -DDBG_RX_MCS -DDBG_TX_MCS
#APsoc Specific
WFLAGS += -DCONFIG_RA_NAT_NONE
#end of /* APsoc Specific */

WFLAGS += -I$(RT28xx_DIR)/include

ifneq (,$(findstring MSTAR,$(PLATFORM)))
WFLAGS += -DMSTAR_SUPPORT
endif

ifeq ($(PREALLOC),YES)
WFLAGS += -DCONFIG_PRE_ALLOC
endif

ifeq ($(HAS_HE_BD_CFG80211_SUPPORT),y)
WFLAGS += -DHE_BD_CFG80211_SUPPORT
HAS_HT40_DISABLE_SHORT_GI=y
HAS_BSS_COEX_DISABLE=y
endif

#ifeq ($(HAS_HE_BD_KERNEL_SUPPORT),y)
#WFLAGS += -DBD_KERNEL_VER
#endif

ifeq ($(HAS_WEPAUTO_OPEN_FIRST_SUPPORT),y)
WFLAGS += -DWEPAUTO_OPEN_FIRST
endif


#ifdef DPA_S
ifeq ($(HAS_DPA_S_SUPPORT),y)
WFLAGS += -DDPA_S
endif
#endif 

#ifdef DPA_T
ifeq ($(HAS_DPA_T_SUPPORT),y)
WFLAGS += -DDPA_T
endif
#endif 

#ifdef RELEASE_EXCLUDE
#removed for building in RT3052 ApSoc SDK
ifneq ($(PLATFORM),RALINK_3052)
ifneq ($(PLATFORM),DM6446)
#WFLAGS += -Wpointer-sign
endif
endif
#endif // RELEASE_EXCLUDE //

#ifdef RELEASE_EXCLUDE
ifeq ($(HAS_GPL_ALGORITHM_SUPPORT),y)
WFLAGS += -DCRYPT_GPL_ALGORITHM
endif
#endif // RELEASE_EXCLUDE //

ifeq ($(HAS_HE_SUPPORT),y)
WFLAGS += -DHE_SUPPORT
WFLAGS += -DIP_ASSEMBLY
endif

ifeq ($(HAS_MULTI_INF),y)
WFLAGS += -DMULTI_INF_SUPPORT
endif

ifeq ($(HAS_KTHREAD_SUPPORT),y)
WFLAGS += -DKTHREAD_SUPPORT
endif

ifeq ($(HAS_RTMP_FLASH_SUPPORT),y)
WFLAGS += -DRTMP_FLASH_SUPPORT
endif

ifeq ($(HAS_STREAM_MODE_SUPPORT),y)
WFLAGS += -DSTREAM_MODE_SUPPORT
endif

ifeq ($(HAS_SINGLE_SKU_SUPPORT),y)
WFLAGS += -DSINGLE_SKU
endif

ifeq ($(HAS_SINGLE_SKU_V2_SUPPORT),y)
WFLAGS += -DSINGLE_SKU_V2
endif

ifeq ($(HAS_DOT11_VHT_SUPPORT),y)
WFLAGS += -DDOT11_VHT_AC
endif

#ifdef ANDES_FIRMWARE_SUPPORT
ifeq ($(HAS_ANDES_FIRMWARE_SUPPORT),y)
WFLAGS += -DANDES_FIRMWARE_SUPPORT
endif
#endif /* ANDES_FIRMWARE_SUPPORT */

#ifdef HDR_TRANS_SUPPORT
ifeq ($(HAS_HDR_TRANS_SUPPORT),y)
WFLAGS += -DHDR_TRANS_SUPPORT
endif
#endif /* HDR_TRANS_SUPPORT */

#ifdef MAC_REPEATER_SUPPORT
ifeq ($(HAS_MAC_REPEATER_SUPPORT),y)
WFLAGS += -DMAC_REPEATER_SUPPORT
endif
#endif /* MAC_REPEATER_SUPPORT */

ifeq ($(HAS_THERMAL_PROTECT_SUPPORT),y)
WFLAGS += -DTHERMAL_PROTECT_SUPPORT
endif

ifeq ($(HAS_ATE),y)
WFLAGS += -DCONFIG_ATE
WFLAGS += -DCONFIG_RT2880_ATE_CMD_NEW
WFLAGS += -I$(RT28xx_DIR)/ate/include

ifeq ($(HAS_QA_SUPPORT),y)
WFLAGS += -DCONFIG_QA
endif

endif

ifeq ($(HAS_CAL_FREE_IC_SUPPORT),y)
WFLAGS += -DCAL_FREE_IC_SUPPORT
endif


ifeq ($(HAS_SUPPORT_ACS_ALL_CHANNEL_RANK),y)
WFLAGS += -DSUPPORT_ACS_ALL_CHANNEL_RANK
endif

ifeq ($(HAS_SUPPORT_ACS_BY_SCAN),y)
WFLAGS += -DSUPPORT_ACS_BY_SCAN
endif

#ifdef UAPSD_SUPPORT
ifeq ($(HAS_UAPSD_SUPPORT),y)
WFLAGS += -DUAPSD_SUPPORT
endif
#endif

ifeq ($(HAS_MT_PS_SUPPORT),y)
WFLAGS += -DMT_PS
endif

ifeq ($(HAS_P2P_CHANNEL_LIST_SEPARATE),y)
WFLAGS += -DP2P_CHANNEL_LIST_SEPARATE
endif

ifeq ($(HAS_LOAD_FW_ONE_TIME),y)
WFLAGS += -DLOAD_FW_ONE_TIME
endif


###############################################################################
#
# config for AP mode
#
###############################################################################

#ifdef CONFIG_AP_SUPPORT

ifeq ($(RT28xx_MODE),AP)
WFLAGS += -DCONFIG_AP_SUPPORT -DMBSS_SUPPORT -DIAPP_SUPPORT  -DDOT1X_SUPPORT -DAP_SCAN_SUPPORT -DSCAN_SUPPORT
WFLAGS += -DDBG
ifeq ($(HAS_APCLI_WPA_SUPPLICANT),y)
WFLAGS += -DApCli_WPA_SUPPLICANT_SUPPORT
endif

ifeq ($(HAS_HOSTAPD_SUPPORT),y)
WFLAGS += -DHOSTAPD_SUPPORT
endif

#ifdef RSSI_FEEDBACK
ifeq ($(HAS_RSSI_FEEDBACK),y)
WFLAGS += -DRSSI_FEEDBACK
endif
#endif // RSSI_FEEDBACK //

#ifdef GEMTEK_ATE
ifeq ($(RELEASE), DPB)
WFLAGS += -DGEMTEK_ATE
endif
#endif // GEMTEK_ATE //

#ifdef NINTENDO_AP
ifeq ($(HAS_NINTENDO),y)
WFLAGS += -DNINTENDO_AP
endif
#endif // NINTENDO_AP //

#ifdef WSC_INCLUDED
ifeq ($(HAS_WSC),y)
WFLAGS += -DWSC_AP_SUPPORT

ifeq ($(HAS_WSC_V2),y)
WFLAGS += -DWSC_V2_SUPPORT
endif
ifeq ($(HAS_WSC_LED),y)
WFLAGS += -DWSC_LED_SUPPORT
endif
ifeq ($(HAS_WSC_NFC),y)
WFLAGS += -DWSC_NFC_SUPPORT
endif
endif
#endif // WSC_INCLUDED //

#ifdef EASY_CONFIG_SETUP
ifeq ($(HAS_EASY_CONFIG_SETUP_SUPPORT),y)
WFLAGS += -DEASY_CONFIG_SETUP -DWAC_SUPPORT
endif
#endif // EASY_CONFIG_SETUP //

#ifdef WDS_SUPPORT
ifeq ($(HAS_WDS),y)
WFLAGS += -DWDS_SUPPORT
endif
#endif // WDS_SUPPORT //

#ifdef APCLI_SUPPORT
ifeq ($(HAS_APCLI),y)
WFLAGS += -DAPCLI_SUPPORT -DMAT_SUPPORT -DAP_SCAN_SUPPORT -DSCAN_SUPPORT #-DAPCLI_AUTO_CONNECT_SUPPORT
#ifeq ($(HAS_ETH_CONVERT_SUPPORT), y)
#WFLAGS += -DETH_CONVERT_SUPPORT
#endif 
endif
#endif // APCLI_SUPPORT //

ifeq ($(HAS_IGMP_SNOOP_SUPPORT),y)
WFLAGS += -DIGMP_SNOOP_SUPPORT
endif

ifeq ($(HAS_CS_SUPPORT),y)
WFLAGS += -DCARRIER_DETECTION_SUPPORT
endif

ifeq ($(HAS_MCAST_RATE_SPECIFIC_SUPPORT), y)
WFLAGS += -DMCAST_RATE_SPECIFIC
endif

ifneq ($(findstring 2860,$(CHIPSET)),)
ifeq ($(HAS_MSI_SUPPORT),y)
WFLAGS += -DPCI_MSI_SUPPORT
endif
endif

#ifdef WMM_ACM_SUPPORT
ifeq ($(HAS_WMM_ACM_SUPPORT),y)
WFLAGS += -DWMM_ACM_SUPPORT
endif
#endif // WMM_ACM_SUPPORT //

ifeq ($(HAS_QOS_DLS_SUPPORT),y)
WFLAGS += -DQOS_DLS_SUPPORT
endif

ifeq ($(HAS_SNMP_SUPPORT),y)
WFLAGS += -DSNMP_SUPPORT
endif

#ifdef DOT11_N_SUPPORT
ifeq ($(HAS_DOT11_N_SUPPORT),y)
WFLAGS += -DDOT11_N_SUPPORT

#ifdef DOT11N_DRAFT3
ifeq ($(HAS_DOT11N_DRAFT3_SUPPORT),y)
WFLAGS += -DDOT11N_DRAFT3
endif
#endif // DOT11N_DRAFT3 //

#ifdef TXBF_SUPPORT
ifeq ($(HAS_TXBF_SUPPORT),y)
WFLAGS += -DTXBF_SUPPORT
endif

ifeq ($(HAS_VHT_TXBF_SUPPORT),y)
WFLAGS += -DVHT_TXBF_SUPPORT
endif

ifeq ($(HAS_STA_ITXBF_SUPPORT), y)
WFLAGS += -DSTA_ITXBF_SUPPORT
endif
#endif // TXBF_SUPPORT //

#ifdef NEW_RATE_ADAPT_SUPPORT
ifeq ($(HAS_NEW_RATE_ADAPT_SUPPORT),y)
WFLAGS += -DNEW_RATE_ADAPT_SUPPORT
endif
#endif // NEW_RATE_ADAPT_SUPPORT //

#ifdef AGS_SUPPORT
ifeq ($(HAS_RATE_ADAPT_AGS_SUPPORT),y)
WFLAGS += -DAGS_SUPPORT
endif
#endif // AGS_SUPPORT //

ifeq ($(HAS_GREENAP_SUPPORT),y)
WFLAGS += -DGREENAP_SUPPORT
endif

endif
#endif // DOT11_N_SUPPORT //

ifeq ($(HAS_AUTO_CH_SELECT_ENHANCE),y)
WFLAGS += -DAUTO_CH_SELECT_ENHANCE
endif

ifeq ($(HAS_STATS_COUNT),y)
WFLAGS += -DSTATS_COUNT_SUPPORT
endif

ifeq ($(HAS_TSSI_ANTENNA_VARIATION),y)
WFLAGS += -DTSSI_ANTENNA_VARIATION
endif

ifeq ($(HAS_USB_BULK_BUF_ALIGMENT),y)
WFLAGS += -DUSB_BULK_BUF_ALIGMENT
endif

ifeq ($(HAS_CFG80211_SUPPORT),y)
ifeq ($(HAS_CFG80211_BUILD_CHANNEL_LIST),y)
WFLAGS += -DRT_CFG80211_SUPPORT -DCFG80211_BUILD_CHANNEL_LIST -DWPA_SUPPLICANT_SUPPORT
else
WFLAGS += -DRT_CFG80211_SUPPORT -DEXT_BUILD_CHANNEL_LIST -DWPA_SUPPLICANT_SUPPORT
endif
ifeq ($(HAS_RFKILL_HW_SUPPORT),y)
WFLAGS += -DRFKILL_HW_SUPPORT
endif
ifeq ($(HAS_CFG80211_SCAN_SIGNAL_AVG_SUPPORT),y)
WFLAGS += -DCFG80211_SCAN_SIGNAL_AVG
endif
ifeq ($(HAS_CFG80211_P2P_SUPPORT),y)
WFLAGS += -DRT_CFG80211_P2P_SUPPORT
WFLAGS += -DCONFIG_AP_SUPPORT -DMBSS_SUPPORT -DAP_SCAN_SUPPORT
WFLAGS += -DAPCLI_SUPPORT -DUAPSD_SUPPORT
ifeq ($(HAS_CFG80211_P2P_SINGLE_DEVICE),y)
WFLAGS += -DRT_CFG80211_P2P_SINGLE_DEVICE
else
ifeq ($(HAS_CFG80211_P2P_STATIC_CONCURRENT_DEVICE),y)
WFLAGS += -DRT_CFG80211_P2P_STATIC_CONCURRENT_DEVICE
else
WFLAGS += -DRT_CFG80211_P2P_CONCURRENT_DEVICE
ifeq ($(HAS_CFG80211_P2P_MULTI_CHAN_SUPPORT),y)
WFLAGS += -DMULTI_WMM_SUPPORT #-DRT_CFG80211_P2P_MULTI_CHAN_SUPPORT
endif	
endif
endif
endif
ifeq ($(HAS_CFG80211_ANDROID_PRIV_LIB_SUPPORT),y)
WFLAGS += -DRT_RT_CFG80211_ANDROID_PRIV_LIB_SUPPORT
endif
ifeq ($(HAS_CFG80211_TDLS_SUPPORT),y)
WFLAGS += -DCFG_TDLS_SUPPORT -DUAPSD_SUPPORT
endif
endif

ifeq ($(OSABL),YES)
WFLAGS += -DOS_ABL_SUPPORT
ifeq ($(HAS_OSABL_FUNC_SUPPORT),y)
WFLAGS += -DOS_ABL_FUNC_SUPPORT
endif
ifeq ($(HAS_OSABL_OS_PCI_SUPPORT),y)
WFLAGS += -DOS_ABL_OS_PCI_SUPPORT
endif
ifeq ($(HAS_OSABL_OS_USB_SUPPORT),y)
WFLAGS += -DOS_ABL_OS_USB_SUPPORT
endif
ifeq ($(HAS_OSABL_OS_RBUS_SUPPORT),y)
WFLAGS += -DOS_ABL_OS_RBUS_SUPPORT
endif
ifeq ($(HAS_OSABL_OS_AP_SUPPORT),y)
WFLAGS += -DOS_ABL_OS_AP_SUPPORT
endif
ifeq ($(HAS_OSABL_OS_STA_SUPPORT),y)
WFLAGS += -DOS_ABL_OS_STA_SUPPORT
endif
endif

#ifdef ANT_DIVERSITY_SUPPORT
ifeq ($(HAS_ANTENNA_DIVERSITY_SUPPORT),y)
WFLAGS += -DANT_DIVERSITY_SUPPORT
endif
#endif // ANT_DIVERSITY_SUPPORT //

#ifdef TXRX_SW_ANTDIV_SUPPORT
ifeq ($(HAS_TXRX_SW_ANTDIV_SUPPORT),y)
WFLAGS += -DTXRX_SW_ANTDIV_SUPPORT
endif
#endif // TXRX_SW_ANTDIV_SUPPORT //

#ifdef RELEASE_EXCLUDE
#ifdef HW_COEXISTENCE_SUPPORT
ifeq ($(HAS_HW_COEXISTENCE_SUPPORT),y)
WFLAGS += -DHW_COEXISTENCE_SUPPORT
endif
#endif // HW_COEXISTENCE_SUPPORT //
#endif //RELEASE_EXCLUDE //

endif #// endif of RT2860_MODE == AP //
#endif // CONFIG_AP_SUPPORT //

########################################################
#
# config for STA mode
#
########################################################

#ifdef CONFIG_STA_SUPPORT

ifeq ($(RT28xx_MODE),STA)
WFLAGS += -DCONFIG_STA_SUPPORT -DSCAN_SUPPORT -DDBG
ifeq ($(HAS_MT76XX_BT_COEXISTENCE_SUPPORT),y)
WFLAGS += -DMT76XX_BTCOEX_SUPPORT
endif

#ifdef XLINK_SUPPORT
ifeq ($(HAS_XLINK),y)
WFLAGS += -DXLINK_SUPPORT
endif
#endif // XLINK_SUPPORT //

#ifdef ADHOC_WPA2PSK_SUPPORT
WFLAGS += -DADHOC_WPA2PSK_SUPPORT
#endif // ADHOC_WPA2PSK_SUPPORT //

#ifdef WPA_SUPPLICANT_SUPPORT
ifeq ($(HAS_WPA_SUPPLICANT),y)
WFLAGS += -DWPA_SUPPLICANT_SUPPORT
#ifdef NATIVE_WPA_SUPPLICANT_SUPPORT
ifeq ($(HAS_NATIVE_WPA_SUPPLICANT_SUPPORT),y)
WFLAGS += -DNATIVE_WPA_SUPPLICANT_SUPPORT
endif
#endif // NATIVE_WPA_SUPPLICANT_SUPPORT //
endif
#endif // WPA_SUPPLICANT_SUPPORT //

#ifdef WSC_INCLUDED
ifeq ($(HAS_WSC),y)
WFLAGS += -DWSC_STA_SUPPORT
ifeq ($(HAS_WSC_V2),y)
WFLAGS += -DWSC_V2_SUPPORT
endif
ifeq ($(HAS_WSC_LED),y)
WFLAGS += -DWSC_LED_SUPPORT
endif
ifeq ($(HAS_IWSC_SUPPORT),y)
WFLAGS += -DIWSC_SUPPORT
endif
endif
#endif // WSC_INCLUDED //

#ifdef STA_EASY_CONFIG_SETUP
ifeq ($(HAS_WSC),y)
ifeq ($(HAS_EASY_CONFIG_SETUP_SUPPORT),y)
WFLAGS += -DEASY_CONFIG_SETUP -DSTA_EASY_CONFIG_SETUP -DWAC_SUPPORT
endif
endif
#endif // STA_EASY_CONFIG_SETUP //

#ifdef ETH_CONVERT_SUPPORT
ifeq ($(HAS_ETH_CONVERT_SUPPORT), y)
WFLAGS += -DETH_CONVERT_SUPPORT  -DMAT_SUPPORT
endif
#endif // ETH_CONVERT_SUPPORT //

#ifdef WMM_ACM_SUPPORT
ifeq ($(HAS_WMM_ACM_SUPPORT),y)
WFLAGS += -DWMM_ACM_SUPPORT
endif
#endif // WMM_ACM_SUPPORT //

ifeq ($(HAS_SNMP_SUPPORT),y)
WFLAGS += -DSNMP_SUPPORT
endif

ifeq ($(HAS_QOS_DLS_SUPPORT),y)
WFLAGS += -DQOS_DLS_SUPPORT
endif

#ifdef DOT11_N_SUPPORT
ifeq ($(HAS_DOT11_N_SUPPORT),y)
WFLAGS += -DDOT11_N_SUPPORT

#ifdef DOT11N_DRAFT3
ifeq ($(HAS_DOT11N_DRAFT3_SUPPORT),y)
WFLAGS += -DDOT11N_DRAFT3
endif
#endif // DOT11N_DRAFT3 //

#ifdef TXBF_SUPPORT
ifeq ($(HAS_TXBF_SUPPORT),y)
WFLAGS += -DTXBF_SUPPORT
endif

ifeq ($(HAS_VHT_TXBF_SUPPORT),y)
WFLAGS += -DVHT_TXBF_SUPPORT
endif

ifeq ($(HAS_STA_ITXBF_SUPPORT), y)
WFLAGS += -DSTA_ITXBF_SUPPORT
endif
#endif // TXBF_SUPPORT //

#ifdef NEW_RATE_ADAPT_SUPPORT
ifeq ($(HAS_NEW_RATE_ADAPT_SUPPORT),y)
WFLAGS += -DNEW_RATE_ADAPT_SUPPORT
endif
#endif // NEW_RATE_ADAPT_SUPPORT //

endif
#endif // DOT11_N_SUPPORT //

#ifdef DOT11Z_TDLS_SUPPORT
ifeq ($(HAS_DOT11Z_TDLS_SUPPORT),y)
WFLAGS += -DDOT11Z_TDLS_SUPPORT -DUAPSD_SUPPORT
endif
#endif // DOT11Z_TDLS_SUPPORT //

ifeq ($(HAS_WFD_SUPPORT),y)
HAS_P2P_SUPPORT=y
HAS_P2P_ODD_MAC_ADJUST=y
HAS_P2P_SPECIFIC_WIRELESS_EVENT=y
WFLAGS += -DWFD_SUPPORT
endif


ifeq ($(HAS_USB_BULK_BUF_ALIGMENT),y)
WFLAGS += -DUSB_BULK_BUF_ALIGMENT
endif



#ifdef P2P_SUPPORT
ifeq ($(HAS_P2P_SUPPORT),y)
WFLAGS += -DP2P_SUPPORT -DAPCLI_SUPPORT -DAP_SCAN_SUPPORT -DSCAN_SUPPORT -DP2P_APCLI_SUPPORT -DCONFIG_AP_SUPPORT -DCONFIG_APSTA_MIXED_SUPPORT -DUAPSD_SUPPORT -DMBSS_SUPPORT -DIAPP_SUPPORT -DDOT1X_SUPPORT -DWSC_AP_SUPPORT -DWSC_STA_SUPPORT
endif

ifeq ($(HAS_P2P_ODD_MAC_ADJUST),y)
WFLAGS += -DP2P_ODD_MAC_ADJUST
endif

ifeq ($(HAS_P2P_SPECIFIC_WIRELESS_EVENT),y)
WFLAGS += -DRT_P2P_SPECIFIC_WIRELESS_EVENT
endif
#endif // P2P_SUPPORT //

ifeq ($(HAS_CS_SUPPORT),y)
WFLAGS += -DCARRIER_DETECTION_SUPPORT
endif

ifeq ($(HAS_STATS_COUNT),y)
WFLAGS += -DSTATS_COUNT_SUPPORT
endif

ifeq ($(HAS_TSSI_ANTENNA_VARIATION),y)
WFLAGS += -DTSSI_ANTENNA_VARIATION
endif

ifeq ($(HAS_ANDROID_SUPPORT),y)
WFLAGS += -DANDROID_SUPPORT
endif

ifeq ($(HAS_IFUP_IN_PROBE_SUPPORT),y)
WFLAGS += -DIFUP_IN_PROBE
endif

ifeq ($(HAS_USB_SUPPORT_SELECTIVE_SUSPEND),y)
WFLAGS += -DUSB_SUPPORT_SELECTIVE_SUSPEND
endif

ifeq ($(HAS_USB_FIRMWARE_MULTIBYTE_WRITE),y)
WFLAGS += -DUSB_FIRMWARE_MULTIBYTE_WRITE -DMULTIWRITE_BYTES=4
endif

ifeq ($(HAS_CFG80211_SUPPORT),y)
ifeq ($(HAS_CFG80211_BUILD_CHANNEL_LIST),y)
WFLAGS += -DRT_CFG80211_SUPPORT -DCFG80211_BUILD_CHANNEL_LIST -DWPA_SUPPLICANT_SUPPORT
else
WFLAGS += -DRT_CFG80211_SUPPORT -DEXT_BUILD_CHANNEL_LIST -DWPA_SUPPLICANT_SUPPORT
endif
ifeq ($(HAS_RFKILL_HW_SUPPORT),y)
WFLAGS += -DRFKILL_HW_SUPPORT
endif
ifeq ($(HAS_CFG80211_SCAN_SIGNAL_AVG_SUPPORT),y)
WFLAGS += -DCFG80211_SCAN_SIGNAL_AVG
endif
ifeq ($(HAS_CFG80211_MULTI_STA_SUPPORT),y)
WFLAGS += -DCFG80211_MULTI_STA -DCONFIG_AP_SUPPORT -DAPCLI_SUPPORT
WFLAGS += -DMBSS_SUPPORT -DAP_SCAN_SUPPORT -DMULTI_WMM_SUPPORT
endif
ifeq ($(HAS_CFG80211_P2P_SUPPORT),y)
WFLAGS += -DRT_CFG80211_P2P_SUPPORT -DMBSS_SUPPORT -DAP_SCAN_SUPPORT 
WFLAGS += -DCONFIG_AP_SUPPORT -DAPCLI_SUPPORT -DUAPSD_SUPPORT
ifeq ($(HAS_CFG80211_P2P_SINGLE_DEVICE),y)
WFLAGS += -DRT_CFG80211_P2P_SINGLE_DEVICE
else
ifeq ($(HAS_CFG80211_P2P_STATIC_CONCURRENT_DEVICE),y)
WFLAGS += -DRT_CFG80211_P2P_STATIC_CONCURRENT_DEVICE
else
WFLAGS += -DRT_CFG80211_P2P_CONCURRENT_DEVICE
ifeq ($(HAS_CFG80211_P2P_MULTI_CHAN_SUPPORT),y)
WFLAGS +=  -DMULTI_WMM_SUPPORT #-DRT_CFG80211_P2P_MULTI_CHAN_SUPPORT
endif #HAS_CFG80211_P2P_MULTI_CHAN_SUPPORT 
endif #HAS_CFG80211_P2P_STATIC_CONCURRENT_DEVICE
endif #HAS_CFG80211_P2P_SINGLE_DEVICE
endif #HAS_CFG80211_P2P_SUPPORT
ifeq ($(HAS_CFG80211_ANDROID_PRIV_LIB_SUPPORT),y)
WFLAGS += -DRT_RT_CFG80211_ANDROID_PRIV_LIB_SUPPORT
endif #HAS_CFG80211_ANDROID_PRIV_LIB_SUPPORT
ifeq ($(HAS_CFG80211_TDLS_SUPPORT),y)
WFLAGS += -DCFG_TDLS_SUPPORT -DUAPSD_SUPPORT
endif
endif

ifeq ($(OSABL),YES)
WFLAGS += -DOS_ABL_SUPPORT
ifeq ($(HAS_OSABL_FUNC_SUPPORT),y)
WFLAGS += -DOS_ABL_FUNC_SUPPORT
endif
ifeq ($(HAS_OSABL_OS_PCI_SUPPORT),y)
WFLAGS += -DOS_ABL_OS_PCI_SUPPORT
endif
ifeq ($(HAS_OSABL_OS_USB_SUPPORT),y)
WFLAGS += -DOS_ABL_OS_USB_SUPPORT
endif
ifeq ($(HAS_OSABL_OS_RBUS_SUPPORT),y)
WFLAGS += -DOS_ABL_OS_RBUS_SUPPORT
endif
ifeq ($(HAS_OSABL_OS_AP_SUPPORT),y)
WFLAGS += -DOS_ABL_OS_AP_SUPPORT
endif
ifeq ($(HAS_OSABL_OS_STA_SUPPORT),y)
WFLAGS += -DOS_ABL_OS_STA_SUPPORT
endif
endif

#ifdef ANT_DIVERSITY_SUPPORT
ifeq ($(HAS_ANTENNA_DIVERSITY_SUPPORT),y)
WFLAGS += -DANT_DIVERSITY_SUPPORT
endif
#endif // ANT_DIVERSITY_SUPPORT //

#ifdef TXRX_SW_ANTDIV_SUPPORT
ifeq ($(HAS_TXRX_SW_ANTDIV_SUPPORT),y)
WFLAGS += -DTXRX_SW_ANTDIV_SUPPORT
endif
#endif // TXRX_SW_ANTDIV_SUPPORT //

#ifdef RELEASE_EXCLUDE
#ifdef HW_COEXISTENCE_SUPPORT
ifeq ($(HAS_HW_COEXISTENCE_SUPPORT),y)
WFLAGS += -DHW_COEXISTENCE_SUPPORT
endif
#endif // HW_COEXISTENCE_SUPPORT //

#ifdef BT_COEXISTENCE_SUPPORT
ifeq ($(HAS_BT_COEXISTENCE_SUPPORT),y)
WFLAGS += -DHW_COEXISTENCE_SUPPORT -DBT_COEXISTENCE_SUPPORT
endif
#endif // BT_COEXISTENCE_SUPPORT //
#endif //RELEASE_EXCLUDE //

ifeq ($(HAS_WIDI_SUPPORT),y)
WFLAGS += -DWIDI_SUPPORT

ifeq ($(HAS_INTEL_L2SD_TOGGLE_SCAN_SUPPORT),y)
WFLAGS += -DINTEL_L2SD_TOGGLE_SCAN_SUPPORT
endif

ifeq ($(HAS_P2P_SUPPORT),y)
ifeq ($(HAS_INTEL_WFD_SUPPORT),y)
WFLAGS += -DINTEL_WFD_SUPPORT
endif

ifeq ($(HAS_WFA_WFD_SUPPORT),y)
WFLAGS += -DWFA_WFD_SUPPORT
endif
endif

endif

#ifdef WOW_SUPPORT
ifeq ($(HAS_WOW_SUPPORT),y)
WFLAGS += -DWOW_SUPPORT
endif
#endif // WOW_SUPPORT //

#ifdef WOW_IFDOWN_SUPPORT
ifeq ($(HAS_WOW_IFDOWN_SUPPORT),y)
WFLAGS += -DWOW_IFDOWN_SUPPORT
endif
#endif // WOW_IFDOWN_SUPPORT //

ifeq ($(HAS_NEW_WOW_SUPPORT),y)
WFLAGS += -DNEW_WOW_SUPPORT
endif

ifeq ($(HAS_MT_WOW_SUPPORT),y)
WFLAGS += -DMT_WOW_SUPPORT
endif

endif
# endif of ifeq ($(RT28xx_MODE),STA)
#endif // CONFIG_STA_SUPPORT //

###########################################################
#
# config for APSTA
#
###########################################################

#ifdef CONFIG_APSTA_SUPPORT

ifeq ($(RT28xx_MODE),APSTA)
WFLAGS += -DCONFIG_AP_SUPPORT -DCONFIG_STA_SUPPORT -DCONFIG_APSTA_MIXED_SUPPORT -DUAPSD_SUPPORT -DMBSS_SUPPORT -DIAPP_SUPPORT -DDOT1X_SUPPORT -DAP_SCAN_SUPPORT -DSCAN_SUPPORT -DDBG

#ifdef NINTENDO_AP
ifeq ($(HAS_NINTENDO),y)
WFLAGS += -DNINTENDO_AP
endif
#endif // NINTENDO_AP //

#ifdef WSC_INCLUDED
ifeq ($(HAS_WSC),y)
WFLAGS += -DWSC_AP_SUPPORT -DWSC_STA_SUPPORT
endif
#endif // WSC_INCLUDED //

#ifdef WDS_SUPPORT
ifeq ($(HAS_WDS),y)
WFLAGS += -DWDS_SUPPORT
endif
#endif // WDS_SUPPORT //

#ifdef APCLI_SUPPORT
ifeq ($(HAS_APCLI),y)
WFLAGS += -DAPCLI_SUPPORT -DMAT_SUPPORT
endif
#endif // APCLI_SUPPORT //

ifeq ($(HAS_IGMP_SNOOP_SUPPORT),y)
WFLAGS += -DIGMP_SNOOP_SUPPORT
endif

ifeq ($(HAS_CS_SUPPORT),y)
WFLAGS += -DCARRIER_DETECTION_SUPPORT
endif

ifeq ($(HAS_MCAST_RATE_SPECIFIC_SUPPORT), y)
WFLAGS += -DMCAST_RATE_SPECIFIC
endif

ifeq ($(HAS_QOS_DLS_SUPPORT),y)
WFLAGS += -DQOS_DLS_SUPPORT
endif

#ifdef WPA_SUPPLICANT_SUPPORT
ifeq ($(HAS_WPA_SUPPLICANT),y)
WFLAGS += -DWPA_SUPPLICANT_SUPPORT
#ifdef NATIVE_WPA_SUPPLICANT_SUPPORT
ifeq ($(HAS_NATIVE_WPA_SUPPLICANT_SUPPORT),y)
WFLAGS += -DNATIVE_WPA_SUPPLICANT_SUPPORT
endif
#endif // NATIVE_WPA_SUPPLICANT_SUPPORT //
endif
#endif // WPA_SUPPLICANT_SUPPORT //

#ifdef ETH_CONVERT_SUPPORT
ifeq ($(HAS_ETH_CONVERT_SUPPORT), y)
WFLAGS += -DETH_CONVERT_SUPPORT  -DMAT_SUPPORT
endif
#endif // ETH_CONVERT_SUPPORT //

#ifdef DOT11_N_SUPPORT
ifeq ($(HAS_DOT11_N_SUPPORT),y)
WFLAGS += -DDOT11_N_SUPPORT
endif

#ifdef TXBF_SUPPORT
ifeq ($(HAS_TXBF_SUPPORT),y)
WFLAGS += -DTXBF_SUPPORT
endif

ifeq ($(HAS_VHT_TXBF_SUPPORT),y)
WFLAGS += -DVHT_TXBF_SUPPORT
endif

ifeq ($(HAS_STA_ITXBF_SUPPORT), y)
WFLAGS += -DSTA_ITXBF_SUPPORT
endif
#endif // TXBF_SUPPORT //

#ifdef NEW_RATE_ADAPT_SUPPORT
ifeq ($(HAS_NEW_RATE_ADAPT_SUPPORT),y)
WFLAGS += -DNEW_RATE_ADAPT_SUPPORT
endif
#endif // NEW_RATE_ADAPT_SUPPORT //

#endif // DOT11_N_SUPPORT //

ifeq ($(HAS_CS_SUPPORT),y)
WFLAGS += -DCARRIER_DETECTION_SUPPORT
endif

ifeq ($(HAS_STATS_COUNT),y)
WFLAGS += -DSTATS_COUNT_SUPPORT
endif

ifeq ($(HAS_TSSI_ANTENNA_VARIATION),y)
WFLAGS += -DTSSI_ANTENNA_VARIATION
endif

ifeq ($(HAS_CFG80211_SUPPORT),y)
WFLAGS += -DRT_CFG80211_SUPPORT -DWPA_SUPPLICANT_SUPPORT
ifeq ($(HAS_RFKILL_HW_SUPPORT),y)
WFLAGS += -DRFKILL_HW_SUPPORT
endif
ifeq ($(HAS_CFG80211_SCAN_SIGNAL_AVG_SUPPORT),y)
WFLAGS += -DCFG80211_SCAN_SIGNAL_AVG
endif
endif

ifeq ($(OSABL),YES)
WFLAGS += -DOS_ABL_SUPPORT
ifeq ($(HAS_OSABL_FUNC_SUPPORT),y)
WFLAGS += -DOS_ABL_FUNC_SUPPORT
endif
ifeq ($(HAS_OSABL_OS_PCI_SUPPORT),y)
WFLAGS += -DOS_ABL_OS_PCI_SUPPORT
endif
ifeq ($(HAS_OSABL_OS_USB_SUPPORT),y)
WFLAGS += -DOS_ABL_OS_USB_SUPPORT
endif
ifeq ($(HAS_OSABL_OS_RBUS_SUPPORT),y)
WFLAGS += -DOS_ABL_OS_RBUS_SUPPORT
endif
ifeq ($(HAS_OSABL_OS_AP_SUPPORT),y)
WFLAGS += -DOS_ABL_OS_AP_SUPPORT
endif
ifeq ($(HAS_OSABL_OS_STA_SUPPORT),y)
WFLAGS += -DOS_ABL_OS_STA_SUPPORT
endif
endif

ifeq ($(HAS_P2P_SUPPORT),y)
WFLAGS += -DP2P_SUPPORT
WFLAGS += -DAPCLI_SUPPORT -DAP_SCAN_SUPPORT -DSCAN_SUPPORT -DP2P_APCLI_SUPPORT
endif

endif
# endif of ifeq ($(RT28xx_MODE),APSTA)
#endif // CONFIG_APSTA_SUPPORT //


##########################################################
#
# Common compiler flag
#
##########################################################

#ifdef RELEASE_EXCLUDE
#Remove internal debug code when offical release 
WFLAGS += -DRELEASE_EXCLUDE
#endif // RELEASE_EXCLUDE //

#ifdef MESH_SUPPORT
ifeq ($(HAS_MESH_SUPPORT),y)
WFLAGS += -DMESH_SUPPORT -DINTEL_CMPC -DAP_SCAN_SUPPORT -DSCAN_SUPPORT
endif
#endif // MESH_SUPPORT //

#ifdef DOT11R_FT_SUPPORT
ifeq ($(HAS_DOT11R_FT_SUPPORT),y)
WFLAGS += -DDOT11R_FT_SUPPORT
endif
#endif // DOT11R_FT_SUPPORT //

#ifdef DOT11K_RRM_SUPPORT
ifeq ($(HAS_DOT11K_RRM_SUPPORT),y)
WFLAGS += -DDOT11K_RRM_SUPPORT -DAP_SCAN_SUPPORT -DSCAN_SUPPORT
endif
#endif // DOT11K_RRM_SUPPORT //

#ifdef DOT11V_WNM_SUPPORT
ifeq ($(HAS_DOT11V_WNM_SUPPORT),y)
WFLAGS += -DDOT11V_WNM_SUPPORT
endif
#endif // DOT11V_WNM_SUPPORT //

ifeq ($(HAS_EXT_BUILD_CHANNEL_LIST),y)
WFLAGS += -DEXT_BUILD_CHANNEL_LIST
endif

ifeq ($(HAS_IDS_SUPPORT),y)
WFLAGS += -DIDS_SUPPORT
endif

#ifdef WAPI_SUPPORT
ifeq ($(HAS_WAPI_SUPPORT),y)
WFLAGS += -DWAPI_SUPPORT -DSOFT_ENCRYPT -DEXPORT_SYMTAB
endif
#endif // WAPI_SUPPORT //

ifeq ($(OSABL),YES)
WFLAGS += -DEXPORT_SYMTAB
endif

ifeq ($(HAS_CLIENT_WDS_SUPPORT),y)
WFLAGS += -DCLIENT_WDS
endif

ifeq ($(HAS_BGFP_SUPPORT),y)
WFLAGS += -DBG_FT_SUPPORT
endif

ifeq ($(HAS_BGFP_OPEN_SUPPORT),y)
WFLAGS += -DBG_FT_OPEN_SUPPORT
endif

#ifdef DOT11W_PMF_SUPPORT
ifeq ($(HAS_DOT11W_PMF_SUPPORT),y)
WFLAGS += -DDOT11W_PMF_SUPPORT -DSOFT_ENCRYPT
endif
#endif // DOT11W_PMF_SUPPORT //

#ifdef LED_CONTROL_SUPPORT
ifeq ($(HAS_LED_CONTROL_SUPPORT),y)
WFLAGS += -DLED_CONTROL_SUPPORT
endif
#endif // LED_CONTROL_SUPPORT //

#ifdef CONFIG_HOTSPOT
ifeq ($(HAS_HOTSPOT_SUPPORT),y)
WFLAGS += -DCONFIG_DOT11U_INTERWORKING -DCONFIG_DOT11V_WNM -DCONFIG_HOTSPOT
endif
#endif

#ifdef CONFIG_MULTI_CHANNEL
ifeq ($(HAS_MULTI_CHANNEL),y)
WFLAGS += -DCONFIG_MULTI_CHANNEL
endif
#endif /* CONFIG_MULTI_CHANNEL */

#ifdef MICROWAVE_OVEN_SUPPORT
ifeq ($(HAS_MICROWAVE_OVEN_SUPPORT),y)
WFLAGS += -DMICROWAVE_OVEN_SUPPORT
endif
#endif

#ifdef CONFIG_FPGA_MODE
ifeq ($(HAS_FPGA_MODE),y)
WFLAGS += -DCONFIG_FPGA_MODE
endif
#endif

#ifdef CONFIG_DVT_MODE
ifeq ($(HAS_DVT_MODE),y)
WFLAGS += -DCONFIG_DVT_MODE
endif
#endif

#ifdef CONFIG_WIFI_TEST
ifeq ($(HAS_WIFI_TEST),y)
WFLAGS += -DCONFIG_WIFI_TEST
endif
#endif /* CONFIG_WIFI_TEST */

#ifdef CONFIG_SNIFFER_SUPPORT
ifeq ($(HAS_SNIFFER_SUPPORT),y)
WFLAGS += -DCONFIG_SNIFFER_SUPPORT
endif
#endif

#ifdef CONFIG_CALIBRATION_COLLECTION
ifeq ($(HAS_CALIBRATION_COLLECTION_SUPPORT),y)
WFLAGS += -DCONFIG_CALIBRATION_COLLECTION
endif
#endif

#ifdef CONFIG_TRACE_SUPPORT
ifeq ($(HAS_TRACE_SUPPORT),y)
WFLAGS += -DCONFIG_TRACE_SUPPORT
endif
#endif

#ifdef WIFI_REGION32_HIDDEN_SSID_SUPPORT
ifeq ($(HAS_WIFI_REGION32_HIDDEN_SSID_SUPPORT),y)
WFLAGS += -DWIFI_REGION32_HIDDEN_SSID_SUPPORT
endif
#endif // WIFI_REGION32_HIDDEN_SSID_SUPPORT //


ifeq ($(HAS_HT40_DISABLE_SHORT_GI),y)
WFLAGS += -DHT40_DISABLE_SHORT_GI
endif

ifeq ($(HAS_BSS_COEX_DISABLE),y)
WFLAGS += -DBSS_COEX_DISABLE
endif

#################################################
# ChipSet specific definitions  - OLD PCI Series
#
#################################################

# 2860
ifneq ($(findstring rt2860,$(CHIPSET)),)
WFLAGS +=-DRTMP_MAC_PCI -DRTMP_PCI_SUPPORT -DRT2860 -DRT28xx -DA_BAND_SUPPORT -DCONFIG_M8051_SUPPORT
HAS_INF_PCI=y
HAS_MAC_PCI=y
HAS_RTMP_MAC=y

CHIPSET_DAT = 2860

endif
## End of 2860 ##

# 3090
ifneq ($(findstring rt3090,$(CHIPSET)),)
WFLAGS +=-DRTMP_MAC_PCI -DRT30xx -DRT3090  -DRTMP_PCI_SUPPORT -DRTMP_RF_RW_SUPPORT -DRTMP_EFUSE_SUPPORT -DVCORECAL_SUPPORT -DCONFIG_M8051_SUPPORT
HAS_INF_PCI=y
HAS_MAC_PCI=y
HAS_RTMP_MAC=y

CHIPSET_DAT = 2860
endif
## End of 3090 ##

# 3062
ifneq ($(findstring rt3062,$(CHIPSET)),)
WFLAGS +=-DRTMP_MAC_PCI -DRT2860 -DRT28xx -DRT30xx -DRT35xx -DRT3062 -DRTMP_PCI_SUPPORT -DRTMP_RF_RW_SUPPORT -DRTMP_EFUSE_SUPPORT -DVCORECAL_SUPPORT -DCONFIG_M8051_SUPPORT
HAS_INF_PCI=y
HAS_MAC_PCI=y
HAS_RTMP_MAC=y

CHIPSET_DAT = 2860
endif
## End of 3062 ##

# 3562
ifneq ($(findstring rt3562,$(CHIPSET)),)
WFLAGS +=-DRTMP_MAC_PCI -DRT2860 -DRT28xx -DRT30xx -DRT35xx -DRT3562 -DRTMP_PCI_SUPPORT -DRTMP_RF_RW_SUPPORT -DRTMP_EFUSE_SUPPORT -DA_BAND_SUPPORT -DVCORECAL_SUPPORT -DCONFIG_M8051_SUPPORT
HAS_INF_PCI=y
HAS_MAC_PCI=y
HAS_RTMP_MAC=y

CHIPSET_DAT = 2860
endif
## End of 3562 ##

# 3593
ifneq ($(findstring rt3593,$(CHIPSET)),)
WFLAGS +=-DRTMP_MAC_PCI -DDOT11N_SS3_SUPPORT -DRT3593 -DRT28xx -DRT30xx -DRT35xx -DRTMP_PCI_SUPPORT -DRTMP_RF_RW_SUPPORT -DRTMP_EFUSE_SUPPORT -DA_BAND_SUPPORT -DNEW_MBSSID_MODE -DVCORECAL_SUPPORT -DCONFIG_M8051_SUPPORT
# WFLAGS += -DNEW_RATE_ADAPT_SUPPORT
HAS_INF_PCI=y
HAS_MAC_PCI=y
HAS_RTMP_MAC=y

CHIPSET_DAT = 2860

ifneq ($(findstring $(RT28xx_MODE),STA APSTA),)
WFLAGS += -DRTMP_FREQ_CALIBRATION_SUPPORT
endif

ifneq ($(findstring $(RT28xx_MODE),AP),)
WFLAGS += -DSPECIFIC_BCN_BUF_SUPPORT
endif
endif
## End of 3593 ##

# 3390
ifneq ($(findstring rt3390,$(CHIPSET)),)
WFLAGS +=-DRTMP_MAC_PCI -DRT30xx -DRT33xx -DRT3090 -DRT3390 -DRTMP_PCI_SUPPORT -DRTMP_RF_RW_SUPPORT -DRTMP_EFUSE_SUPPORT -DRTMP_INTERNAL_TX_ALC -DVCORECAL_SUPPORT -DCONFIG_M8051_SUPPORT
HAS_INF_PCI=y
HAS_MAC_PCI=y
HAS_RTMP_MAC=y

CHIPSET_DAT = 2860
endif
## End of 3390 ##


# 5390
ifneq ($(findstring rt5390,$(CHIPSET)),)
WFLAGS +=-DRTMP_MAC_PCI -DRT30xx -DRT33xx -DRT3090 -DRT3390 -DRT5390 -DRTMP_PCI_SUPPORT -DRTMP_RF_RW_SUPPORT -DRTMP_EFUSE_SUPPORT -DRTMP_FREQ_CALIBRATION_SUPPORT -DRTMP_INTERNAL_TX_ALC -DVCORECAL_SUPPORT -DIQ_CAL_SUPPORT -DNEW_MBSSID_MODE -DRTMP_TEMPERATURE_COMPENSATION -DCONFIG_M8051_SUPPORT
HAS_INF_PCI=y
HAS_MAC_PCI=y
HAS_RTMP_MAC=y

CHIPSET_DAT = 2860

ifneq ($(findstring $(RT28xx_MODE),AP),)
WFLAGS += -DSPECIFIC_BCN_BUF_SUPPORT
endif
endif
## End of 5390 ##


# 5592
ifneq ($(findstring rt5592,$(CHIPSET)),)
WFLAGS += -DRTMP_MAC_PCI -DRTMP_PCI_SUPPORT -DRT30xx -DRT5592\
		  -DRTMP_RF_RW_SUPPORT -DRTMP_EFUSE_SUPPORT\
		  -DA_BAND_SUPPORT -DIQ_CAL_SUPPORT -DRX_DMA_SCATTER -DVCORECAL_SUPPORT\
          -DNEW_MBSSID_MODE -DRTMP_TEMPERATURE_COMPENSATION -DCONFIG_M8051_SUPPORT -DRT_RF

HAS_INF_PCI=y
HAS_MAC_PCI=y
HAS_RTMP_MAC=y

CHIPSET_DAT = 2860
ifeq ($(HAS_CSO_SUPPORT), y)
WFLAGS += -DCONFIG_CSO_SUPPORT
endif

ifneq ($(findstring $(RT28xx_MODE),STA APSTA),)
WFLAGS += -DRTMP_FREQ_CALIBRATION_SUPPORT
endif

ifneq ($(findstring $(RT28xx_MODE),AP),)
WFLAGS += -DSPECIFIC_BCN_BUF_SUPPORT
endif

endif
## End of 5592 ##


# 3290
ifneq ($(findstring rt3290,$(CHIPSET)),)
WFLAGS += -DRTMP_MAC_PCI -DRTMP_PCI_SUPPORT -DRTMP_RF_RW_SUPPORT -DRTMP_EFUSE_SUPPORT -DRTMP_FREQ_CALIBRATION_SUPPORT -DRTMP_INTERNAL_TX_ALC -DRT30xx -DRT3290 -DVCORECAL_SUPPORT -DCONFIG_M8051_SUPPORT
HAS_INF_PCI=y
HAS_MAC_PCI=y
HAS_RTMP_MAC=y

CHIPSET_DAT = 2860

ifneq ($(findstring $(RT28xx_MODE),STA APSTA),)
WFLAGS += -DRTMP_FREQ_CALIBRATION_SUPPORT -DPCIE_PS_SUPPORT
endif

ifneq ($(findstring $(RT28xx_MODE),AP),)
WFLAGS += -DSPECIFIC_BCN_BUF_SUPPORT
endif
endif
## End of 3290 ##


#################################################
# ChipSet specific definitions  - OLD USB Series
#
#################################################

# 2870
ifneq ($(findstring rt2870,$(CHIPSET)),)
WFLAGS +=-DRTMP_MAC_USB -DRTMP_USB_SUPPORT -DRT2870 -DRT28xx -DRTMP_TIMER_TASK_SUPPORT -DA_BAND_SUPPORT -DCONFIG_M8051_SUPPORT
CHIPSET_DAT = 2870
HAS_INF_USB=y
HAS_RTMP_MAC=y

endif
## End of 2870 ##

# 2070
ifneq ($(findstring rt2070,$(CHIPSET)),)
WFLAGS +=-DRTMP_MAC_USB -DRT30xx -DRT3070 -DRT2070 -DRTMP_USB_SUPPORT -DRTMP_TIMER_TASK_SUPPORT -DRTMP_RF_RW_SUPPORT -DRTMP_EFUSE_SUPPORT -DCONFIG_M8051_SUPPORT
CHIPSET_DAT = 2870
HAS_INF_USB=y
HAS_RTMP_MAC=y

endif
## End of 2070 ##

# 3070
ifneq ($(findstring rt3070,$(CHIPSET)),)
WFLAGS +=-DRTMP_MAC_USB -DRT30xx -DRT3070 -DRTMP_USB_SUPPORT -DRTMP_TIMER_TASK_SUPPORT -DRTMP_RF_RW_SUPPORT -DRTMP_EFUSE_SUPPORT -DVCORECAL_SUPPORT -DCONFIG_M8051_SUPPORT
CHIPSET_DAT = 2870
HAS_INF_USB=y
HAS_RTMP_MAC=y

ifneq ($(findstring $(RT28xx_MODE),AP),)
ifeq ($(HAS_CS_SUPPORT), y)
WFLAGS += -DCARRIER_DETECTION_FIRMWARE_SUPPORT 
endif
endif

endif
## End of 3070 ##

# 3572
ifneq ($(findstring rt3572,$(CHIPSET)),)
WFLAGS +=-DRTMP_MAC_USB -DRTMP_USB_SUPPORT -DRT2870 -DRT28xx -DRT30xx -DRT35xx -DRT3572 -DRTMP_TIMER_TASK_SUPPORT -DRTMP_RF_RW_SUPPORT -DRTMP_EFUSE_SUPPORT -DA_BAND_SUPPORT -DVCORECAL_SUPPORT
CHIPSET_DAT = 2870
HAS_INF_USB=y
HAS_RTMP_MAC=y

ifneq ($(findstring $(RT28xx_MODE),AP),)
ifeq ($(HAS_CS_SUPPORT), y)
WFLAGS +=  -DCARRIER_DETECTION_FIRMWARE_SUPPORT
endif
endif

endif
## End of 3572 ##


# 3370
ifneq ($(findstring 3370,$(CHIPSET)),)
WFLAGS +=-DRTMP_MAC_USB -DRT30xx -DRT33xx -DRT3070 -DRT3370 -DRTMP_USB_SUPPORT -DRTMP_TIMER_TASK_SUPPORT -DRTMP_RF_RW_SUPPORT -DRTMP_EFUSE_SUPPORT -DRTMP_INTERNAL_TX_ALC -DVCORECAL_SUPPORT -DCONFIG_M8051_SUPPORT
HAS_INF_USB=y
HAS_RTMP_MAC=y

CHIPSET_DAT = 2870

ifneq ($(findstring $(RT28xx_MODE),AP),)
ifeq ($(HAS_CS_SUPPORT), y)
WFLAGS +=  -DCARRIER_DETECTION_FIRMWARE_SUPPORT
endif
endif

endif
## End of 3370 ##


# 3573
ifneq ($(findstring rt3573,$(CHIPSET)),)
WFLAGS += -DRTMP_MAC_USB -DRTMP_USB_SUPPORT -DRT30xx -DRT35xx -DRT3593 -DRT3573\
          -DRTMP_TIMER_TASK_SUPPORT -DRTMP_RF_RW_SUPPORT -DRTMP_EFUSE_SUPPORT\
          -DA_BAND_SUPPORT -DDOT11N_SS3_SUPPORT \
		  -DVCORECAL_SUPPORT -DNEW_MBSSID_MODE -DCONFIG_M8051_SUPPORT
#WFLAGS += -DNEW_RATE_ADAPT_SUPPORT
HAS_INF_USB=y
HAS_RTMP_MAC=y

CHIPSET_DAT = 2870

ifneq ($(findstring $(RT28xx_MODE),STA APSTA),)
WFLAGS += -DRTMP_FREQ_CALIBRATION_SUPPORT
endif

ifneq ($(findstring $(RT28xx_MODE),AP),)
WFLAGS += -DSPECIFIC_BCN_BUF_SUPPORT
endif

ifneq ($(findstring $(RT28xx_MODE),AP),)
ifeq ($(HAS_CS_SUPPORT), y)
WFLAGS +=  -DCARRIER_DETECTION_FIRMWARE_SUPPORT
endif
endif

endif
## End of 3573 ##


# 5370
ifneq ($(findstring rt5370,$(CHIPSET)),)
WFLAGS +=-DRTMP_MAC_USB -DRT30xx -DRT33xx -DRT3070 -DRT3370 -DRT5370 -DRTMP_USB_SUPPORT -DRTMP_TIMER_TASK_SUPPORT -DRTMP_RF_RW_SUPPORT -DRTMP_EFUSE_SUPPORT -DRTMP_INTERNAL_TX_ALC -DRTMP_FREQ_CALIBRATION_SUPPORT -DVCORECAL_SUPPORT -DIQ_CAL_SUPPORT -DNEW_MBSSID_MODE -DRTMP_TEMPERATURE_COMPENSATION -DCONFIG_M8051_SUPPORT
HAS_INF_USB=y
HAS_RTMP_MAC=y

CHIPSET_DAT = 2870

ifneq ($(findstring $(RT28xx_MODE),AP),)
ifeq ($(HAS_CS_SUPPORT), y)
WFLAGS +=  -DCARRIER_DETECTION_FIRMWARE_SUPPORT
endif
endif

ifneq ($(findstring $(RT28xx_MODE),AP),)
WFLAGS += -DSPECIFIC_BCN_BUF_SUPPORT
endif
endif
## End of 5370 ##


# 5572
ifneq ($(findstring rt5572,$(CHIPSET)),)
WFLAGS += -DRTMP_MAC_USB -DRTMP_USB_SUPPORT -DRT30xx -DRT5572 -DRT5592\
		  -DRTMP_RF_RW_SUPPORT -DRTMP_EFUSE_SUPPORT -DNEW_MBSSID_MODE\
		  -DRTMP_TIMER_TASK_SUPPORT -DA_BAND_SUPPORT -DIQ_CAL_SUPPORT -DVCORECAL_SUPPORT\
		  -DRTMP_TEMPERATURE_COMPENSATION -DCONFIG_M8051_SUPPORT
HAS_INF_USB=y
HAS_RTMP_MAC=y

CHIPSET_DAT = 2870
ifeq ($(HAS_CSO_SUPPORT), y)
WFLAGS += -DCONFIG_CSO_SUPPORT
endif

ifneq ($(findstring $(RT28xx_MODE),AP),)
ifeq ($(HAS_CS_SUPPORT), y)
WFLAGS +=  -DCARRIER_DETECTION_FIRMWARE_SUPPORT 
endif
endif

ifneq ($(findstring $(RT28xx_MODE),STA APSTA),)
WFLAGS += -DRTMP_FREQ_CALIBRATION_SUPPORT
endif

ifneq ($(findstring $(RT28xx_MODE),AP),)
#WFLAGS += -DSPECIFIC_BCN_BUF_SUPPORT
endif

endif
## End of 5572 ##


#################################################
# ChipSet specific definitions  - OLD RBUS Series
#
#################################################
# 2880
ifneq ($(findstring rt2880,$(CHIPSET)),)
WFLAGS += -DRT2880 -DRT28xx -DRTMP_MAC_PCI -DCONFIG_RALINK_RT2880_MP -DRTMP_RBUS_SUPPORT -DMERGE_ARCH_TEAM -DA_BAND_SUPPORT -DCONFIG_SWMCU_SUPPORT
ifeq ($(HAS_WIFI_LED_SHARE), y)
WFLAGS += -DCONFIG_WIFI_LED_SHARE
endif
HAS_INF_RBUS=y
HAS_MAC_PCI=y
HAS_RTMP_MAC=y

endif
## End of 2880 ##


# 3052
ifneq ($(findstring rt3052,$(CHIPSET)),)
WFLAGS += -DRTMP_MAC_PCI -DRTMP_RBUS_SUPPORT -DRT3052 -DRT305x -DRTMP_RF_RW_SUPPORT -DCONFIG_SWMCU_SUPPORT -DVCORECAL_SUPPORT
HAS_INF_RBUS=y
HAS_MAC_PCI=y
HAS_RTMP_MAC=y

CHIPSET_DAT = 2870
ifeq ($(HAS_WIFI_LED_SHARE), y)
WFLAGS += -DCONFIG_WIFI_LED_SHARE
endif
endif
## End of 3052 ##

# 3352
ifneq ($(findstring rt3352,$(CHIPSET)),)
WFLAGS += -DRTMP_MAC_PCI -DRTMP_RBUS_SUPPORT -DRT3352 -DRT305x -DRTMP_RF_RW_SUPPORT -DVCORECAL_SUPPORT -DCONFIG_SWMCU_SUPPORT -DRTMP_INTERNAL_TX_ALC -DNEW_MBSSID_MODE
HAS_INF_RBUS=y
HAS_MAC_PCI=y
HAS_RTMP_MAC=y

CHIPSET_DAT = 2860
ifeq ($(HAS_WIFI_LED_SHARE), y)
WFLAGS += -DCONFIG_WIFI_LED_SHARE
endif
ifneq ($(findstring $(RT28xx_MODE),AP),)
WFLAGS += -DSPECIFIC_BCN_BUF_SUPPORT
endif
endif
## End of 3352 ##

# 5350
ifneq ($(findstring rt5350,$(CHIPSET)),)
WFLAGS += -DRTMP_MAC_PCI -DRTMP_RBUS_SUPPORT -DRT5350 -DRT305x -DRT3050 -DRT3350 -DRTMP_RF_RW_SUPPORT -DVCORECAL_SUPPORT -DCONFIG_SWMCU_SUPPORT -DRTMP_INTERNAL_TX_ALC -DRTMP_FREQ_CALIBRATION_SUPPORT -DIQ_CAL_SUPPORT -DNEW_MBSSID_MODE
HAS_INF_RBUS=y
HAS_MAC_PCI=y
HAS_RTMP_MAC=y

CHIPSET_DAT = 2860
ifeq ($(HAS_WIFI_LED_SHARE), y)
WFLAGS += -DCONFIG_WIFI_LED_SHARE
endif
ifneq ($(findstring $(RT28xx_MODE),AP),)
WFLAGS += -DSPECIFIC_BCN_BUF_SUPPORT
endif
endif
## End of 5350 ##


#################################################
# ChipSet specific definitions  - OLD Multiple Card Series
#
#################################################
ifeq ($(CHIPSET),USB)
#3572
WFLAGS +=-DRTMP_MAC_USB -DRTMP_USB_SUPPORT -DRT2870 -DRT28xx -DRT30xx -DRT35xx -DRTMP_TIMER_TASK_SUPPORT -DRTMP_RF_RW_SUPPORT -DRTMP_EFUSE_SUPPORT -DA_BAND_SUPPORT -DSPECIFIC_VCORECAL_SUPPORT
#3370
WFLAGS += -DRT33xx -DRT3070 -DRT3370 -DRTMP_TIMER_TASK_SUPPORT -DRTMP_INTERNAL_TX_ALC
HAS_INF_USB=y

CHIPSET_DAT = 2870
endif


ifeq ($(CHIPSET),PCI)
#3562
WFLAGS +=-DRTMP_MAC_PCI -DRT2860 -DRT28xx -DRT30xx -DRT35xx -DRTMP_PCI_SUPPORT -DRTMP_RF_RW_SUPPORT -DRTMP_EFUSE_SUPPORT -DA_BAND_SUPPORT -DSPECIFIC_VCORECAL_SUPPORT
#3390
WFLAGS +=-DRT33xx -DRT3090 -DRT3390 -DRTMP_INTERNAL_TX_ALC

HAS_INF_PCI=y
HAS_MAC_PCI=y
HAS_RTMP_MAC=y

endif


ifeq ($(CHIPSET),RBUS)
WFLAGS += -DMERGE_ARCH_TEAM -DCONFIG_SWMCU_SUPPORT -DCONFIG_RA_NAT_NONE -DRTMP_RBUS_SUPPORT
#5350, 3050, 3350, 3883
WFLAGS +=-DRTMP_MAC_PCI -DRT305x -DRT5350 -DRT3050 -DRT3350 -DRT3883 -DRTMP_PCI_SUPPORT -DRTMP_RF_RW_SUPPORT -DA_BAND_SUPPORT -DVCORECAL_SUPPORT

ifneq ($(findstring $(RT28xx_MODE),AP),)
WFLAGS += -DSPECIFIC_BCN_BUF_SUPPORT
endif
#WFLAGS += -DDBG_CTRL_SUPPORT -DINCLUDE_DEBUG_QUEUE
#WFLAGS += -DRANGE_EXTEND -DCFO_TRACK -DPRE_ANT_SWITCH

HAS_INF_PCI=y
HAS_INF_RBUS=y
HAS_MAC_PCI=y
HAS_RTMP_MAC=y

endif


#################################################
# ChipSet specific definitions  - RLT Series
#
#################################################

# 7601E
ifneq ($(findstring mt7601e,$(CHIPSET)),)
WFLAGS += -DMT7601E -DMT7601 -DRLT_MAC -DRLT_RF -DRTMP_MAC_PCI -DRTMP_PCI_SUPPORT -DRX_DMA_SCATTER -DVCORECAL_SUPPORT -DVCORECAL_SUPPORT -DRTMP_EFUSE_SUPPORT -DhNEW_MBSSID_MODE -DRTMP_INTERNAL_TX_ALC -DCONFIG_ANDES_SUPPORT -DCONFIG_ANDES_BBP_RANDOM_WRITE_SUPPORT
#-DRTMP_FREQ_CALIBRATION_SUPPORT
ifneq ($(findstring $(RT28xx_MODE),AP),)
#WFLAGS += -DSPECIFIC_BCN_BUF_SUPPORT
endif

ifneq ($(findstring $(RT28xx_MODE),STA APSTA),)
WFLAGS += -DRTMP_FREQ_CALIBRATION_SUPPORT
endif
HAS_INF_PCI=y
HAS_MAC_PCI=y
HAS_RLT_MAC=y

CHIPSET_DAT = 2860
endif
## End of 7601E ##

# 7601U
ifneq ($(findstring mt7601u,$(CHIPSET)),)
HAS_RTMP_BBP=y
HAS_RLT_MAC=y
HAS_RLT_RF=y
HAS_INF_USB=y
HAS_RLT_MAC=y

WFLAGS += -DMT7601U -DMT7601
WFLAGS += -DRLT_MAC -DRTMP_MAC_USB -DRTMP_BBP -DRLT_RF -DRTMP_RF_RW_SUPPORT
WFLAGS += -DRTMP_USB_SUPPORT -DRTMP_TIMER_TASK_SUPPORT -DVCORECAL_SUPPORT -DRTMP_EFUSE_SUPPORT -DNEW_MBSSID_MODE -DRTMP_INTERNAL_TX_ALC -DCONFIG_ANDES_SUPPORT -DCONFIG_ANDES_BBP_RANDOM_WRITE_SUPPORT
ifneq ($(findstring $(RT28xx_MODE),AP),)
#WFLAGS += -DSPECIFIC_BCN_BUF_SUPPORT
endif

ifeq ($(HAS_RX_CSO_SUPPORT), y)
WFLAGS += -DCONFIG_RX_CSO_SUPPORT
endif

ifneq ($(findstring $(RT28xx_MODE),AP),)
else
WFLAGS += -DRTMP_FREQ_CALIBRATION_SUPPORT
endif

CHIPSET_DAT = 2870
endif
## End of 7601U ##


# RT85582
ifneq ($(findstring rt8592,$(CHIPSET)),)
WFLAGS += -DRT8592 -DRT65xx -DRLT_MAC -DRTMP_MAC_PCI -DRTMP_PCI_SUPPORT -DA_BAND_SUPPORT -DRX_DMA_SCATTER
WFLAGS += -DRTMP_RF_RW_SUPPORT -DIQ_CAL_SUPPORT -DVCORECAL_SUPPORT
WFLAGS += -DFIFO_EXT_SUPPORT
WFLAGS += -DRTMP_TEMPERATURE_COMPENSATION
ifneq ($(findstring $(RT28xx_MODE),AP),)
# TODO: shiang-6590, need to ask hardware about the memory base setting first!!
#WFLAGS += -DSPECIFIC_BCN_BUF_SUPPORT
endif
HAS_INF_PCI=y
HAS_MAC_PCI=y
HAS_RLT_MAC=y

CHIPSET_DAT = 2860
endif
## End of RT85592 ##


# MT7650E
ifneq ($(or $(findstring mt7650e,$(CHIPSET))$(findstring mt7630e,$(CHIPSET)),$(findstring mt7610e,$(CHIPSET))),)
HAS_RLT_BBP=y
HAS_RLT_MAC=y
HAS_RLT_RF=y
HAS_INF_PCI=y
HAS_MAC_PCI=y
HAS_RLT_MAC=y

WFLAGS += -DMT76x0 -DRT65xx -DRLT_MAC -DRLT_BBP -DRLT_RF -DRTMP_RF_RW_SUPPORT -DRTMP_MAC_PCI -DRTMP_PCI_SUPPORT -DA_BAND_SUPPORT 
WFLAGS += -DRX_DMA_SCATTER -DNEW_MBSSID_MODE -DRTMP_EFUSE_SUPPORT -DCONFIG_ANDES_SUPPORT -DENHANCE_NEW_MBSSID_MODE
#-DRTMP_FREQ_CALIBRATION_SUPPORT -DVCORECAL_SUPPORT
ifneq ($(findstring $(RT28xx_MODE),AP),)
#WFLAGS += -DSPECIFIC_BCN_BUF_SUPPORT
endif

ifneq ($(findstring mt7650e,$(CHIPSET)),)
WFLAGS += -DMT7650
endif

ifneq ($(findstring mt7630e,$(CHIPSET)),)
WFLAGS += -DMT7630
endif

ifneq ($(findstring mt7610e,$(CHIPSET)),)
WFLAGS += -DMT7610
endif

CHIPSET_DAT = 2860
endif
## End of MT7650E ##


# MT7650U
ifneq ($(or $(findstring mt7650u,$(CHIPSET)),$(findstring mt7630u,$(CHIPSET)),$(findstring mt7610u,$(CHIPSET))),)
HAS_RLT_BBP=y
HAS_RLT_MAC=y
HAS_RLT_RF=y
HAS_INF_USB=y
HAS_RLT_MAC=y
HAS_NEW_RATE_ADAPT_SUPPORT=y

ifeq ($(HAS_NEW_RATE_ADAPT_SUPPORT),y)
WFLAGS += -DNEW_RATE_ADAPT_SUPPORT
endif

WFLAGS += -DMT76x0 -DRT65xx -DRLT_MAC -DRLT_BBP -DRLT_RF -DRTMP_MAC_USB -DRTMP_USB_SUPPORT -DRTMP_TIMER_TASK_SUPPORT
WFLAGS += -DA_BAND_SUPPORT -DRX_DMA_SCATTER -DRTMP_EFUSE_SUPPORT -DNEW_MBSSID_MODE -DCONFIG_ANDES_SUPPORT
WFLAGS += -DRTMP_RF_RW_SUPPORT

ifneq ($(findstring mt7650u,$(CHIPSET)),)
WFLAGS += -DMT7650
endif

ifneq ($(findstring mt7630u,$(CHIPSET)),)
WFLAGS += -DMT7630
endif

ifneq ($(findstring mt7610u,$(CHIPSET)),)
WFLAGS += -DMT7610
endif

ifneq ($(findstring $(RT28xx_MODE),AP),)
#WFLAGS += -DSPECIFIC_BCN_BUF_SUPPORT
endif

ifeq ($(HAS_CSO_SUPPORT), y)
WFLAGS += -DCONFIG_CSO_SUPPORT
ifeq ($(HAS_TSO_SUPPORT), y)
WFLAGS += -DCONFIG_TSO_SUPPORT -DTX_PKT_SG
endif
endif

endif
## End of MT7650U ##


# MT7662E
ifneq ($(or $(findstring mt7662e,$(CHIPSET)),$(findstring mt7612e,$(CHIPSET))),)
WFLAGS += -DMT76x2 -DRT65xx -DRLT_MAC -DRLT_BBP -DMT_RF -DRTMP_MAC_PCI -DRTMP_PCI_SUPPORT -DA_BAND_SUPPORT -DRX_DMA_SCATTER -DNEW_MBSSID_MODE -DRTMP_EFUSE_SUPPORT -DCONFIG_ANDES_SUPPORT -DENHANCE_NEW_MBSSID_MODE -DRTMP_RF_RW_SUPPORT -DDYNAMIC_VGA_SUPPORT
WFLAGS += -DRTMP_RF_RW_SUPPORT
HAS_NEW_RATE_ADAPT_SUPPORT=y
ifeq ($(HAS_NEW_RATE_ADAPT_SUPPORT),y)
WFLAGS += -DNEW_RATE_ADAPT_SUPPORT
endif
WFLAGS += -DFIFO_EXT_SUPPORT
HAS_RLT_BBP=y
HAS_RLT_MAC=y
HAS_INF_PCI=y
HAS_MAC_PCI=y
HAS_RLT_MAC=y
HAS_MT_RF=y

CHIPSET_DAT = 2860

ifneq ($(findstring mt7662e,$(CHIPSET)),)
WFLAGS += -DMT7662
endif

ifneq ($(findstring mt7662e,$(CHIPSET)),)
WFLAGS += -DMT7632
endif

ifneq ($(findstring mt7612e,$(CHIPSET)),)
WFLAGS += -DMT7612
endif
endif
## End of MT7662E ##


# MT7662U
ifneq ($(or $(findstring mt7662u,$(CHIPSET)),$(findstring mt7612u,$(CHIPSET))),)
WFLAGS += -DMT76x2 -DRT65xx -DRLT_MAC -DRLT_BBP -DMT_RF -DRTMP_MAC_USB -DRTMP_USB_SUPPORT -DRTMP_TIMER_TASK_SUPPORT -DA_BAND_SUPPORT -DRTMP_EFUSE_SUPPORT -DNEW_MBSSID_MODE -DCONFIG_ANDES_SUPPORT
WFLAGS += -DRTMP_RF_RW_SUPPORT -DDYNAMIC_VGA_SUPPORT
HAS_NEW_RATE_ADAPT_SUPPORT=y
ifeq ($(HAS_NEW_RATE_ADAPT_SUPPORT),y)
WFLAGS += -DNEW_RATE_ADAPT_SUPPORT
endif
WFLAGS += -DFIFO_EXT_SUPPORT
HAS_RLT_BBP=y
HAS_RLT_MAC=y
HAS_INF_USB=y
HAS_RLT_MAC=y
HAS_MT_RF=y

ifneq ($(findstring mt7662u,$(CHIPSET)),)
WFLAGS += -DMT7662
endif

ifneq ($(findstring mt7612u,$(CHIPSET)),)
WFLAGS += -DMT7612
endif

ifeq ($(HAS_CSO_SUPPORT), y)
WFLAGS += -DCONFIG_CSO_SUPPORT -DCONFIG_TSO_SUPPORT
endif

CHIPSET_DAT = 2870
endif
## End of 7662U ##

#################################################
# ChipSet specific definitions  - MT Series
#
#################################################

# MT7636
ifneq ($(findstring mt7636s,$(CHIPSET)),)
WFLAGS += -DMT7636 -DMT_BBP -DMT_RF -DRTMP_RF_RW_SUPPORT -DMT_MAC -DRTMP_MAC_SDIO -DRTMP_SDIO_SUPPORT -DMCS_LUT_SUPPORT -DRTMP_TIMER_TASK_SUPPORT 
WFLAGS += -DRTMP_EFUSE_SUPPORT
#-DNEW_MBSSID_MODE
WFLAGS += -DCONFIG_ANDES_SUPPORT
HAS_NEW_RATE_ADAPT_SUPPORT=y
ifeq ($(HAS_NEW_RATE_ADAPT_SUPPORT),y)
WFLAGS += -DNEW_RATE_ADAPT_SUPPORT
endif

#WFLAGS += -DMT7636_FPGA -DCONFIG_FPGA_MODE
WFLAGS += -DCONFIG_FPGA_MODE
WFLAGS += -DRELEASE_EXCLUDE

HAS_MT_BBP=y
HAS_MT_MAC=y
HAS_INF_SDIO=y
HAS_MAC_SDIO=y
HAS_MT_MAC=y
HAS_MT_RF=y

CHIPSET_DAT = 2850
endif

ifneq ($(findstring mt7636u,$(CHIPSET)),)
WFLAGS += -DMT7636 -DMT_BBP -DMT_RF -DRTMP_RF_RW_SUPPORT -DMT_MAC -DRTMP_MAC_USB -DRTMP_USB_SUPPORT -DMCS_LUT_SUPPORT -DRTMP_TIMER_TASK_SUPPORT
WFLAGS += -DRTMP_EFUSE_SUPPORT
#-DNEW_MBSSID_MODE 
WFLAGS += -DCONFIG_ANDES_SUPPORT
HAS_NEW_RATE_ADAPT_SUPPORT=y
ifeq ($(HAS_NEW_RATE_ADAPT_SUPPORT),y)
WFLAGS += -DNEW_RATE_ADAPT_SUPPORT
endif

#WFLAGS += -DMT7603_FPGA -DCONFIG_FPGA_MODE
WFLAGS += -DMT7636_FPGA
WFLAGS += -DCONFIG_FPGA_MODE
WFLAGS += -DRELEASE_EXCLUDE


HAS_MT_BBP=y
HAS_MT_MAC=y
HAS_INF_USB=y
HAS_MAC_USB=y
HAS_MT_MAC=y
HAS_MT_RF=y

CHIPSET_DAT = 2870
endif

# MT7603
ifneq ($(findstring mt7603e,$(CHIPSET)),)
WFLAGS += -DMT7603 -DMT_BBP -DMT_RF -DRTMP_RF_RW_SUPPORT -DMT_MAC -DRTMP_MAC_PCI -DRTMP_PCI_SUPPORT -DMCS_LUT_SUPPORT -DUSE_BMC
WFLAGS += -DRTMP_EFUSE_SUPPORT 
#-DNEW_MBSSID_MODE 
WFLAGS += -DCONFIG_ANDES_SUPPORT
#WFLAGS += -DDBG_DIAGNOSE -DDBG_TX_AGG_CNT -DDBG_TXQ_DEPTH -DDBG_TX_RING_DEPTH -DDBG_TX_MCS -DDBG_RX_MCS -DDBG_PSE_DEPTH
HAS_NEW_RATE_ADAPT_SUPPORT=y
ifeq ($(HAS_NEW_RATE_ADAPT_SUPPORT),y)
WFLAGS += -DNEW_RATE_ADAPT_SUPPORT
endif

#WFLAGS += -DMT7603_FPGA -DCONFIG_FPGA_MODE
WFLAGS += -DCONFIG_FPGA_MODE
WFLAGS += -DRELEASE_EXCLUDE

WFLAGS += -DRTMP_WLAN_HOOK_SUPPORT
HAS_MT_BBP=y
HAS_MT_MAC=y
HAS_INF_PCI=y
HAS_MAC_PCI=y
HAS_MT_MAC=y
HAS_MT_RF=y

CHIPSET_DAT = 2860
endif

ifneq ($(findstring mt7603u,$(CHIPSET)),)
WFLAGS += -DMT7603 -DMT_BBP -DMT_RF -DRTMP_RF_RW_SUPPORT -DMT_MAC -DRTMP_MAC_USB -DRTMP_USB_SUPPORT -DMCS_LUT_SUPPORT -DRTMP_TIMER_TASK_SUPPORT
WFLAGS += -DRTMP_EFUSE_SUPPORT 
#-DNEW_MBSSID_MODE 
WFLAGS += -DCONFIG_ANDES_SUPPORT
HAS_NEW_RATE_ADAPT_SUPPORT=y
ifeq ($(HAS_NEW_RATE_ADAPT_SUPPORT),y)
WFLAGS += -DNEW_RATE_ADAPT_SUPPORT
endif

WFLAGS += -DRTMP_WLAN_HOOK_SUPPORT
#WFLAGS += -DMT7603_FPGA -DCONFIG_FPGA_MODE
WFLAGS += -DCONFIG_FPGA_MODE
WFLAGS += -DRELEASE_EXCLUDE

HAS_MT_BBP=y
HAS_MT_MAC=y
HAS_INF_USB=y
HAS_MAC_USB=y
HAS_MT_MAC=y
HAS_MT_RF=y

CHIPSET_DAT = 2870
endif
WFLAGS += -DIP_ASSEMBLY
## End of MT7603 ##

# MT7628
ifneq ($(findstring mt7628,$(CHIPSET)),)
WFLAGS += -DMT7628 -DMT_BBP -DMT_RF -DRTMP_RBUS_SUPPORT -DRTMP_RF_RW_SUPPORT -DMT_MAC -DRTMP_MAC_PCI -DRTMP_PCI_SUPPORT
WFLAGS += -DRTMP_EFUSE_SUPPORT
#-DNEW_MBSSID_MODE 
WFLAGS += -DCONFIG_ANDES_SUPPORT
HAS_NEW_RATE_ADAPT_SUPPORT=y
ifeq ($(HAS_NEW_RATE_ADAPT_SUPPORT),y)
WFLAGS += -DNEW_RATE_ADAPT_SUPPORT
endif

#WFLAGS += -DMT7628_FPGA -DCONFIG_FPGA_MODE
WFLAGS += -DRELEASE_EXCLUDE

HAS_MT_BBP=y
HAS_MT_MAC=y
HAS_INF_RBUS=y
HAS_MAC_PCI=y
HAS_MT_MAC=y
HAS_MT_RF=y
CHIPSET_DAT = 2860
endif
## End of MT7628 ##


#################################################
# Platform Related definitions
#
#################################################

ifeq ($(PLATFORM),5VT)
#WFLAGS += -DCONFIG_5VT_ENHANCE
endif

ifeq ($(HAS_BLOCK_NET_IF),y)
WFLAGS += -DBLOCK_NET_IF
endif

ifeq ($(HAS_DFS_SUPPORT),y)
WFLAGS += -DDFS_SUPPORT
endif

#ifdef MULTI_CARD
ifeq ($(HAS_MC_SUPPORT),y)
WFLAGS += -DMULTIPLE_CARD_SUPPORT
endif
#endif // MULTI_CARD //

ifeq ($(HAS_LLTD),y)
WFLAGS += -DLLTD_SUPPORT
endif

ifeq ($(PLATFORM),RMI)
WFLAGS += -DRT_BIG_ENDIAN 
endif

ifeq ($(PLATFORM),UBICOM_IPX8)
WFLAGS += -DRT_BIG_ENDIAN -DUNALIGNMENT_SUPPORT -DPLATFORM_UBM_IPX8 -DNO_CONSISTENT_MEM_SUPPORT -DCACHE_LINE_32B
endif

ifeq ($(PLATFORM),BL2348)
WFLAGS += -DRT_BIG_ENDIAN
endif

ifeq ($(PLATFORM),BL23570)
WFLAGS += -DRT_BIG_ENDIAN
endif

ifeq ($(PLATFORM),BLUBB)
WFLAGS += -DRT_BIG_ENDIAN
endif

ifeq ($(PLATFORM),BLPMP)
WFLAGS += -DRT_BIG_ENDIAN
endif

ifeq ($(PLATFORM),RMI_64)
WFLAGS += -DRT_BIG_ENDIAN 
endif

ifeq ($(PLATFORM),IXP)
WFLAGS += -DRT_BIG_ENDIAN
endif

ifeq ($(PLATFORM),IKANOS_V160)
WFLAGS += -DRT_BIG_ENDIAN -DIKANOS_VX_1X0
endif

ifeq ($(PLATFORM),IKANOS_V180)
WFLAGS += -DRT_BIG_ENDIAN -DIKANOS_VX_1X0
endif

ifeq ($(PLATFORM),INF_TWINPASS)
WFLAGS += -DRT_BIG_ENDIAN -DINF_TWINPASS
endif

ifeq ($(PLATFORM),INF_DANUBE)
ifneq (,$(findstring 2.4,$(LINUX_SRC)))
# Linux 2.4
WFLAGS += -DINF_DANUBE -DRT_BIG_ENDIAN
else
# Linux 2.6
WFLAGS += -DRT_BIG_ENDIAN
endif
endif

ifeq ($(PLATFORM),INF_AR9)
WFLAGS += -DRT_BIG_ENDIAN -DINF_AR9
# support MAPI function for AR9.
#WFLAGS += -DAR9_MAPI_SUPPORT
endif

ifeq ($(PLATFORM),INF_VR9)
WFLAGS += -DRT_BIG_ENDIAN -DINF_AR9 -DINF_VR9
endif

ifeq ($(PLATFORM),CAVM_OCTEON)
WFLAGS += -DRT_BIG_ENDIAN
endif

ifeq ($(PLATFORM),BRCM_6358)
WFLAGS += -DRT_BIG_ENDIAN -DBRCM_6358
endif

ifeq ($(PLATFORM),INF_AMAZON_SE)
WFLAGS += -DRT_BIG_ENDIAN -DINF_AMAZON_SE
endif

ifeq ($(PLATFORM),RALINK_3052)
WFLAGS += -DPLATFORM_RALINK_3052
endif

ifeq ($(PLATFORM),FREESCALE8377)
#EXTRA_CFLAGS := -v -I$(RT28xx_DIR)/include -I$(LINUX_SRC)/include $(WFLAGS)-O2 -Wall -Wstrict-prototypes -Wno-trigraphs 
#export EXTRA_CFLAGS
WFLAGS += -DRT_BIG_ENDIAN
EXTRA_CFLAGS := $(WFLAGS) -I$(RT28xx_DIR)/include
endif

ifeq ($(PLATFORM),ST)
WFLAGS += -DST
endif

#kernel build options for 2.4
# move to Makefile outside LINUX_SRC := /opt/star/kernel/linux-2.4.27-star

ifeq ($(PLATFORM),RALINK_3052)
CFLAGS := -D__KERNEL__ -I$(LINUX_SRC)/include/asm-mips/mach-generic -I$(LINUX_SRC)/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic -pipe  -finline-limit=100000 -march=mips2 -mabi=32 -Wa,--trap -DLINUX -nostdinc -iwithprefix include $(WFLAGS)
export CFLAGS
endif

ifeq ($(PLATFORM), RALINK_2880)
CFLAGS := -D__KERNEL__ -I$(LINUX_SRC)/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic -pipe  -finline-limit=100000 -march=mips2 -mabi=32 -Wa,--trap -DLINUX -nostdinc -iwithprefix include $(WFLAGS)
export CFLAGS
endif

ifeq ($(PLATFORM),STAR)
CFLAGS := -D__KERNEL__ -I$(LINUX_SRC)/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -Uarm -fno-common -pipe -mapcs-32 -D__LINUX_ARM_ARCH__=4 -march=armv4  -mshort-load-bytes -msoft-float -Uarm -DMODULE -DMODVERSIONS -include $(LINUX_SRC)/include/linux/modversions.h $(WFLAGS)

export CFLAGS
endif

ifeq ($(PLATFORM),UBICOM_IPX8)
EXTRA_CFLAGS += $(WFLAGS) 
export EXTRA_CFLAGS
endif

ifeq ($(PLATFORM),SIGMA)
CFLAGS := -D__KERNEL__ -I$(LINUX_SRC)/include -I$(LINUX_SRC)/include/asm/gcc -I$(LINUX_SRC)/include/asm-mips/mach-tango2 -I$(LINUX_SRC)/include/asm-mips/mach-tango2 -DEM86XX_CHIP=EM86XX_CHIPID_TANGO2 -DEM86XX_REVISION=6 -I$(LINUX_SRC)/include/asm-mips/mach-generic -I$(RT2860_DIR)/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -ffreestanding -O2     -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic -pipe  -mabi=32 -march=mips32r2 -Wa,-32 -Wa,-march=mips32r2 -Wa,-mips32r2 -Wa,--trap -DMODULE $(WFLAGS) -DSIGMA863X_PLATFORM

export CFLAGS
endif

ifeq ($(PLATFORM),SIGMA_8622)
CFLAGS := -D__KERNEL__ -I$(CROSS_COMPILE_INCLUDE)/include -I$(LINUX_SRC)/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fno-common -pipe -fno-builtin -D__linux__ -DNO_MM -mapcs-32 -march=armv4 -mtune=arm7tdmi -msoft-float -DMODULE -mshort-load-bytes -nostdinc -iwithprefix -DMODULE $(WFLAGS)
export CFLAGS
endif

ifeq ($(PLATFORM),5VT)
CFLAGS := -D__KERNEL__ -I$(LINUX_SRC)/include -mlittle-endian -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -O3 -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-omit-frame-pointer -mapcs -mno-sched-prolog -mabi=apcs-gnu -mno-thumb-interwork -D__LINUX_ARM_ARCH__=5 -march=armv5te -mtune=arm926ej-s --param max-inline-insns-single=40000  -Uarm -Wdeclaration-after-statement -Wno-pointer-sign -DMODULE $(WFLAGS) 

export CFLAGS
endif

ifeq ($(PLATFORM),IKANOS_V160)
CFLAGS := -D__KERNEL__ -I$(LINUX_SRC)/include -I$(LINUX_SRC)/include/asm/gcc -I$(LINUX_SRC)/include/asm-mips/mach-tango2 -I$(LINUX_SRC)/include/asm-mips/mach-tango2 -I$(LINUX_SRC)/include/asm-mips/mach-generic -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -ffreestanding -O2 -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic -pipe -march=lx4189 -Wa, -DMODULE $(WFLAGS)
export CFLAGS
endif

ifeq ($(PLATFORM),IKANOS_V180)
CFLAGS := -D__KERNEL__ -I$(LINUX_SRC)/include -I$(LINUX_SRC)/include/asm/gcc -I$(LINUX_SRC)/include/asm-mips/mach-tango2 -I$(LINUX_SRC)/include/asm-mips/mach-tango2 -I$(LINUX_SRC)/include/asm-mips/mach-generic -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -ffreestanding -O2 -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic -pipe -mips32r2 -Wa, -DMODULE $(WFLAGS)
export CFLAGS
endif

ifeq ($(PLATFORM),INF_TWINPASS)
CFLAGS := -D__KERNEL__ -DMODULE -I$(LINUX_SRC)/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common -G 0 -mno-abicalls -fno-pic -march=4kc -mips32 -Wa,--trap -pipe -mlong-calls $(WFLAGS)
export CFLAGS
endif

ifeq ($(PLATFORM),INF_DANUBE)
	ifneq (,$(findstring 2.4,$(LINUX_SRC)))
	CFLAGS := $(WFLAGS) -Wundef -fno-strict-aliasing -fno-common -ffreestanding -Os -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic -pipe -msoft-float  -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap -I$(LINUX_SRC)/include/asm-mips/mach-generic
	else
	CFLAGS := $(WFLAGS) -Wundef -fno-strict-aliasing -fno-common -ffreestanding -Os -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic -pipe -msoft-float  -mabi=32 -march=mips32r2 -Wa,-32 -Wa,-march=mips32r2 -Wa,-mips32r2 -Wa,--trap -I$(LINUX_SRC)/include/asm-mips/mach-generic
	endif
export CFLAGS
endif

ifeq ($(PLATFORM),INF_AR9)
CFLAGS := $(WFLAGS) -Wundef -fno-strict-aliasing -fno-common -fno-pic -ffreestanding -Os -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic -pipe -msoft-float  -mabi=32 -mlong-calls -march=mips32r2 -mtune=34kc -march=mips32r2 -Wa,-32 -Wa,-march=mips32r2 -Wa,-mips32r2 -Wa,--trap -I$(LINUX_SRC)/include/asm-mips/mach-generic
export CFLAGS
endif

ifeq ($(PLATFORM),INF_VR9)
CFLAGS := $(WFLAGS) -Wundef -fno-strict-aliasing -fno-common -fno-pic -ffreestanding -Os -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic -pipe -msoft-float  -mabi=32 -mlong-calls -march=mips32r2 -march=mips32r2 -Wa,-32 -Wa,-march=mips32r2 -Wa,-mips32r2 -Wa,--trap -I$(LINUX_SRC)/include/asm-mips/mach-generic
export CFLAGS
endif

ifeq ($(PLATFORM),BRCM_6358)
CFLAGS := $(WFLAGS) -nostdinc -iwithprefix include -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -I $(LINUX_SRC)/include/asm/gcc -G 0 -mno-abicalls -fno-pic -pipe  -finline-limit=100000 -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap -I$(LINUX_SRC)/include/asm-mips/mach-bcm963xx -I$(LINUX_SRC)/include/asm-mips/mach-generic  -Os -fomit-frame-pointer -Wdeclaration-after-statement  -DMODULE -mlong-calls
export CFLAGS
endif

ifeq ($(PLATFORM),INF_AMAZON_SE)
CFLAGS := -D__KERNEL__ -DMODULE=1 -I$(LINUX_SRC)/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -DCONFIG_IFX_ALG_QOS -DCONFIG_WAN_VLAN_SUPPORT -fomit-frame-pointer -DIFX_PPPOE_FRAME -G 0 -fno-pic -mno-abicalls -mlong-calls -pipe -finline-limit=100000 -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap -nostdinc -iwithprefix include $(WFLAGS)
export CFLAGS
endif

ifeq ($(PLATFORM),ST)
CFLAGS := -D__KERNEL__ -I$(LINUX_SRC)/include -Wall -O2 -Wundef -Wstrict-prototypes -Wno-trigraphs -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-aliasing -fno-common -fomit-frame-pointer -ffreestanding -m4-nofpu -o $(WFLAGS) 
export CFLAGS
endif

ifeq ($(PLATFORM),PC)
    ifneq (,$(findstring 2.4,$(LINUX_SRC)))
	# Linux 2.4
	CFLAGS := -D__KERNEL__ -I$(LINUX_SRC)/include -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -march=i686 -DMODULE -DMODVERSIONS -include $(LINUX_SRC)/include/linux/modversions.h $(WFLAGS)
	export CFLAGS
    else
	# Linux 2.6
	EXTRA_CFLAGS := $(WFLAGS) 
    endif
endif

ifeq ($(PLATFORM),INTELP6)
	EXTRA_CFLAGS := $(WFLAGS) 
endif

#If the kernel version of RMI is newer than 2.6.27, please change "CFLAGS" to "EXTRA_FLAGS"
ifeq ($(PLATFORM),RMI)
EXTRA_CFLAGS := -D__KERNEL__ -DMODULE=1 -I$(LINUX_SRC)/include -I$(LINUX_SRC)/include/asm-mips/mach-generic -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -DCONFIG_IFX_ALG_QOS -DCONFIG_WAN_VLAN_SUPPORT -fomit-frame-pointer -DIFX_PPPOE_FRAME -G 0 -fno-pic -mno-abicalls -mlong-calls -pipe -finline-limit=100000 -mabi=32 -G 0 -mno-abicalls -fno-pic -pipe -msoft-float -march=xlr -ffreestanding  -march=xlr -Wa,--trap, -nostdinc -iwithprefix include $(WFLAGS)
export EXTRA_CFLAGS
endif

ifeq ($(PLATFORM),RMI_64)
EXTRA_CFLAGS := -D__KERNEL__ -DMODULE=1 -I$(LINUX_SRC)/include -I$(LINUX_SRC)/include/asm-mips/mach-generic -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -DCONFIG_IFX_ALG_QOS -DCONFIG_WAN_VLAN_SUPPORT -fomit-frame-pointer -DIFX_PPPOE_FRAME -G 0 -fno-pic -mno-abicalls -mlong-calls -pipe -finline-limit=100000 -mabi=64 -G 0 -mno-abicalls -fno-pic -pipe -msoft-float -march=xlr -ffreestanding  -march=xlr -Wa,--trap, -nostdinc -iwithprefix include $(WFLAGS)
export EXTRA_CFLAGS
endif

ifeq ($(PLATFORM),IXP)
	CFLAGS := -v -D__KERNEL__ -DMODULE -I$(LINUX_SRC)/include -mbig-endian -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -Uarm -fno-common -pipe -mapcs-32 -D__LINUX_ARM_ARCH__=5 -mcpu=xscale -mtune=xscale -malignment-traps -msoft-float $(WFLAGS)
        EXTRA_CFLAGS := -v $(WFLAGS) -mbig-endian
	export CFLAGS        
endif

ifeq ($(PLATFORM),SMDK)
        EXTRA_CFLAGS := $(WFLAGS) 
endif

ifeq ($(PLATFORM),CAVM_OCTEON)
	EXTRA_CFLAGS := $(WFLAGS) -mabi=64 $(WFLAGS)
export CFLAGS
endif

ifeq ($(PLATFORM),BB_SOC)
WFLAGS += -DRT_BIG_ENDIAN -DBB_SOC -DWIFI_MODULE -DCONFIG_RA_NAT_NONE
ifeq ($(CONFIG_MIPS_TC3262),y)
WFLAGS += -DMULTI_CORE_SUPPORT
endif
ifeq ($(RALINK_PCIE_ADDR_SWAP),1)
WFLAGS += -DBB_PCIE_ADDR_SWAP
endif
ifeq ($(TCSUPPORT_HWNAT_WIFI),1)
WFLAGS += -DBB_RA_HWNAT_WIFI
endif
EXTRA_CFLAGS += -I$(RT28xx_DIR)/include $(WFLAGS)
export EXTRA_CFLAGS
endif

ifeq ($(PLATFORM),DM6446)
	CFLAGS := -nostdinc -iwithprefix include -D__KERNEL__ -I$(LINUX_SRC)/include  -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Os -fno-omit-frame-pointer -fno-omit-frame-pointer -mapcs -mno-sched-prolog -mlittle-endian -mabi=apcs-gnu -D__LINUX_ARM_ARCH__=5 -march=armv5te -mtune=arm9tdmi -msoft-float -Uarm -Wdeclaration-after-statement -c -o $(WFLAGS)
export CFLAGS
endif

ifeq ($(PLATFORM),BL2348)
CFLAGS := -D__KERNEL__ -I$(LINUX_SRC)/include -I$(LINUX_SRC)/include/asm/gcc -I$(LINUX_SRC)/include/asm-mips/mach-tango2 -I$(LINUX_SRC)/include/asm-mips/mach-tango2 -DEM86XX_CHIP=EM86XX_CHIPID_TANGO2 -DEM86XX_REVISION=6 -I$(LINUX_SRC)/include/asm-mips/mach-generic -I$(RT2860_DIR)/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -ffreestanding -O2     -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic -pipe  -mabi=32 -march=mips32r2 -Wa,-32 -Wa,-march=mips32r2 -Wa,-mips32r2 -Wa,--trap -DMODULE $(WFLAGS) -DSIGMA863X_PLATFORM -DEXPORT_SYMTAB -DPLATFORM_BL2348
export CFLAGS
endif

ifeq ($(PLATFORM),BL23570)
EXTRA_CFLAGS := -D__KERNEL__ -I$(LINUX_SRC)/include -I$(LINUX_SRC)/include/asm/gcc -I$(LINUX_SRC)/include/asm-mips/mach-tango2 -I$(LINUX_SRC)/include/asm-mips/mach-tango2 -DEM86XX_CHIP=EM86XX_CHIPID_TANGO2 -DEM86XX_REVISION=6 -I$(LINUX_SRC)/include/asm-mips/mach-generic -I$(RT2860_DIR)/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -ffreestanding -O2     -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic -pipe  -mabi=32 -march=74kc -Wa,-32 -Wa,-march=mips32r2 -Wa,-mips32r2 -Wa,--trap -DMODULE $(WFLAGS) -DSIGMA863X_PLATFORM -DEXPORT_SYMTAB -DPLATFORM_BL23570
export EXTRA_CFLAGS
endif

ifeq ($(PLATFORM),BLUBB)
CFLAGS := -D__KERNEL__ -I$(LINUX_SRC)/include -I$(LINUX_SRC)/include/asm/gcc -I$(LINUX_SRC)/include/asm-mips/mach-tango2 -I$(LINUX_SRC)/include/asm-mips/mach-tango2 -DEM86XX_CHIP=EM86XX_CHIPID_TANGO2 -DEM86XX_REVISION=6 -I$(LINUX_SRC)/include/asm-mips/mach-generic -I$(RT2860_DIR)/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -ffreestanding -O2     -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic -pipe  -mabi=32 -march=mips32r2 -Wa,-32 -Wa,-march=mips32r2 -Wa,-mips32r2 -Wa,--trap -DMODULE $(WFLAGS) -DSIGMA863X_PLATFORM -DEXPORT_SYMTAB -DPLATFORM_BL2348
export CFLAGS
endif

ifeq ($(PLATFORM),BLPMP)
CFLAGS := -D__KERNEL__ -I$(LINUX_SRC)/include -I$(LINUX_SRC)/include/asm/gcc -I$(LINUX_SRC)/include/asm-mips/mach-tango2 -I$(LINUX_SRC)/include/asm-mips/mach-tango2 -DEM86XX_CHIP=EM86XX_CHIPID_TANGO2 -DEM86XX_REVISION=6 -I$(LINUX_SRC)/include/asm-mips/mach-generic -I$(RT2860_DIR)/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -ffreestanding -O2     -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic -pipe  -mabi=32 -march=mips32r2 -Wa,-32 -Wa,-march=mips32r2 -Wa,-mips32r2 -Wa,--trap -DMODULE $(WFLAGS) -DSIGMA863X_PLATFORM -DEXPORT_SYMTAB
export CFLAGS
endif

ifeq ($(PLATFORM),MT85XX)
    ifneq (,$(findstring 2.4,$(LINUX_SRC)))
	# Linux 2.4
	CFLAGS := -D__KERNEL__ -I$(LINUX_SRC)/include -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -march=i686 -DMODULE -DMODVERSIONS -include $(LINUX_SRC)/include/linux/modversions.h $(WFLAGS)
	export CFLAGS

    #else
	# Linux 2.6
	else ifneq (,$(findstring 2.6.35,$(shell readlink -f $(LINUX_SRC))))
		# Linux 2.6.35
		EXTRA_CFLAGS += $(WFLAGS) -DMT85XX -DBD_KERNEL_VER
		EXTRA_CFLAGS += -D _NO_TYPEDEF_BOOL_ \
	                -D _NO_TYPEDEF_UCHAR_ \
	                -D _NO_TYPEDEF_UINT8_ \
	                -D _NO_TYPEDEF_UINT16_ \
	                -D _NO_TYPEDEF_UINT32_ \
	                -D _NO_TYPEDEF_UINT64_ \
	                -D _NO_TYPEDEF_CHAR_ \
	                -D _NO_TYPEDEF_INT16_ \
	                -D _NO_TYPEDEF_INT32_ \
	                -D _NO_TYPEDEF_INT64_ \

    else
		#Linux 3.10
	EXTRA_CFLAGS += $(WFLAGS) -DMT85XX
	EXTRA_CFLAGS += -D _NO_TYPEDEF_BOOL_ \
	                -D _NO_TYPEDEF_UCHAR_ \
	                -D _NO_TYPEDEF_UINT8_ \
	                -D _NO_TYPEDEF_UINT16_ \
	                -D _NO_TYPEDEF_UINT32_ \
	                -D _NO_TYPEDEF_UINT64_ \
	                -D _NO_TYPEDEF_CHAR_ \
	                -D _NO_TYPEDEF_INT16_ \
	                -D _NO_TYPEDEF_INT32_ \
	                -D _NO_TYPEDEF_INT64_ \
	                
    endif
endif

ifeq ($(PLATFORM),MT53XX)
    ifneq (,$(findstring 2.4,$(LINUX_SRC)))
    # Linux 2.4
    CFLAGS := -D__KERNEL__ -I$(LINUX_SRC)/include -I$(RT28xx_DIR)/include -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -march=i686 -DMODULE -DMODVERSIONS -include $(LINUX_SRC)/include/linux/modversions.h $(WFLAGS)
    export CFLAGS
    else
    # Linux 2.6
    EXTRA_CFLAGS += $(WFLAGS) -I$(RT28xx_DIR)/include
    endif
endif


ifeq ($(PLATFORM),PC_AUTO_BUILD)
    ifneq (,$(findstring 2.4,$(LINUX_SRC)))
    # Linux 2.4
    CFLAGS := -D__KERNEL__ -I$(LINUX_SRC)/include -I$(RT28xx_DIR)/include -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -march=i686 -DMODULE -DMODVERSIONS -include $(LINUX_SRC)/include/linux/modversions.h $(WFLAGS)
    export CFLAGS
    else
    # Linux 2.6
    EXTRA_CFLAGS += $(WFLAGS) -I$(RT28xx_DIR)/include
    endif
endif

ifeq ($(PLATFORM),NXP_TV550)
    ifneq (,$(findstring 2.4,$(LINUX_SRC)))
        # Linux 2.4
        CFLAGS := -D__KERNEL__ -I$(LINUX_SRC)/include -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -march=mips -DMODULE -DMODVERSIONS -include $(LINUX_SRC)/include/linux/modversions.h $(WFLAGS)
        export CFLAGS
    else
        # Linux 2.6
        EXTRA_CFLAGS := $(WFLAGS)
    endif
endif

ifeq ($(PLATFORM),MVL5)
CFLAGS := -D__KERNEL__ -I$(LINUX_SRC)/include -mlittle-endian -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -O3 -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-omit-frame-pointer -mapcs -mno-sched-prolog -mno-thumb-interwork -D__LINUX_ARM_ARCH__=5 -march=armv5te -mtune=arm926ej-s --param max-inline-insns-single=40000  -Uarm -Wdeclaration-after-statement -Wno-pointer-sign -DMODULE $(WFLAGS) 
export CFLAGS
endif

ifeq ($(PLATFORM),RALINK_3352)
CFLAGS := -D__KERNEL__ -I$(LINUX_SRC)/include/asm-mips/mach-generic -I$(LINUX_SRC)/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic -pipe  -finline-limit=100000 -march=mips2 -mabi=32 -Wa,--trap -DLINUX -nostdinc -iwithprefix include $(WFLAGS)
export CFLAGS
endif

ifeq ($(PLATFORM),MSTAR)
#        EXTRA_CFLAGS += $(WFLAGS) -I$(RT28xx_DIR)/include
EXTRA_CFLAGS += -I$(LINUX_SRC)/include -I$(RT28xx_DIR)/include -I$(LINUX_SRC)/arch/arm/include -mlittle-endian -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -marm -fno-dwarf2-cfi-asm -fno-omit-frame-pointer -mapcs -mno-sched-prolog -mabi=aapcs-linux -mno-thumb-interwork -D__LINUX_ARM_ARCH__=7 -march=armv7-a -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -fno-inline-functions-called-once -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack $(WFLAGS)
export EXTRA_CFLAGS
endif

ifeq ($(PLATFORM),MT7620)
        EXTRA_CFLAGS := $(WFLAGS) 
endif

ifeq ($(PLATFORM),MT7621)
        EXTRA_CFLAGS := $(WFLAGS)
endif

ifeq ($(PLATFORM),MT7628)
        EXTRA_CFLAGS := $(WFLAGS)
endif
