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