init script cleanup, use /etc/rc.d/ for enabled scripts, /etc/init.d/<pkgname> (enabl...
[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:=0.9.2
14 PKG_RELEASE:=1
15
16 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
17 PKG_SOURCE_URL:=@SF/$(PKG_NAME)
18 PKG_MD5SUM:=a75baacbe07085ddc5cb28e1fb43edbb
19 PKG_CAT:=bzcat
20
21 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
22
23 include $(INCLUDE_DIR)/package.mk
24
25 define Package/kmod-madwifi
26 SECTION:=kernel
27 CATEGORY:=Kernel drivers
28 DEFAULT:=y if LINUX_2_6_BRCM || LINUX_2_6_ARUBA || LINUX_2_4_AR531X || LINUX_2_6_XSCALE, m if ALL
29 TITLE:=Driver for Atheros wireless chipsets
30 DESCRIPTION:=\
31 This package contains a driver for Atheros 802.11a/b/g chipsets.
32 URL:=http://madwifi.org/
33 VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE)
34 endef
35
36 RATE_CONTROL:=sample
37
38 ifeq ($(ARCH),mips)
39 HAL_TARGET:=mips-be-elf
40 endif
41 ifeq ($(ARCH),mipsel)
42 HAL_TARGET:=mips-le-elf
43 endif
44 ifeq ($(ARCH),i386)
45 HAL_TARGET:=i386-elf
46 endif
47 ifeq ($(ARCH),armeb)
48 HAL_TARGET:=xscale-be-elf
49 endif
50 ifeq ($(ARCH),powerpc)
51 HAL_TARGET:=powerpc-be-elf
52 endif
53
54 BUS:=PCI
55 ifneq ($(CONFIG_LINUX_2_4_AR531X),)
56 BUS:=AHB
57 endif
58 ifneq ($(CONFIG_LINUX_2_6_ARUBA),)
59 BUS:=PCI AHB # no suitable HAL for AHB yet.
60 endif
61
62 BUS_MODULES:=
63 ifeq ($(findstring AHB,$(BUS)),AHB)
64 BUS_MODULES+=$(PKG_BUILD_DIR)/ath/ath_ahb.$(LINUX_KMOD_SUFFIX)
65 endif
66 ifeq ($(findstring PCI,$(BUS)),PCI)
67 BUS_MODULES+=$(PKG_BUILD_DIR)/ath/ath_pci.$(LINUX_KMOD_SUFFIX)
68 endif
69
70 MADWIFI_MAKEOPTS= -C $(PKG_BUILD_DIR) \
71 PATH="$(TARGET_PATH)" \
72 ARCH="$(LINUX_KARCH)" \
73 CROSS_COMPILE="$(TARGET_CROSS)" \
74 TARGET="$(HAL_TARGET)" \
75 TOOLPREFIX="$(KERNEL_CROSS)" \
76 TOOLPATH="$(KERNEL_CROSS)" \
77 KERNELPATH="$(LINUX_DIR)" \
78 LDOPTS=" " \
79 ATH_RATE="ath_rate/$(RATE_CONTROL)" \
80 DOMULTI=1
81
82 ifeq ($(findstring AHB,$(BUS)),AHB)
83 define Build/Compile/ahb
84 $(MAKE) $(MADWIFI_MAKEOPTS) BUS="AHB" all
85 endef
86 endif
87
88 ifeq ($(findstring PCI,$(BUS)),PCI)
89 define Build/Compile/pci
90 $(MAKE) $(MADWIFI_MAKEOPTS) BUS="PCI" all
91 endef
92 endif
93
94 define Build/Compile
95 $(call Build/Compile/ahb)
96 $(call Build/Compile/pci)
97 endef
98
99 define Build/InstallDev
100 mkdir -p $(STAGING_DIR)/usr/include/madwifi
101 $(CP) $(PKG_BUILD_DIR)/include $(STAGING_DIR)/usr/include/madwifi/
102 mkdir -p $(STAGING_DIR)/usr/include/madwifi/net80211
103 $(CP) $(PKG_BUILD_DIR)/net80211/*.h $(STAGING_DIR)/usr/include/madwifi/net80211/
104 endef
105
106 define Build/UninstallDev
107 rm -rf $(STAGING_DIR)/usr/include/madwifi
108 endef
109
110 define Package/kmod-madwifi/install
111 mkdir -p $(1)/etc/modules.d
112 mkdir -p $(1)/etc/init.d
113 mkdir -p $(1)/lib/modules/$(LINUX_VERSION)
114 mkdir -p $(1)/usr/sbin
115 install -m0644 ./files/madwifi.modules $(1)/etc/modules.d/20-madwifi
116 echo ath_rate_$(RATE_CONTROL) >> $(1)/etc/modules.d/20-madwifi
117 ifeq ($(findstring AHB,$(BUS)),AHB)
118 echo ath_ahb >> $(1)/etc/modules.d/20-madwifi
119 endif
120 ifeq ($(findstring PCI,$(BUS)),PCI)
121 echo ath_pci >> $(1)/etc/modules.d/20-madwifi
122 endif
123 install -m0755 ./files/madwifi.init $(1)/etc/init.d/madwifi
124 $(CP) \
125 $(PKG_BUILD_DIR)/ath/ath_hal.$(LINUX_KMOD_SUFFIX) \
126 $(BUS_MODULES) \
127 $(PKG_BUILD_DIR)/ath_rate/$(RATE_CONTROL)/ath_rate_$(RATE_CONTROL).$(LINUX_KMOD_SUFFIX) \
128 $(PKG_BUILD_DIR)/net80211/wlan*.$(LINUX_KMOD_SUFFIX) \
129 $(1)/lib/modules/$(LINUX_VERSION)/
130 $(CP) $(PKG_BUILD_DIR)/tools/{madwifi_multi,80211debug,80211stats,athchans,athctrl,athdebug,athkey,athstats,wlanconfig} $(1)/usr/sbin/
131 endef
132
133 $(eval $(call BuildPackage,kmod-madwifi))