1 # Copyright (C) 2004 - 2007 rt2x00 SourceForge Project
2 # <http://rt2x00.serialmonkey.com>
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the
16 # Free Software Foundation, Inc.,
17 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 # Abstract: Makefile for rt2x00 kernel module
23 # Set the enviroment variables.
30 KERNEL_SOURCES := $(KERNDIR)
32 KERNEL_SOURCES := /lib/modules/$(shell uname -r)/build
36 KERNEL_OUTPUT := KBUILD_OUTPUT=$(KERNOUT)
42 # Include kernel and rt2x00 config.
44 include $(KERNEL_SOURCES)/.config
45 include $(SUBDIRS)/config
48 # Determine if and with what options the rt2x00 drivers should be build
50 rt2x00lib-objs := rt2x00dev.o rt2x00mac.o
52 ifeq ($(CONFIG_RT2X00),y)
54 ifeq ($(CONFIG_RT2X00_LIB_DEBUGFS),y)
55 rt2x00lib-objs += rt2x00debug.o
58 ifeq ($(CONFIG_RT2400PCI),y)
59 obj-m += rt2400pci.o rt2x00pci.o rt2x00lib.o
60 ifeq ($(CONFIG_RT2400PCI_RFKILL),y)
61 rt2x00lib-objs += rt2x00rfkill.o
62 CFLAGS += -DCONFIG_RT2X00_LIB_RFKILL
66 ifeq ($(CONFIG_RT2500PCI),y)
67 obj-m += rt2500pci.o rt2x00pci.o rt2x00lib.o
68 ifeq ($(CONFIG_RT2500PCI_RFKILL),y)
69 rt2x00lib-objs += rt2x00rfkill.o
70 CFLAGS += -DCONFIG_RT2X00_LIB_RFKILL
74 ifeq ($(CONFIG_RT2500USB),y)
75 obj-m += rt2500usb.o rt2x00usb.o rt2x00lib.o
78 ifeq ($(CONFIG_RT61PCI),y)
79 CFLAGS += -DCONFIG_RT2X00_LIB_FIRMWARE
80 rt2x00lib-objs += rt2x00firmware.o
81 obj-m += rt61pci.o rt2x00pci.o rt2x00lib.o
82 ifeq ($(CONFIG_RT61PCI_RFKILL),y)
83 rt2x00lib-objs += rt2x00rfkill.o
84 CFLAGS += -DCONFIG_RT2X00_LIB_RFKILL
88 ifeq ($(CONFIG_RT73USB),y)
89 CFLAGS += -DCONFIG_RT2X00_LIB_FIRMWARE
90 rt2x00lib-objs += rt2x00firmware.o
91 obj-m += rt73usb.o rt2x00usb.o rt2x00lib.o
96 MAKEFLAGS += --no-print-directory
97 CFLAGS := -include $(SUBDIRS)/rt2x00_compat.h $(CFLAGS)
102 @if [ ! -f "rt2x00_config.h" ] || [ "rt2x00_config.h" -ot "config" ]; \
104 awk -F = > rt2x00_config.h < config '/^CONFIG.*$\/ \
107 print "#ifndef " $$1; \
108 print "#define " $$1; \
112 print "#undef " $$1; \
118 default: config_header
119 @$(MAKE) -C $(KERNEL_SOURCES) SUBDIRS=$(SUBDIRS) $(KERNEL_OUTPUT) \
122 sparse: config_header
123 @$(MAKE) -C $(KERNEL_SOURCES) SUBDIRS=$(SUBDIRS) $(KERNEL_OUTPUT) \
124 modules C=1 CF=-D__CHECK_ENDIAN__
126 install: config_header
127 @$(MAKE) -C $(KERNEL_SOURCES) SUBDIRS=$(SUBDIRS) $(KERNEL_OUTPUT) \
128 INSTALL_MOD_DIR=rt2x00 $(KERNEL_OUTPUT) modules_install
132 @rm -f rt2x00_config.h
133 @rm -f Modules.symvers Module.symvers
134 @for folder in $(EXTMODDIRS); \
136 rm -f $${folder}/*.o \
137 rm -f $${folder}/*.ko \
138 rm -f $${folder}/*.s \
139 rm -f $${folder}/*.mod.c \
140 rm -f $${folder}/.*.cmd \
141 rm -f $${folder}/.*.flags \
142 rm -f $${folder}/.*.o.d \
143 rm -f $${folder}/.*.s.d \
144 rm -f $${folder}/.#* \
145 rm -f $${folder}/*~ \
146 rm -fr $${folder}/.tmp_versions; \