don't assume PCI support, cleanup
[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 RATE_CONTROL:=minstrel
54
55 MADWIFI_FILES:= \
56 $(PKG_BUILD_DIR)/net80211/wlan.$(LINUX_KMOD_SUFFIX) \
57 $(PKG_BUILD_DIR)/net80211/wlan_scan_ap.$(LINUX_KMOD_SUFFIX) \
58 $(PKG_BUILD_DIR)/net80211/wlan_scan_sta.$(LINUX_KMOD_SUFFIX) \
59 $(PKG_BUILD_DIR)/ath_hal/ath_hal.$(LINUX_KMOD_SUFFIX) \
60 $(PKG_BUILD_DIR)/ath_rate/$(RATE_CONTROL)/ath_rate_$(RATE_CONTROL).$(LINUX_KMOD_SUFFIX) \
61 $(PKG_BUILD_DIR)/net80211/wlan_acl.$(LINUX_KMOD_SUFFIX) \
62 $(PKG_BUILD_DIR)/net80211/wlan_ccmp.$(LINUX_KMOD_SUFFIX) \
63 $(PKG_BUILD_DIR)/net80211/wlan_tkip.$(LINUX_KMOD_SUFFIX) \
64 $(PKG_BUILD_DIR)/net80211/wlan_wep.$(LINUX_KMOD_SUFFIX) \
65 $(PKG_BUILD_DIR)/net80211/wlan_xauth.$(LINUX_KMOD_SUFFIX) \
66
67 MADWIFI_AUTOLOAD:= \
68 wlan \
69 wlan_scan_ap \
70 wlan_scan_sta \
71 ath_hal \
72 ath_rate_$(RATE_CONTROL) \
73 wlan_acl \
74 wlan_ccmp \
75 wlan_tkip \
76 wlan_wep \
77 wlan_xauth \
78
79 ifeq ($(findstring AHB,$(BUS)),AHB)
80 MADWIFI_FILES+= $(PKG_BUILD_DIR)/ath/ath_ahb.$(LINUX_KMOD_SUFFIX)
81 MADWIFI_AUTOLOAD+= ath_ahb
82 endif
83 ifeq ($(findstring PCI,$(BUS)),PCI)
84 MADWIFI_FILES+= $(PKG_BUILD_DIR)/ath/ath_pci.$(LINUX_KMOD_SUFFIX)
85 MADWIFI_AUTOLOAD+= ath_pci
86 endif
87
88 define KernelPackage/madwifi
89 SUBMENU:=Wireless Drivers
90 TITLE:=Driver for Atheros wireless chipsets
91 URL:=http://madwifi.org/
92 DEPENDS:=+wireless-tools @PCI_SUPPORT||TARGET_atheros @!TARGET_avr32 @!TARGET_etrax
93 FILES:=$(MADWIFI_FILES)
94 AUTOLOAD:=$(call AutoLoad,50,$(MADWIFI_AUTOLOAD))
95 endef
96
97 define KernelPackage/madwifi/description
98 This package contains a driver for Atheros 802.11a/b/g chipsets.
99 endef
100
101 MAKE_ARGS:= \
102 PATH="$(TARGET_PATH)" \
103 ARCH="$(LINUX_KARCH)" \
104 CROSS_COMPILE="$(TARGET_CROSS)" \
105 TARGET="$(HAL_TARGET)" \
106 TOOLPREFIX="$(KERNEL_CROSS)" \
107 TOOLPATH="$(KERNEL_CROSS)" \
108 KERNELPATH="$(LINUX_DIR)" \
109 LDOPTS="--no-warn-mismatch " \
110 ATH_RATE="ath_rate/$(RATE_CONTROL)" \
111 WARNINGS="" \
112 DOMULTI=1
113
114 MAKE_VARS:= \
115 COPTS="-DCONFIG_ATHEROS_RATE_DEFAULT='\"$(RATE_CONTROL)\"'" \
116
117 ifeq ($(findstring AHB,$(BUS)),AHB)
118 define Build/Compile/ahb
119 $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) BUS="AHB" modules
120 $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) CFLAGS="$(TARGET_CFLAGS)" tools
121 endef
122 endif
123
124 ifeq ($(findstring PCI,$(BUS)),PCI)
125 define Build/Compile/pci
126 $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) BUS="PCI" modules
127 $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) CFLAGS="$(TARGET_CFLAGS)" tools
128 endef
129 endif
130
131 define Build/Configure
132 $(SED) 's,-E[LB] ,,g' $(PKG_BUILD_DIR)/hal/public/*.inc
133 endef
134
135 define Build/Compile
136 $(call Build/Compile/ahb)
137 $(call Build/Compile/pci)
138 endef
139
140 define Build/InstallDev
141 mkdir -p $(STAGING_DIR)/usr/include/madwifi
142 $(CP) $(PKG_BUILD_DIR)/include $(STAGING_DIR)/usr/include/madwifi/
143 mkdir -p $(STAGING_DIR)/usr/include/madwifi/net80211
144 $(CP) $(PKG_BUILD_DIR)/net80211/*.h $(STAGING_DIR)/usr/include/madwifi/net80211/
145 endef
146
147 define Build/UninstallDev
148 rm -rf $(STAGING_DIR)/usr/include/madwifi
149 endef
150
151 define KernelPackage/madwifi/install
152 $(INSTALL_DIR) $(1)/lib/wifi
153 $(INSTALL_DATA) ./files/lib/wifi/madwifi.sh $(1)/lib/wifi
154 $(INSTALL_DIR) $(1)/usr/sbin
155 $(CP) $(PKG_BUILD_DIR)/tools/{madwifi_multi,80211stats,athchans,athctrl,athkey,athstats,wlanconfig} $(1)/usr/sbin/
156 endef
157
158 $(eval $(call KernelPackage,madwifi))