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