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