kernel package cleanup, move madwifi from target/linux/package/ to package/, update...
[openwrt/svn-archive/archive.git] / openwrt / package / madwifi / Makefile
1 # $Id$
2
3 include $(TOPDIR)/rules.mk
4 include $(TOPDIR)/package/kernel.mk
5
6 PKG_NAME:=madwifi
7 PKG_VERSION:=0.9.0
8 PKG_RELEASE:=1
9 PKG_MD5SUM:=9b558d1df84cab2b0006c595feee0fba
10
11 PKG_SOURCE_URL:=@SF/$(PKG_NAME)
12 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
13 PKG_CAT:=bzcat
14
15 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
16
17 ifeq ($(ARCH),mips)
18 HAL_TARGET:=mips-be-elf
19 endif
20 ifeq ($(ARCH),mipsel)
21 HAL_TARGET:=mips-le-elf
22 endif
23 ifeq ($(ARCH),i386)
24 HAL_TARGET:=i386-elf
25 endif
26 ifeq ($(ARCH),armeb)
27 HAL_TARGET:=xscale-be-elf
28 endif
29
30 BUS := PCI
31 ifneq ($(CONFIG_LINUX_2_4_AR531X),)
32 BUS := AHB
33 endif
34 ifneq ($(CONFIG_LINUX_2_6_ARUBA),)
35 BUS := PCI AHB # no suitable HAL for AHB yet.
36 endif
37
38 BUS_MODULES:=
39 ifeq ($(findstring AHB,$(BUS)),AHB)
40 BUS_MODULES+=$(PKG_BUILD_DIR)/ath/ath_ahb.$(LINUX_KMOD_SUFFIX)
41 endif
42 ifeq ($(findstring PCI,$(BUS)),PCI)
43 BUS_MODULES+=$(PKG_BUILD_DIR)/ath/ath_pci.$(LINUX_KMOD_SUFFIX)
44 endif
45
46 MADWIFI_MAKEOPTS= -C $(PKG_BUILD_DIR) \
47 PATH="$(TARGET_PATH)" \
48 ARCH="$(LINUX_KARCH)" \
49 CROSS_COMPILE="$(TARGET_CROSS)" \
50 TARGET="$(HAL_TARGET)" \
51 TOOLPREFIX="$(KERNEL_CROSS)" \
52 TOOLPATH="$(KERNEL_CROSS)" \
53 KERNELPATH="$(LINUX_DIR)" \
54 DOMULTI=1
55
56 include $(TOPDIR)/package/rules.mk
57
58 ifeq ($(findstring AHB,$(BUS)),AHB)
59 define Build/Compile/ahb
60 $(MAKE) $(MADWIFI_MAKEOPTS) BUS="AHB" all
61 endef
62 endif
63
64 ifeq ($(findstring PCI,$(BUS)),PCI)
65 define Build/Compile/pci
66 $(MAKE) $(MADWIFI_MAKEOPTS) BUS="PCI" all
67 endef
68 endif
69
70 define Build/Compile
71 $(call Build/Compile/ahb)
72 $(call Build/Compile/pci)
73 endef
74
75 define Build/InstallDev
76 mkdir -p $(STAGING_DIR)/usr/include/madwifi
77 $(CP) $(PKG_BUILD_DIR)/include $(STAGING_DIR)/usr/include/madwifi/
78 mkdir -p $(STAGING_DIR)/usr/include/madwifi/net80211
79 $(CP) $(PKG_BUILD_DIR)/net80211/*.h $(STAGING_DIR)/usr/include/madwifi/net80211/
80 endef
81
82 define Build/UninstallDev
83 rm -rf $(STAGING_DIR)/usr/include/madwifi
84 endef
85
86 define Package/kmod-madwifi
87 SECTION:=drivers
88 CATEGORY:=Drivers
89 DEFAULT:=y if LINUX_2_6_BRCM || LINUX_2_6_ARUBA || LINUX_2_4_AR531X || LINUX_2_6_XSCALE, m if ALL
90 TITLE:=Driver for Atheros wireless chipsets
91 DESCRIPTION:=Driver for Atheros 802.11a/b/g chipsets
92 URL:=http://madwifi.org/
93 endef
94
95 define Package/kmod-madwifi/install
96 mkdir -p $(1)/etc/modules.d
97 mkdir -p $(1)/etc/init.d
98 mkdir -p $(1)/lib/modules/$(LINUX_VERSION)
99 mkdir -p $(1)/usr/sbin
100 install -m0644 ./files/madwifi.modules $(1)/etc/modules.d/20-madwifi
101 ifeq ($(findstring AHB,$(BUS)),AHB)
102 echo ath_ahb >> $(1)/etc/modules.d/20-madwifi
103 endif
104 ifeq ($(findstring PCI,$(BUS)),PCI)
105 echo ath_pci >> $(1)/etc/modules.d/20-madwifi
106 endif
107 install -m0755 ./files/madwifi.init $(1)/etc/init.d/S20madwifi
108 $(CP) \
109 $(PKG_BUILD_DIR)/ath_hal/ath_hal.$(LINUX_KMOD_SUFFIX) \
110 $(BUS_MODULES) \
111 $(PKG_BUILD_DIR)/ath_rate/sample/ath_rate_sample.$(LINUX_KMOD_SUFFIX) \
112 $(PKG_BUILD_DIR)/net80211/*.$(LINUX_KMOD_SUFFIX) \
113 $(1)/lib/modules/$(LINUX_VERSION)/
114 $(CP) $(PKG_BUILD_DIR)/tools/{madwifi_multi,80211debug,80211stats,athchans,athctrl,athdebug,athkey,athstats,wlanconfig} $(1)/usr/sbin/
115 endef
116
117 $(eval $(call BuildPackage,kmod-madwifi))