fix madwifi compile for atheros 2.6
[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_VERSION:=0.9.2.1
14 PKG_RELEASE:=1
15
16 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
17 PKG_SOURCE_URL:=@SF/$(PKG_NAME)
18 PKG_MD5SUM:=bf5509fccd3852e22551826063b1b61e
19 PKG_CAT:=bzcat
20
21 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
22
23 include $(INCLUDE_DIR)/package.mk
24
25 RATE_CONTROL:=sample
26
27 ifeq ($(ARCH),mips)
28 HAL_TARGET:=mips-be-elf
29 endif
30 ifeq ($(ARCH),mipsel)
31 HAL_TARGET:=mips-le-elf
32 endif
33 ifeq ($(ARCH),i386)
34 HAL_TARGET:=i386-elf
35 endif
36 ifeq ($(ARCH),armeb)
37 HAL_TARGET:=xscale-be-elf
38 endif
39 ifeq ($(ARCH),powerpc)
40 HAL_TARGET:=powerpc-be-elf
41 endif
42
43 BUS:=PCI
44 ifneq ($(CONFIG_LINUX_2_6_ATHEROS),)
45 BUS:=AHB
46 HAL_TARGET:=ap51
47 endif
48 ifneq ($(CONFIG_LINUX_2_6_ARUBA),)
49 BUS:=PCI AHB # no suitable HAL for AHB yet.
50 endif
51
52 BUS_MODULES:=
53 ifeq ($(findstring AHB,$(BUS)),AHB)
54 BUS_MODULES+=$(PKG_BUILD_DIR)/ath/ath_ahb.$(LINUX_KMOD_SUFFIX)
55 endif
56 ifeq ($(findstring PCI,$(BUS)),PCI)
57 BUS_MODULES+=$(PKG_BUILD_DIR)/ath/ath_pci.$(LINUX_KMOD_SUFFIX)
58 endif
59
60 MADWIFI_AUTOLOAD:= \
61 wlan \
62 wlan_scan_ap \
63 wlan_scan_sta \
64 ath_hal \
65 ath_rate_$(RATE_CONTROL) \
66 wlan_acl \
67 wlan_ccmp \
68 wlan_tkip \
69 wlan_wep \
70 wlan_xauth
71
72 ifeq ($(findstring AHB,$(BUS)),AHB)
73 MADWIFI_AUTOLOAD += ath_ahb
74 endif
75 ifeq ($(findstring PCI,$(BUS)),PCI)
76 MADWIFI_AUTOLOAD += ath_pci
77 endif
78
79 define KernelPackage/madwifi
80 SUBMENU:=Wireless Drivers
81 TITLE:=Driver for Atheros wireless chipsets
82 DEPENDS:=+wireless-tools
83 DESCRIPTION:=\
84 This package contains a driver for Atheros 802.11a/b/g chipsets.
85 URL:=http://madwifi.org/
86 VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE)
87 FILES:= \
88 $(PKG_BUILD_DIR)/ath/ath_hal.$(LINUX_KMOD_SUFFIX) \
89 $(BUS_MODULES) \
90 $(PKG_BUILD_DIR)/ath_rate/$(RATE_CONTROL)/ath_rate_$(RATE_CONTROL).$(LINUX_KMOD_SUFFIX) \
91 $(PKG_BUILD_DIR)/net80211/wlan*.$(LINUX_KMOD_SUFFIX)
92 AUTOLOAD:=$(call AutoLoad,50,$(MADWIFI_AUTOLOAD))
93 endef
94
95 MADWIFI_MAKEOPTS= -C $(PKG_BUILD_DIR) \
96 PATH="$(TARGET_PATH)" \
97 ARCH="$(LINUX_KARCH)" \
98 CROSS_COMPILE="$(TARGET_CROSS)" \
99 TARGET="$(HAL_TARGET)" \
100 TOOLPREFIX="$(KERNEL_CROSS)" \
101 TOOLPATH="$(KERNEL_CROSS)" \
102 KERNELPATH="$(LINUX_DIR)" \
103 LDOPTS="--no-warn-mismatch " \
104 ATH_RATE="ath_rate/$(RATE_CONTROL)" \
105 DOMULTI=1
106
107 ifeq ($(findstring AHB,$(BUS)),AHB)
108 define Build/Compile/ahb
109 $(MAKE) $(MADWIFI_MAKEOPTS) BUS="AHB" modules
110 endef
111 endif
112
113 ifeq ($(findstring PCI,$(BUS)),PCI)
114 define Build/Compile/pci
115 $(MAKE) $(MADWIFI_MAKEOPTS) BUS="PCI" modules
116 endef
117 endif
118
119 define Build/Configure
120 $(SED) 's,-E[LB] ,,g' $(PKG_BUILD_DIR)/hal/public/*.inc
121 endef
122
123 define Build/Compile
124 $(call Build/Compile/ahb)
125 $(call Build/Compile/pci)
126 $(MAKE) $(MADWIFI_MAKEOPTS) \
127 CFLAGS="$(TARGET_CFLAGS)" \
128 tools
129 endef
130
131 define Build/InstallDev
132 mkdir -p $(STAGING_DIR)/usr/include/madwifi
133 $(CP) $(PKG_BUILD_DIR)/include $(STAGING_DIR)/usr/include/madwifi/
134 mkdir -p $(STAGING_DIR)/usr/include/madwifi/net80211
135 $(CP) $(PKG_BUILD_DIR)/net80211/*.h $(STAGING_DIR)/usr/include/madwifi/net80211/
136 endef
137
138 define Build/UninstallDev
139 rm -rf $(STAGING_DIR)/usr/include/madwifi
140 endef
141
142 define KernelPackage/madwifi/install
143 $(INSTALL_DIR) $(1)/lib/wifi
144 $(INSTALL_DATA) ./files/lib/wifi/madwifi.sh $(1)/lib/wifi
145 $(INSTALL_DIR) $(1)/usr/sbin
146 $(CP) $(PKG_BUILD_DIR)/tools/{madwifi_multi,80211debug,80211stats,athchans,athctrl,athdebug,athkey,athstats,wlanconfig} $(1)/usr/sbin/
147 endef
148
149 $(eval $(call KernelPackage,madwifi))