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