-MADWIFI_MAKEOPTS= -C $(PKG_BUILD_DIR) \
- PATH="$(TARGET_PATH)" \
- ARCH="$(LINUX_KARCH)" \
- CROSS_COMPILE="$(TARGET_CROSS)" \
- TARGET="$(HAL_TARGET)" \
- TOOLPREFIX="$(KERNEL_CROSS)" \
- TOOLPATH="$(KERNEL_CROSS)" \
- KERNELPATH="$(LINUX_DIR)" \
- LDOPTS=" " \
- ATH_RATE="ath_rate/$(RATE_CONTROL)" \
- DOMULTI=1
+MADWIFI_INC = \
+ -I$(PKG_BUILD_DIR) \
+ -I$(PKG_BUILD_DIR)/include \
+ -I$(PKG_BUILD_DIR)/hal \
+ -I$(PKG_BUILD_DIR)/ath \
+ -I$(PKG_BUILD_DIR)/ath_hal \
+ -I$(PKG_BUILD_DIR)/net80211 \
+ -I$(STAGING_DIR)/usr/include/wprobe \
+ -include $(PKG_BUILD_DIR)/include/compat.h
+
+MAKE_ARGS:= \
+ PATH="$(TARGET_PATH)" \
+ ARCH="$(LINUX_KARCH)" \
+ ARCH-y="$(LINUX_KARCH)" \
+ CROSS_COMPILE="$(TARGET_CROSS)" \
+ TARGET="$(HAL_TARGET)" \
+ TOOLPREFIX="$(KERNEL_CROSS)" \
+ TOOLPATH="$(KERNEL_CROSS)" \
+ KERNELPATH="$(LINUX_DIR)" \
+ LDOPTS="--no-warn-mismatch " \
+ ATH_RATE="$(RATE_CONTROL)" \
+ ATH_CAP_SUPERG_COMP="$(COMPRESSION)" \
+ DO_MULTI=1 \
+ SINGLE_MODULE=$(if $(CONFIG_MADWIFI_SINGLE_MODULE),1) \
+ INCS="$(MADWIFI_INC)" \
+ $(if $(CONFIG_MADWIFI_DEBUG),,DEBUG=) WARNINGS="-Wno-unused"
+
+MAKE_VARS:= \
+ COPTS="-DATH_REVERSE_ENGINEERING=1" \
+
+define Build/Prepare/HAL
+ rm -rf $(PKG_BUILD_DIR)/tmp
+ mkdir -p $(PKG_BUILD_DIR)/tmp
+ tar xvzf $(DL_DIR)/$(HAL_FILE) -C $(PKG_BUILD_DIR)/tmp
+ $(CP) $(PKG_BUILD_DIR)/tmp/ath_hal*/* $(PKG_BUILD_DIR)/hal/
+ rm -rf $(PKG_BUILD_DIR)/tmp
+endef
+
+define Build/Prepare
+ $(call Build/Prepare/Default)
+ $(call Build/Prepare/HAL)
+ # patch cflags
+ $(SED) 's, -E[LB],,' \
+ -e 's, -mips2,,' \
+ -e 's, -mapcs-32,,' \
+ -e 's, -mlong-calls,,' \
+ $(PKG_BUILD_DIR)/hal/public/*.inc
+ $(SED) 's,march=armv4,march=armv5te,' \
+ $(PKG_BUILD_DIR)/hal/public/xscale*.inc
+endef