Build a karma variant of madwifi
[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_MD5SUM:=fe5d41acd085d2c46934be3f8839e694
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),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 ifneq ($(CONFIG_TARGET_atheros),)
45 BUS:=AHB
46 HAL_TARGET:=ap51
47 else
48 ifneq ($(CONFIG_PCI_SUPPORT),)
49 BUS:=PCI
50 endif
51 endif
52
53 # XXX: remove this check later when we have PCI support properly detected on all targets
54 ifneq ($(CONFIG_TARGET_uml),)
55 BUS:=
56 endif
57
58 RATE_CONTROL:=minstrel
59
60 MADWIFI_FILES:= \
61 $(PKG_BUILD_DIR)/net80211/wlan.$(LINUX_KMOD_SUFFIX) \
62 $(PKG_BUILD_DIR)/net80211/wlan_scan_ap.$(LINUX_KMOD_SUFFIX) \
63 $(PKG_BUILD_DIR)/net80211/wlan_scan_sta.$(LINUX_KMOD_SUFFIX) \
64 $(PKG_BUILD_DIR)/ath_hal/ath_hal.$(LINUX_KMOD_SUFFIX) \
65 $(PKG_BUILD_DIR)/ath_rate/$(RATE_CONTROL)/ath_rate_$(RATE_CONTROL).$(LINUX_KMOD_SUFFIX) \
66 $(PKG_BUILD_DIR)/net80211/wlan_acl.$(LINUX_KMOD_SUFFIX) \
67 $(PKG_BUILD_DIR)/net80211/wlan_ccmp.$(LINUX_KMOD_SUFFIX) \
68 $(PKG_BUILD_DIR)/net80211/wlan_tkip.$(LINUX_KMOD_SUFFIX) \
69 $(PKG_BUILD_DIR)/net80211/wlan_wep.$(LINUX_KMOD_SUFFIX) \
70 $(PKG_BUILD_DIR)/net80211/wlan_xauth.$(LINUX_KMOD_SUFFIX) \
71
72 MADWIFI_AUTOLOAD:= \
73 wlan \
74 wlan_scan_ap \
75 wlan_scan_sta \
76 ath_hal \
77 ath_rate_$(RATE_CONTROL) \
78 wlan_acl \
79 wlan_ccmp \
80 wlan_tkip \
81 wlan_wep \
82 wlan_xauth \
83
84 ifeq ($(findstring AHB,$(BUS)),AHB)
85 MADWIFI_FILES+= $(PKG_BUILD_DIR)/ath/ath_ahb.$(LINUX_KMOD_SUFFIX)
86 MADWIFI_AUTOLOAD+= ath_ahb
87 endif
88 ifeq ($(findstring PCI,$(BUS)),PCI)
89 MADWIFI_FILES+= $(PKG_BUILD_DIR)/ath/ath_pci.$(LINUX_KMOD_SUFFIX)
90 MADWIFI_AUTOLOAD+= ath_pci
91 endif
92
93 define KernelPackage/madwifi
94 SUBMENU:=Wireless Drivers
95 TITLE:=Driver for Atheros wireless chipsets
96 URL:=http://madwifi.org/
97 DEPENDS:=+wireless-tools @PCI_SUPPORT||TARGET_atheros @!TARGET_avr32 @!TARGET_etrax @!TARGET_uml
98 FILES:=$(MADWIFI_FILES)
99 AUTOLOAD:=$(call AutoLoad,50,$(MADWIFI_AUTOLOAD))
100 endef
101
102 define KernelPackage/madwifi/description
103 This package contains a driver for Atheros 802.11a/b/g chipsets.
104 endef
105
106 define KernelPackage/madwifi-karma
107 $(call KernelPackage/madwifi)
108 TITLE:=Madwifi for Karma support
109 URL:=http://www.digininja.org/
110 endef
111
112 define KernelPackage/madwifi-karma/description
113 This package contains a modified driver to be used with
114 the Karma software for Atheros 802.11a/b/g chipsets.
115 endef
116
117 MAKE_ARGS:= \
118 PATH="$(TARGET_PATH)" \
119 ARCH="$(LINUX_KARCH)" \
120 CROSS_COMPILE="$(TARGET_CROSS)" \
121 TARGET="$(HAL_TARGET)" \
122 TOOLPREFIX="$(KERNEL_CROSS)" \
123 TOOLPATH="$(KERNEL_CROSS)" \
124 KERNELPATH="$(LINUX_DIR)" \
125 LDOPTS="--no-warn-mismatch " \
126 ATH_RATE="ath_rate/$(RATE_CONTROL)" \
127 WARNINGS="" \
128 DOMULTI=1
129
130 MAKE_VARS:= \
131 COPTS="-DCONFIG_ATHEROS_RATE_DEFAULT='\"$(RATE_CONTROL)\"'" \
132
133 ifeq ($(findstring AHB,$(BUS)),AHB)
134 define Build/Compile/ahb
135 $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) BUS="AHB" modules
136 $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) CFLAGS="$(TARGET_CFLAGS)" tools
137 endef
138 endif
139
140 ifeq ($(findstring PCI,$(BUS)),PCI)
141 define Build/Compile/pci
142 $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) BUS="PCI" modules
143 $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) CFLAGS="$(TARGET_CFLAGS)" tools
144 endef
145 endif
146
147 define Build/Configure
148 $(SED) 's,-E[LB] ,,g' $(PKG_BUILD_DIR)/hal/public/*.inc
149 ifneq ($(CONFIG_PACKAGE_kmod-madwifi-karma),)
150 $(PATCH) $(PKG_BUILD_DIR) ./files
151 endif
152 endef
153
154 define Build/Compile
155 $(call Build/Compile/ahb)
156 $(call Build/Compile/pci)
157 endef
158
159 define Build/InstallDev
160 mkdir -p $(1)/usr/include/madwifi
161 $(CP) $(PKG_BUILD_DIR)/include $(1)/usr/include/madwifi/
162 mkdir -p $(1)/usr/include/madwifi/net80211
163 $(CP) $(PKG_BUILD_DIR)/net80211/*.h $(1)/usr/include/madwifi/net80211/
164 endef
165
166 define Build/UninstallDev
167 rm -rf $(1)/usr/include/madwifi
168 endef
169
170 define KernelPackage/madwifi/install
171 $(INSTALL_DIR) $(1)/lib/wifi
172 $(INSTALL_DATA) ./files/lib/wifi/madwifi.sh $(1)/lib/wifi
173 $(INSTALL_DIR) $(1)/usr/sbin
174 $(CP) $(PKG_BUILD_DIR)/tools/{madwifi_multi,80211stats,athchans,athctrl,athkey,athstats,wlanconfig} $(1)/usr/sbin/
175 endef
176
177 define KernelPackage/madwifi-karma/install
178 $(INSTALL_DIR) $(1)/lib/wifi
179 $(INSTALL_DATA) ./files/lib/wifi/madwifi.sh $(1)/lib/wifi
180 $(INSTALL_DIR) $(1)/usr/sbin
181 $(CP) $(PKG_BUILD_DIR)/tools/{madwifi_multi,80211stats,athchans,athctrl,athkey,athstats,wlanconfig} $(1)/usr/sbin/
182 endef
183
184 $(eval $(call KernelPackage,madwifi))
185 $(eval $(call KernelPackage,madwifi-karma))