use unexport instead of export to clear perforce variables
[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 ifneq ($(CONFIG_CPU_MIPS32_R2),)
54 ifeq ($(ARCH),mips)
55 HAL_TARGET:=mips32r2-be-elf
56 endif
57 ifeq ($(ARCH),mipsel)
58 HAL_TARGET:=mips32r2-le-elf
59 endif
60 else
61 ifeq ($(ARCH),mips)
62 HAL_TARGET:=$(if $(CONFIG_MADWIFI_UPSTREAM),mips-be-elf,mips32-be-elf)
63 endif
64 ifeq ($(ARCH),mipsel)
65 HAL_TARGET:=$(if $(CONFIG_MADWIFI_UPSTREAM),mips-le-elf,mips32-le-elf)
66 endif
67 endif
68 ifeq ($(ARCH),i386)
69 HAL_TARGET:=i386-elf
70 endif
71 ifeq ($(ARCH),i686)
72 HAL_TARGET:=i386-elf
73 endif
74 ifeq ($(BOARD),ixp4xx)
75 HAL_TARGET:=xscale-be-elf$(if $(CONFIG_EABI_SUPPORT),gnueabi)
76 endif
77 ifeq ($(BOARD),iop32x)
78 HAL_TARGET:=xscale-le-elf$(if $(CONFIG_EABI_SUPPORT),gnueabi)
79 endif
80 ifeq ($(BOARD),orion)
81 HAL_TARGET:=xscale-le-elf$(if $(CONFIG_EABI_SUPPORT),gnueabi)
82 endif
83 ifeq ($(ARCH),powerpc)
84 HAL_TARGET:=powerpc-be-elf
85 endif
86 ifeq ($(BOARD),storm)
87 HAL_TARGET:=armv4-le-elf$(if $(CONFIG_EABI_SUPPORT),gnueabi)
88 endif
89 ifneq ($(CONFIG_TARGET_atheros),)
90 HAL_TARGET:=wisoc
91 endif
92
93 ifdef CONFIG_MADWIFI_RCA_MINSTREL
94 RATE_CONTROL:=minstrel
95 endif
96
97 ifdef CONFIG_MADWIFI_RCA_ONOE
98 RATE_CONTROL:=onoe
99 endif
100
101 ifdef CONFIG_MADWIFI_RCA_AMRR
102 RATE_CONTROL:=amrr
103 endif
104
105 ifdef CONFIG_MADWIFI_RCA_SAMPLERATE
106 RATE_CONTROL:=sample
107 endif
108
109 MADWIFI_FILES:= \
110 $(PKG_BUILD_DIR)/net80211/wlan.$(LINUX_KMOD_SUFFIX) \
111 $(PKG_BUILD_DIR)/net80211/wlan_scan_ap.$(LINUX_KMOD_SUFFIX) \
112 $(PKG_BUILD_DIR)/net80211/wlan_scan_sta.$(LINUX_KMOD_SUFFIX) \
113 $(PKG_BUILD_DIR)/ath_hal/ath_hal.$(LINUX_KMOD_SUFFIX) \
114 $(PKG_BUILD_DIR)/ath_rate/$(RATE_CONTROL)/ath_rate_$(RATE_CONTROL).$(LINUX_KMOD_SUFFIX) \
115 $(PKG_BUILD_DIR)/net80211/wlan_acl.$(LINUX_KMOD_SUFFIX) \
116 $(PKG_BUILD_DIR)/net80211/wlan_ccmp.$(LINUX_KMOD_SUFFIX) \
117 $(PKG_BUILD_DIR)/net80211/wlan_tkip.$(LINUX_KMOD_SUFFIX) \
118 $(PKG_BUILD_DIR)/net80211/wlan_wep.$(LINUX_KMOD_SUFFIX) \
119 $(PKG_BUILD_DIR)/net80211/wlan_xauth.$(LINUX_KMOD_SUFFIX) \
120
121 MADWIFI_AUTOLOAD:= \
122 wlan \
123 wlan_scan_ap \
124 wlan_scan_sta \
125 ath_hal \
126 ath_rate_$(RATE_CONTROL) \
127 wlan_acl \
128 wlan_ccmp \
129 wlan_tkip \
130 wlan_wep \
131 wlan_xauth \
132
133 ifeq ($(findstring AHB,$(BUS)),AHB)
134 MADWIFI_FILES+= $(PKG_BUILD_DIR)/ath/ath_ahb.$(LINUX_KMOD_SUFFIX)
135 MADWIFI_AUTOLOAD+= ath_ahb
136 endif
137 ifeq ($(findstring PCI,$(BUS)),PCI)
138 MADWIFI_FILES+= $(PKG_BUILD_DIR)/ath/ath_pci.$(LINUX_KMOD_SUFFIX)
139 MADWIFI_AUTOLOAD+= ath_pci
140 endif
141
142 MADWIFI_APPLETS:=80211stats athchans athctrl athkey athstats wlanconfig ath_info
143 ifdef CONFIG_MADWIFI_DEBUG
144 MADWIFI_APPLETS += athdebug 80211debug
145 endif
146 ifndef CONFIG_MADWIFI_UPSTREAM
147 MADWIFI_APPLETS += madwifi_multi
148 endif
149
150 define KernelPackage/madwifi
151 SUBMENU:=Wireless Drivers
152 TITLE:=Driver for Atheros wireless chipsets
153 URL:=http://madwifi.org/
154 DEPENDS:=+wireless-tools @PCI_SUPPORT||TARGET_atheros @!TARGET_avr32 @!TARGET_etrax @LINUX_2_6
155 FILES:=$(MADWIFI_FILES)
156 AUTOLOAD:=$(call AutoLoad,50,$(MADWIFI_AUTOLOAD))
157 endef
158
159 define KernelPackage/madwifi/description
160 This package contains a driver for Atheros 802.11a/b/g chipsets.
161 endef
162
163 define KernelPackage/madwifi/config
164 source "$(SOURCE)/Config.in"
165 endef
166
167 MADWIFI_INC = \
168 -I$(PKG_BUILD_DIR) \
169 -I$(PKG_BUILD_DIR)/include \
170 -I$(PKG_BUILD_DIR)/hal \
171 -I$(PKG_BUILD_DIR)/ath \
172 -I$(PKG_BUILD_DIR)/ath_hal \
173 -I$(PKG_BUILD_DIR)/net80211 \
174 -I$(STAGING_DIR)/usr/include/wprobe \
175 -include $(PKG_BUILD_DIR)/include/compat.h
176
177 MAKE_ARGS:= \
178 PATH="$(TARGET_PATH)" \
179 ARCH="$(LINUX_KARCH)" \
180 CROSS_COMPILE="$(TARGET_CROSS)" \
181 TARGET="$(HAL_TARGET)" \
182 TOOLPREFIX="$(KERNEL_CROSS)" \
183 TOOLPATH="$(KERNEL_CROSS)" \
184 KERNELPATH="$(LINUX_DIR)" \
185 LDOPTS="--no-warn-mismatch " \
186 ATH_RATE="ath_rate/$(RATE_CONTROL)" \
187 DO_MULTI=1 \
188 INCS="$(MADWIFI_INC)" \
189 $(if $(CONFIG_MADWIFI_DEBUG),,DEBUG=) WARNINGS="-Wno-unused"
190
191 MAKE_VARS:= \
192 COPTS="-DCONFIG_ATHEROS_RATE_DEFAULT='\"$(RATE_CONTROL)\"' -DATH_REVERSE_ENGINEERING=1" \
193
194 ifeq ($(CONFIG_MADWIFI_UPSTREAM),)
195 HALFILE:=$(lastword $(sort $(wildcard ./ath_hal-*.tgz)))
196 endif
197
198 ifneq ($(HALFILE),)
199 define Build/Prepare/HAL
200 rm -rf $(PKG_BUILD_DIR)/tmp
201 mkdir -p $(PKG_BUILD_DIR)/tmp
202 tar xvzf $(HALFILE) -C $(PKG_BUILD_DIR)/tmp
203 $(CP) $(PKG_BUILD_DIR)/tmp/ath_hal*/* $(PKG_BUILD_DIR)/hal/
204 rm -rf $(PKG_BUILD_DIR)/tmp
205 endef
206 endif
207
208 define Build/Prepare
209 $(call Build/Prepare/Default)
210 $(call Build/Prepare/HAL)
211 # patch cflags
212 $(SED) 's, -E[LB],,' \
213 -e 's, -mips2,,' \
214 -e 's, -mapcs-32,,' \
215 $(PKG_BUILD_DIR)/hal/public/*.inc
216 $(SED) 's,march=armv4,march=armv5te,' \
217 $(PKG_BUILD_DIR)/hal/public/xscale*.inc
218 endef
219
220 ifeq ($(findstring AHB,$(BUS)),AHB)
221 define Build/Compile/ahb
222 $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) BUS="AHB" modules
223 $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) CFLAGS="$(TARGET_CFLAGS)" tools
224 endef
225 endif
226
227 ifeq ($(findstring PCI,$(BUS)),PCI)
228 define Build/Compile/pci
229 $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) BUS="PCI" modules
230 $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) CFLAGS="$(TARGET_CFLAGS)" tools
231 endef
232 endif
233
234 define Build/Configure
235 $(SED) 's,-E[LB] ,,g' $(PKG_BUILD_DIR)/hal/public/*.inc
236 endef
237
238 define Build/Compile
239 $(call Build/Compile/ahb)
240 $(call Build/Compile/pci)
241 endef
242
243 define Build/InstallDev
244 mkdir -p $(1)/usr/include/madwifi
245 $(CP) $(PKG_BUILD_DIR)/include $(1)/usr/include/madwifi/
246 mkdir -p $(1)/usr/include/madwifi/net80211
247 $(CP) $(PKG_BUILD_DIR)/net80211/*.h $(1)/usr/include/madwifi/net80211/
248 endef
249
250 define KernelPackage/madwifi/install
251 $(INSTALL_DIR) $(1)/usr/sbin
252 $(CP) ./files/* $(1)/
253 $(CP) $(foreach applet,$(MADWIFI_APPLETS),$(PKG_BUILD_DIR)/tools/$(applet)) $(1)/usr/sbin/
254 endef
255
256 $(eval $(call KernelPackage,madwifi))
This page took 0.084307 seconds and 5 git commands to generate.