update madwifi to the madwifi-dfs branch - should fix a few ad-hoc mode issues, needs...
[openwrt/svn-archive/archive.git] / package / madwifi / Makefile
1 #
2 # Copyright (C) 2006 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:=2996
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)-$(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)/$(PKG_BRANCH)-$(PKG_VERSION)
25
26 include $(INCLUDE_DIR)/package.mk
27
28 ifeq ($(ARCH),mips)
29 HAL_TARGET:=mips-be-elf
30 endif
31 ifeq ($(ARCH),mipsel)
32 HAL_TARGET:=mips-le-elf
33 endif
34 ifeq ($(ARCH),i386)
35 HAL_TARGET:=i386-elf
36 endif
37 ifeq ($(ARCH),i686)
38 HAL_TARGET:=i386-elf
39 endif
40 ifeq ($(ARCH),armeb)
41 HAL_TARGET:=xscale-be-elf
42 endif
43 ifeq ($(ARCH),arm)
44 HAL_TARGET:=xscale-le-elf
45 endif
46 ifeq ($(ARCH),powerpc)
47 HAL_TARGET:=powerpc-be-elf
48 endif
49
50 ifneq ($(CONFIG_TARGET_atheros),)
51 BUS:=AHB
52 HAL_TARGET:=ap51
53 else
54 ifneq ($(CONFIG_PCI_SUPPORT),)
55 BUS:=PCI
56 endif
57 endif
58
59 # XXX: remove this check later when we have PCI support properly detected on all targets
60 ifneq ($(CONFIG_TARGET_uml),)
61 BUS:=
62 endif
63
64 RATE_CONTROL:=minstrel
65
66 MADWIFI_FILES:= \
67 $(PKG_BUILD_DIR)/net80211/wlan.$(LINUX_KMOD_SUFFIX) \
68 $(PKG_BUILD_DIR)/net80211/wlan_scan_ap.$(LINUX_KMOD_SUFFIX) \
69 $(PKG_BUILD_DIR)/net80211/wlan_scan_sta.$(LINUX_KMOD_SUFFIX) \
70 $(PKG_BUILD_DIR)/ath_hal/ath_hal.$(LINUX_KMOD_SUFFIX) \
71 $(PKG_BUILD_DIR)/ath_rate/$(RATE_CONTROL)/ath_rate_$(RATE_CONTROL).$(LINUX_KMOD_SUFFIX) \
72 $(PKG_BUILD_DIR)/net80211/wlan_acl.$(LINUX_KMOD_SUFFIX) \
73 $(PKG_BUILD_DIR)/net80211/wlan_ccmp.$(LINUX_KMOD_SUFFIX) \
74 $(PKG_BUILD_DIR)/net80211/wlan_tkip.$(LINUX_KMOD_SUFFIX) \
75 $(PKG_BUILD_DIR)/net80211/wlan_wep.$(LINUX_KMOD_SUFFIX) \
76 $(PKG_BUILD_DIR)/net80211/wlan_xauth.$(LINUX_KMOD_SUFFIX) \
77
78 MADWIFI_AUTOLOAD:= \
79 wlan \
80 wlan_scan_ap \
81 wlan_scan_sta \
82 ath_hal \
83 ath_rate_$(RATE_CONTROL) \
84 wlan_acl \
85 wlan_ccmp \
86 wlan_tkip \
87 wlan_wep \
88 wlan_xauth \
89
90 ifeq ($(findstring AHB,$(BUS)),AHB)
91 MADWIFI_FILES+= $(PKG_BUILD_DIR)/ath/ath_ahb.$(LINUX_KMOD_SUFFIX)
92 MADWIFI_AUTOLOAD+= ath_ahb
93 endif
94 ifeq ($(findstring PCI,$(BUS)),PCI)
95 MADWIFI_FILES+= $(PKG_BUILD_DIR)/ath/ath_pci.$(LINUX_KMOD_SUFFIX)
96 MADWIFI_AUTOLOAD+= ath_pci
97 endif
98
99 define KernelPackage/madwifi
100 SUBMENU:=Wireless Drivers
101 TITLE:=Driver for Atheros wireless chipsets
102 URL:=http://madwifi.org/
103 DEPENDS:=+wireless-tools @PCI_SUPPORT||TARGET_atheros @!TARGET_avr32 @!TARGET_etrax @!TARGET_uml
104 FILES:=$(MADWIFI_FILES)
105 AUTOLOAD:=$(call AutoLoad,50,$(MADWIFI_AUTOLOAD))
106 endef
107
108 define KernelPackage/madwifi/description
109 This package contains a driver for Atheros 802.11a/b/g chipsets.
110 endef
111
112 MAKE_ARGS:= \
113 PATH="$(TARGET_PATH)" \
114 ARCH="$(LINUX_KARCH)" \
115 CROSS_COMPILE="$(TARGET_CROSS)" \
116 TARGET="$(HAL_TARGET)" \
117 TOOLPREFIX="$(KERNEL_CROSS)" \
118 TOOLPATH="$(KERNEL_CROSS)" \
119 KERNELPATH="$(LINUX_DIR)" \
120 LDOPTS="--no-warn-mismatch " \
121 ATH_RATE="ath_rate/$(RATE_CONTROL)" \
122 WARNINGS="" \
123 DOMULTI=1
124
125 MAKE_VARS:= \
126 COPTS="-DCONFIG_ATHEROS_RATE_DEFAULT='\"$(RATE_CONTROL)\"'" \
127
128 ifeq ($(findstring AHB,$(BUS)),AHB)
129 define Build/Compile/ahb
130 $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) BUS="AHB" modules
131 $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) CFLAGS="$(TARGET_CFLAGS)" tools
132 endef
133 endif
134
135 ifeq ($(findstring PCI,$(BUS)),PCI)
136 define Build/Compile/pci
137 $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) BUS="PCI" modules
138 $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) CFLAGS="$(TARGET_CFLAGS)" tools
139 endef
140 endif
141
142 define Build/Configure
143 $(SED) 's,-E[LB] ,,g' $(PKG_BUILD_DIR)/hal/public/*.inc
144 endef
145
146 define Build/Compile
147 $(call Build/Compile/ahb)
148 $(call Build/Compile/pci)
149 endef
150
151 define Build/InstallDev
152 mkdir -p $(1)/usr/include/madwifi
153 $(CP) $(PKG_BUILD_DIR)/include $(1)/usr/include/madwifi/
154 mkdir -p $(1)/usr/include/madwifi/net80211
155 $(CP) $(PKG_BUILD_DIR)/net80211/*.h $(1)/usr/include/madwifi/net80211/
156 endef
157
158 define Build/UninstallDev
159 rm -rf $(1)/usr/include/madwifi
160 endef
161
162 define KernelPackage/madwifi/install
163 $(INSTALL_DIR) $(1)/lib/wifi
164 $(INSTALL_DATA) ./files/lib/wifi/madwifi.sh $(1)/lib/wifi
165 $(INSTALL_DIR) $(1)/usr/sbin
166 $(CP) $(PKG_BUILD_DIR)/tools/{madwifi_multi,80211stats,athchans,athctrl,athkey,athstats,wlanconfig} $(1)/usr/sbin/
167 endef
168
169 $(eval $(call KernelPackage,madwifi))