update madwifi to r1543
[openwrt/svn-archive/archive.git] / openwrt / target / linux / package / madwifi / Makefile
1 # $Id$
2
3 include $(TOPDIR)/rules.mk
4 include ../../rules.mk
5
6 PKG_NAME:=madwifi-ng
7 PKG_VERSION:=r1543-20060506
8 PKG_RELEASE:=1
9 PKG_MD5SUM:=3d89e5197c7e43eb37564c176140b2bf
10
11 PKG_SOURCE_URL:=http://snapshots.madwifi.org/$(PKG_NAME)
12 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
13 PKG_CAT:=zcat
14
15 PKG_BUILD_DIR:=$(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
32 ifneq ($(BR2_LINUX_2_4_AR531X),)
33 BUS := AHB
34 endif
35 ifneq ($(BR2_LINUX_2_6_ARUBA),)
36 BUS := PCI AHB # no suitable HAL for AHB yet.
37 endif
38
39 BUS_MODULES:=
40 ifeq ($(findstring AHB,$(BUS)),AHB)
41 BUS_MODULES+=$(PKG_BUILD_DIR)/ath/ath_ahb.$(LINUX_KMOD_SUFFIX)
42 endif
43 ifeq ($(findstring PCI,$(BUS)),PCI)
44 BUS_MODULES+=$(PKG_BUILD_DIR)/ath/ath_pci.$(LINUX_KMOD_SUFFIX)
45 endif
46
47
48 include $(TOPDIR)/package/rules.mk
49
50 $(eval $(call PKG_template,KMOD_MADWIFI,kmod-madwifi,$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel ($(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE))))
51
52 $(PKG_BUILD_DIR)/.configured:
53 touch $@
54
55 MADWIFI_MAKEOPTS= -C $(PKG_BUILD_DIR) \
56 PATH="$(TARGET_PATH)" \
57 ARCH="$(LINUX_KARCH)" \
58 CROSS_COMPILE="$(TARGET_CROSS)" \
59 TARGET="$(HAL_TARGET)" \
60 TOOLPREFIX="$(KERNEL_CROSS)" \
61 TOOLPATH="$(KERNEL_CROSS)" \
62 KERNELPATH="$(LINUX_DIR)" \
63 DOMULTI=1
64
65
66 $(PKG_BUILD_DIR)/.built:
67 ifeq ($(findstring AHB,$(BUS)),AHB)
68 $(MAKE) $(MADWIFI_MAKEOPTS) BUS="AHB" all
69 endif
70 ifeq ($(findstring PCI,$(BUS)),PCI)
71 $(MAKE) $(MADWIFI_MAKEOPTS) BUS="PCI" all
72 endif
73 $(RSTRIP) $(PKG_BUILD_DIR)/tools/madwifi_multi
74 touch $@
75
76 $(IPKG_KMOD_MADWIFI):
77 mkdir -p $(IDIR_KMOD_MADWIFI)/etc/modules.d
78 mkdir -p $(IDIR_KMOD_MADWIFI)/etc/init.d
79 mkdir -p $(IDIR_KMOD_MADWIFI)/lib/modules/$(LINUX_VERSION)
80 mkdir -p $(IDIR_KMOD_MADWIFI)/usr/sbin
81 install -m0644 ./files/madwifi.modules $(IDIR_KMOD_MADWIFI)/etc/modules.d/20-madwifi
82 install -m0755 ./files/madwifi.init $(IDIR_KMOD_MADWIFI)/etc/init.d/S20madwifi
83 $(CP) $(PKG_BUILD_DIR)/net80211/wlan*.$(LINUX_KMOD_SUFFIX) \
84 $(PKG_BUILD_DIR)/ath_hal/ath_hal.$(LINUX_KMOD_SUFFIX) \
85 $(BUS_MODULES) \
86 $(PKG_BUILD_DIR)/ath_rate/sample/ath_rate_sample.$(LINUX_KMOD_SUFFIX) \
87 $(PKG_BUILD_DIR)/net80211/*.$(LINUX_KMOD_SUFFIX) \
88 $(IDIR_KMOD_MADWIFI)/lib/modules/$(LINUX_VERSION)/
89 $(CP) $(PKG_BUILD_DIR)/tools/{madwifi_multi,80211debug,80211stats,athchans,athctrl,athdebug,athkey,athstats,wlanconfig} $(IDIR_KMOD_MADWIFI)/usr/sbin/
90 $(IPKG_BUILD) $(IDIR_KMOD_MADWIFI) $(PACKAGE_DIR)
91
92 $(STAGING_DIR)/usr/include/madwifi/net80211/ieee80211.h: $(PKG_BUILD_DIR)/.built
93 mkdir -p $(STAGING_DIR)/usr/include/madwifi
94 $(CP) $(PKG_BUILD_DIR)/include $(STAGING_DIR)/usr/include/madwifi/
95 mkdir -p $(STAGING_DIR)/usr/include/madwifi/net80211
96 $(CP) $(PKG_BUILD_DIR)/net80211/*.h $(STAGING_DIR)/usr/include/madwifi/net80211/
97 touch $@
98
99 install-dev: $(STAGING_DIR)/usr/include/madwifi/net80211/ieee80211.h
100
101 uninstall-dev:
102 rm -rf $(STAGING_DIR)/usr/include/madwifi
103
104 compile-targets: install-dev
105 clean-targets: uninstall-dev