+ifeq ($(CONFIG_RT2X00),y)
+ obj-m += rt2x00lib.o
+
+ifeq ($(CONFIG_RT2X00PCI),y)
+ obj-m += rt2x00pci.o
+endif
+
+ifeq ($(CONFIG_RT2X00USB),y)
+ obj-m += rt2x00usb.o
+endif
+
+ifeq ($(CONFIG_RT2X00_LIB_DEBUGFS),y)
+ rt2x00lib-objs += rt2x00debug.o
+endif
+
+ifeq ($(CONFIG_RT2400PCI),y)
+ obj-m += rt2400pci.o
+ifeq ($(CONFIG_RT2400PCI_RFKILL),y)
+ rt2x00lib-objs += rt2x00rfkill.o
+ CFLAGS += -DCONFIG_RT2X00_LIB_RFKILL
+endif
+endif
+
+ifeq ($(CONFIG_RT2500PCI),y)
+ obj-m += rt2500pci.o
+ifeq ($(CONFIG_RT2500PCI_RFKILL),y)
+ rt2x00lib-objs += rt2x00rfkill.o
+ CFLAGS += -DCONFIG_RT2X00_LIB_RFKILL
+endif
+endif
+
+ifeq ($(CONFIG_RT2500USB),y)
+ obj-m += rt2500usb.o
+endif
+
+ifeq ($(CONFIG_RT61PCI),y)
+ CFLAGS += -DCONFIG_RT2X00_LIB_FIRMWARE
+ rt2x00lib-objs += rt2x00firmware.o
+ obj-m += rt61pci.o
+ifeq ($(CONFIG_RT61PCI_RFKILL),y)
+ rt2x00lib-objs += rt2x00rfkill.o
+ CFLAGS += -DCONFIG_RT2X00_LIB_RFKILL
+endif
+endif
+
+ifeq ($(CONFIG_RT73USB),y)
+ CFLAGS += -DCONFIG_RT2X00_LIB_FIRMWARE
+ rt2x00lib-objs += rt2x00firmware.o
+ obj-m += rt73usb.o
+endif
+
+endif
+
+MAKEFLAGS += --no-print-directory
+CFLAGS := -include $(SUBDIRS)/rt2x00_compat.h $(CFLAGS)
+
+all: default
+
+config_header:
+ @if [ ! -f "rt2x00_config.h" ] || [ "rt2x00_config.h" -ot "config" ]; \
+ then \
+ awk -F = > rt2x00_config.h < config '/^CONFIG.*$\/ \
+ { \
+ if($$2 == "y") { \
+ print "#ifndef " $$1; \
+ print "#define " $$1; \
+ print "#endif"; \
+ print "" \
+ } else { \
+ print "#undef " $$1; \
+ print ""; \
+ } \
+ }'; \
+ fi
+
+default: config_header
+ @$(MAKE) -C $(KERNEL_SOURCES) SUBDIRS=$(SUBDIRS) $(KERNEL_OUTPUT) \
+ modules
+
+sparse: config_header
+ @$(MAKE) -C $(KERNEL_SOURCES) SUBDIRS=$(SUBDIRS) $(KERNEL_OUTPUT) \
+ modules C=1 CF=-D__CHECK_ENDIAN__