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