madwifi: remove braindead code that overwrote the user's antenna diversity setting...
[openwrt.git] / package / madwifi / Makefile
1 #
2 # Copyright (C) 2006-2009 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10 include $(INCLUDE_DIR)/kernel.mk
11
12 PKG_NAME:=madwifi
13
14 ifneq ($(CONFIG_MADWIFI_UPSTREAM),)
15 PKG_VERSION:=0.9.4
16 PKG_RELEASE:=2
17
18 PKG_SOURCE:=madwifi-$(PKG_VERSION).tar.gz
19 PKG_SOURCE_URL:=http://downloads.sourceforge.net/madwifi/
20 PKG_MD5SUM:=399d20de8d855a59f20058857c2178ad
21
22 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/madwifi-$(PKG_VERSION)
23
24 PATCH_DIR=./patches-upstream
25 else
26 # PKG_BRANCH:=madwifi-dfs
27 PKG_REV:=3314
28 PKG_VERSION:=r$(PKG_REV)
29 PKG_RELEASE:=2
30
31 PKG_SOURCE_PROTO:=svn
32 PKG_SOURCE_VERSION:=$(PKG_REV)
33 PKG_SOURCE_SUBDIR:=$(if $(PKG_BRANCH),$(PKG_BRANCH),madwifi-trunk)-$(PKG_VERSION)
34 PKG_SOURCE_URL:=http://svn.madwifi.org/madwifi/$(if $(PKG_BRANCH),branches/$(PKG_BRANCH),trunk)
35 PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
36
37 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(if $(PKG_BRANCH),$(PKG_BRANCH),madwifi-trunk)-$(PKG_VERSION)
38
39 PATCH_DIR=./patches
40 endif
41
42 PKG_BUILD_DEPENDS:=wprobe
43
44 include $(INCLUDE_DIR)/package.mk
45
46 ifneq ($(CONFIG_TARGET_atheros),)
47 BUS:=AHB
48 else
49 ifneq ($(CONFIG_PCI_SUPPORT),)
50 BUS:=PCI
51 endif
52 endif
53
54 # XXX: remove this check later when we have PCI support properly detected on all targets
55 ifneq ($(CONFIG_TARGET_ar7)$(CONFIG_TARGET_uml),)
56 BUS:=
57 endif
58
59 ifneq ($(CONFIG_CPU_MIPS32_R2),)
60 ifeq ($(ARCH),mips)
61 HAL_TARGET:=mips32r2-be-elf
62 endif
63 ifeq ($(ARCH),mipsel)
64 HAL_TARGET:=mips32r2-le-elf
65 endif
66 else
67 ifeq ($(ARCH),mips)
68 HAL_TARGET:=$(if $(CONFIG_MADWIFI_UPSTREAM),mips-be-elf,mips32-be-elf)
69 endif
70 ifeq ($(ARCH),mipsel)
71 HAL_TARGET:=$(if $(CONFIG_MADWIFI_UPSTREAM),mips-le-elf,mips32-le-elf)
72 endif
73 endif
74 ifeq ($(ARCH),i386)
75 HAL_TARGET:=i386-elf
76 endif
77 ifeq ($(ARCH),i686)
78 HAL_TARGET:=i386-elf
79 endif
80 ifeq ($(BOARD),ixp4xx)
81 HAL_TARGET:=xscale-be-elf$(if $(CONFIG_EABI_SUPPORT),gnueabi)
82 endif
83 ifeq ($(BOARD),iop32x)
84 HAL_TARGET:=xscale-le-elf$(if $(CONFIG_EABI_SUPPORT),gnueabi)
85 endif
86 ifeq ($(BOARD),orion)
87 HAL_TARGET:=xscale-le-elf$(if $(CONFIG_EABI_SUPPORT),gnueabi)
88 endif
89 ifeq ($(ARCH),powerpc)
90 HAL_TARGET:=powerpc-be-elf
91 endif
92 ifeq ($(BOARD),storm)
93 HAL_TARGET:=armv4-le-elf$(if $(CONFIG_EABI_SUPPORT),gnueabi)
94 endif
95 ifneq ($(CONFIG_TARGET_atheros),)
96 HAL_TARGET:=wisoc
97 endif
98
99 ifdef CONFIG_MADWIFI_RCA_MINSTREL
100 RATE_CONTROL:=minstrel
101 endif
102
103 ifdef CONFIG_MADWIFI_RCA_ONOE
104 RATE_CONTROL:=onoe
105 endif
106
107 ifdef CONFIG_MADWIFI_RCA_AMRR
108 RATE_CONTROL:=amrr
109 endif
110
111 ifdef CONFIG_MADWIFI_RCA_SAMPLERATE
112 RATE_CONTROL:=sample
113 endif
114
115 MADWIFI_FILES:= \
116 $(PKG_BUILD_DIR)/net80211/wlan.$(LINUX_KMOD_SUFFIX) \
117 $(PKG_BUILD_DIR)/net80211/wlan_scan_ap.$(LINUX_KMOD_SUFFIX) \
118 $(PKG_BUILD_DIR)/net80211/wlan_scan_sta.$(LINUX_KMOD_SUFFIX) \
119 $(PKG_BUILD_DIR)/ath_hal/ath_hal.$(LINUX_KMOD_SUFFIX) \
120 $(PKG_BUILD_DIR)/ath_rate/$(RATE_CONTROL)/ath_rate_$(RATE_CONTROL).$(LINUX_KMOD_SUFFIX) \
121 $(PKG_BUILD_DIR)/net80211/wlan_acl.$(LINUX_KMOD_SUFFIX) \
122 $(PKG_BUILD_DIR)/net80211/wlan_ccmp.$(LINUX_KMOD_SUFFIX) \
123 $(PKG_BUILD_DIR)/net80211/wlan_tkip.$(LINUX_KMOD_SUFFIX) \
124 $(PKG_BUILD_DIR)/net80211/wlan_wep.$(LINUX_KMOD_SUFFIX) \
125 $(PKG_BUILD_DIR)/net80211/wlan_xauth.$(LINUX_KMOD_SUFFIX) \
126
127 MADWIFI_AUTOLOAD:= \
128 wlan \
129 wlan_scan_ap \
130 wlan_scan_sta \
131 ath_hal \
132 ath_rate_$(RATE_CONTROL) \
133 wlan_acl \
134 wlan_ccmp \
135 wlan_tkip \
136 wlan_wep \
137 wlan_xauth \
138
139 ifeq ($(findstring AHB,$(BUS)),AHB)
140 MADWIFI_FILES+= $(PKG_BUILD_DIR)/ath/ath_ahb.$(LINUX_KMOD_SUFFIX)
141 MADWIFI_AUTOLOAD+= ath_ahb
142 endif
143 ifeq ($(findstring PCI,$(BUS)),PCI)
144 MADWIFI_FILES+= $(PKG_BUILD_DIR)/ath/ath_pci.$(LINUX_KMOD_SUFFIX)
145 MADWIFI_AUTOLOAD+= ath_pci
146 endif
147
148 MADWIFI_APPLETS:=80211stats athchans athctrl athkey athstats wlanconfig ath_info
149 ifdef CONFIG_MADWIFI_DEBUG
150 MADWIFI_APPLETS += athdebug 80211debug
151 endif
152 ifndef CONFIG_MADWIFI_UPSTREAM
153 MADWIFI_APPLETS += madwifi_multi
154 endif
155
156 define KernelPackage/madwifi
157 SUBMENU:=Wireless Drivers
158 TITLE:=Driver for Atheros wireless chipsets
159 URL:=http://madwifi.org/
160 DEPENDS:=+wireless-tools @PCI_SUPPORT||TARGET_atheros @!TARGET_ar7 @!TARGET_avr32 @!TARGET_etrax @!TARGET_uml @LINUX_2_6
161 FILES:=$(MADWIFI_FILES)
162 AUTOLOAD:=$(call AutoLoad,50,$(MADWIFI_AUTOLOAD))
163 endef
164
165 define KernelPackage/madwifi/description
166 This package contains a driver for Atheros 802.11a/b/g chipsets.
167 endef
168
169 define KernelPackage/madwifi/config
170 source "$(SOURCE)/Config.in"
171 endef
172
173 MADWIFI_INC = \
174 -I$(PKG_BUILD_DIR) \
175 -I$(PKG_BUILD_DIR)/include \
176 -I$(PKG_BUILD_DIR)/hal \
177 -I$(PKG_BUILD_DIR)/ath \
178 -I$(PKG_BUILD_DIR)/ath_hal \
179 -I$(PKG_BUILD_DIR)/net80211 \
180 -I$(STAGING_DIR)/usr/include \
181 -include $(PKG_BUILD_DIR)/include/compat.h
182
183 MAKE_ARGS:= \
184 PATH="$(TARGET_PATH)" \
185 ARCH="$(LINUX_KARCH)" \
186 CROSS_COMPILE="$(TARGET_CROSS)" \
187 TARGET="$(HAL_TARGET)" \
188 TOOLPREFIX="$(KERNEL_CROSS)" \
189 TOOLPATH="$(KERNEL_CROSS)" \
190 KERNELPATH="$(LINUX_DIR)" \
191 LDOPTS="--no-warn-mismatch " \
192 ATH_RATE="ath_rate/$(RATE_CONTROL)" \
193 DO_MULTI=1 \
194 INCS="$(MADWIFI_INC)" \
195 $(if $(CONFIG_MADWIFI_DEBUG),,DEBUG=) WARNINGS="-Wno-unused"
196
197 MAKE_VARS:= \
198 COPTS="-DCONFIG_ATHEROS_RATE_DEFAULT='\"$(RATE_CONTROL)\"' -DATH_REVERSE_ENGINEERING=1" \
199
200 ifeq ($(CONFIG_MADWIFI_UPSTREAM),)
201 HALFILE:=$(lastword $(sort $(wildcard ./ath_hal-*.tgz)))
202 endif
203
204 ifneq ($(HALFILE),)
205 define Build/Prepare/HAL
206 rm -rf $(PKG_BUILD_DIR)/tmp
207 mkdir -p $(PKG_BUILD_DIR)/tmp
208 tar xvzf $(HALFILE) -C $(PKG_BUILD_DIR)/tmp
209 $(CP) $(PKG_BUILD_DIR)/tmp/ath_hal*/* $(PKG_BUILD_DIR)/hal/
210 rm -rf $(PKG_BUILD_DIR)/tmp
211 endef
212 endif
213
214 define Build/Prepare
215 $(call Build/Prepare/Default)
216 $(call Build/Prepare/HAL)
217 # patch cflags
218 $(SED) 's, -E[LB],,' \
219 -e 's, -mips2,,' \
220 -e 's, -mapcs-32,,' \
221 $(PKG_BUILD_DIR)/hal/public/*.inc
222 $(SED) 's,march=armv4,march=armv5te,' \
223 $(PKG_BUILD_DIR)/hal/public/xscale*.inc
224 endef
225
226 ifeq ($(findstring AHB,$(BUS)),AHB)
227 define Build/Compile/ahb
228 $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) BUS="AHB" modules
229 $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) CFLAGS="$(TARGET_CFLAGS)" tools
230 endef
231 endif
232
233 ifeq ($(findstring PCI,$(BUS)),PCI)
234 define Build/Compile/pci
235 $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) BUS="PCI" modules
236 $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) CFLAGS="$(TARGET_CFLAGS)" tools
237 endef
238 endif
239
240 define Build/Configure
241 $(SED) 's,-E[LB] ,,g' $(PKG_BUILD_DIR)/hal/public/*.inc
242 endef
243
244 define Build/Compile
245 $(call Build/Compile/ahb)
246 $(call Build/Compile/pci)
247 endef
248
249 define Build/InstallDev
250 mkdir -p $(1)/usr/include/madwifi
251 $(CP) $(PKG_BUILD_DIR)/include $(1)/usr/include/madwifi/
252 mkdir -p $(1)/usr/include/madwifi/net80211
253 $(CP) $(PKG_BUILD_DIR)/net80211/*.h $(1)/usr/include/madwifi/net80211/
254 endef
255
256 define KernelPackage/madwifi/install
257 $(INSTALL_DIR) $(1)/usr/sbin
258 $(CP) ./files/* $(1)/
259 $(CP) $(foreach applet,$(MADWIFI_APPLETS),$(PKG_BUILD_DIR)/tools/$(applet)) $(1)/usr/sbin/
260 endef
261
262 $(eval $(call KernelPackage,madwifi))
This page took 0.074788 seconds and 5 git commands to generate.