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