broadcom-wl: fix compiling with kernel 2.6.35
[openwrt/svn-archive/archive.git] / package / broadcom-wl / Makefile
1 #
2 # Copyright (C) 2006-2010 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/kernel.mk
10
11 PKG_NAME:=broadcom-wl
12 PKG_VERSION:=5.10.56.27.1
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(ARCH).tar.bz2
16 PKG_SOURCE_URL:=http://downloads.openwrt.org/sources
17
18 PKG_MD5SUM.mipsel:=9f42cfa9c46ee1b0e04dc2d3ab9bc8cd
19 PKG_MD5SUM.mips:=9dcc902af0fcac5f34b6656982e82c21
20 PKG_MD5SUM:=$(PKG_MD5SUM.$(ARCH))
21
22 include $(INCLUDE_DIR)/package.mk
23
24 define Package/broadcom-wl/Default
25 SECTION:=kernel
26 CATEGORY:=Kernel modules
27 DEPENDS:=@PACKAGE_kmod-brcm-wl||PACKAGE_kmod-brcm-wl-mini
28 SUBMENU:=Proprietary BCM43xx WiFi driver
29 SUBMENUDEP:=@TARGET_brcm47xx||TARGET_brcm63xx
30 endef
31
32 define KernelPackage/brcm-wl/Default
33 $(call Package/broadcom-wl/Default)
34 SECTION:=kernel
35 DEPENDS:=@TARGET_brcm47xx||TARGET_brcm63xx +wireless-tools
36 TITLE:=Kernel driver for BCM43xx chipsets
37 FILES:=$(PKG_BUILD_DIR)/driver$(1)/wl.$(LINUX_KMOD_SUFFIX)
38 AUTOLOAD:=$(call AutoLoad,30,wl)
39 endef
40
41 define KernelPackage/brcm-wl/Default/description
42 This package contains the proprietary wireless driver for the Broadcom
43 BCM43xx chipset.
44 endef
45
46 define KernelPackage/brcm-wl
47 $(call KernelPackage/brcm-wl/Default,)
48 TITLE+= (normal version)
49 endef
50
51 define KernelPackage/brcm-wl/description
52 $(call KernelPackage/brcm-wl/Default/description)
53 endef
54
55 define KernelPackage/brcm-wl-mini
56 $(call KernelPackage/brcm-wl/Default,-mini)
57 TITLE+= (Legacy version)
58 endef
59
60 define KernelPackage/brcm-wl-mini/description
61 $(call KernelPackage/brcm-wl/Default/description)
62 endef
63
64 define Package/wlc
65 $(call Package/broadcom-wl/Default)
66 TITLE:=wl driver setup utility
67 endef
68
69 define Package/wlc/description
70 This package contains an utility for initializing the proprietary Broadcom
71 wl driver.
72 endef
73
74 define Package/wl
75 $(call Package/broadcom-wl/Default)
76 TITLE:=Proprietary Broadcom wl driver config utility
77 endef
78
79 define Package/wl/description
80 This package contains the proprietary utility (wl) for configuring the
81 proprietary Broadcom wl driver.
82 endef
83
84 define Package/nas
85 $(call Package/broadcom-wl/Default)
86 TITLE:=Proprietary Broadcom WPA/WPA2 authenticator
87 endef
88
89 define Package/nas/description
90 This package contains the proprietary WPA/WPA2 authenticator (nas) for the
91 proprietary Broadcom wl driver.
92 endef
93
94 MAKE_KMOD := $(MAKE) -C "$(LINUX_DIR)" \
95 CROSS_COMPILE="$(TARGET_CROSS)" \
96 ARCH="$(LINUX_KARCH)" \
97 PATH="$(TARGET_PATH)" \
98 SUBDIRS="$(PKG_BUILD_DIR)/kmod" \
99
100 define Build/Prepare
101 $(call Build/Prepare/Default)
102 $(CP) $(PKG_BUILD_DIR)/driver $(PKG_BUILD_DIR)/driver-mini
103 endef
104
105 define Build/Compile
106 # Compile the kernel part
107 $(MAKE_KMOD) \
108 SUBDIRS="$(PKG_BUILD_DIR)/driver" \
109 MODFLAGS="-DMODULE -mlong-calls" \
110 modules
111
112 $(MAKE_KMOD) \
113 SUBDIRS="$(PKG_BUILD_DIR)/driver-mini" \
114 MODFLAGS="-DMODULE -mlong-calls" \
115 BUILD_TYPE="wl_apsta_mini" \
116 modules
117
118 # Compile libshared
119 $(MAKE) -C $(PKG_BUILD_DIR)/shared \
120 $(TARGET_CONFIGURE_OPTS) \
121 CFLAGS="$(TARGET_CFLAGS) -I. -I$(PKG_BUILD_DIR)/driver/include" \
122 all
123
124 $(TARGET_CC) -o $(PKG_BUILD_DIR)/wlc \
125 -I$(PKG_BUILD_DIR)/shared -I$(PKG_BUILD_DIR)/driver/include \
126 ./src/wlc.c $(PKG_BUILD_DIR)/shared/libshared.a
127
128 $(TARGET_CC) -o $(PKG_BUILD_DIR)/nas \
129 $(PKG_BUILD_DIR)/nas_exe.o \
130 $(PKG_BUILD_DIR)/shared/libshared.a
131
132 $(TARGET_CC) -o $(PKG_BUILD_DIR)/wl \
133 $(PKG_BUILD_DIR)/wl_exe.o \
134 $(PKG_BUILD_DIR)/shared/libshared.a
135 endef
136
137 define Build/InstallDev
138 $(INSTALL_DIR) $(1)/usr/lib
139 $(CP) $(PKG_BUILD_DIR)/shared/libshared.a $(1)/usr/lib/
140 endef
141
142 define Package/wlc/install
143 $(CP) ./files/* $(1)/
144 $(INSTALL_DIR) $(1)/sbin
145 $(INSTALL_BIN) $(PKG_BUILD_DIR)/wlc $(1)/sbin/
146 endef
147
148 define Package/wlc/postinst
149 #!/bin/sh
150 [ -n "$${IPKG_INSTROOT}" ] || /etc/init.d/wlunbind enable || true
151 endef
152
153 define Package/wl/install
154 $(INSTALL_DIR) $(1)/usr/sbin
155 $(INSTALL_BIN) $(PKG_BUILD_DIR)/wl $(1)/usr/sbin/
156 endef
157
158 define Package/nas/install
159 $(INSTALL_DIR) $(1)/usr/sbin
160 $(INSTALL_BIN) $(PKG_BUILD_DIR)/nas $(1)/usr/sbin/
161 ln -sf nas $(1)/usr/sbin/nas4not
162 ln -sf nas $(1)/usr/sbin/nas4wds
163 endef
164
165 $(eval $(call KernelPackage,brcm-wl))
166 $(eval $(call KernelPackage,brcm-wl-mini))
167 $(eval $(call BuildPackage,wlc))
168 $(eval $(call BuildPackage,wl))
169 $(eval $(call BuildPackage,nas))