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