summaryrefslogtreecommitdiffstats
path: root/package/rt2x00/src/Makefile
blob: dd32cf6a20071ddd1a6322b17df5ab5f0b1e6610 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#	Copyright (C) 2004 - 2007 rt2x00 SourceForge Project
#	<http://rt2x00.serialmonkey.com>
#
#	This program is free software; you can redistribute it and/or modify
#	it under the terms of the GNU General Public License as published by
#	the Free Software Foundation; either version 2 of the License, or
#	(at your option) any later version.
#
#	This program is distributed in the hope that it will be useful,
#	but WITHOUT ANY WARRANTY; without even the implied warranty of
#	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#	GNU General Public License for more details.
#
#	You should have received a copy of the GNU General Public License
#	along with this program; if not, write to the
#	Free Software Foundation, Inc.,
#	59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#	Module: Makefile
#	Abstract: Makefile for rt2x00 kernel module

#
# Set the enviroment variables.
#
ifndef SUBDIRS
	SUBDIRS=$(shell pwd)
endif

ifdef KERNDIR
	KERNEL_SOURCES := $(KERNDIR)
else
	KERNEL_SOURCES := /lib/modules/$(shell uname -r)/build
endif

ifdef KERNOUT
	KERNEL_OUTPUT := KBUILD_OUTPUT=$(KERNOUT)
else
	KERNEL_OUTPUT :=
endif

#
# Determine if and with what options the rt2x00 drivers should be build
#
rt2x00lib-objs := rt2x00dev.o rt2x00mac.o

ifeq ($(CONFIG_RT2X00),y)
	obj-m += rt2x00lib.o

ifneq ($(CONFIG_PCI),)
	obj-m += rt2x00pci.o
endif

ifneq ($(CONFIG_USB),)
	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

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__

install: config_header
	@$(MAKE) -C $(KERNEL_SOURCES) SUBDIRS=$(SUBDIRS) $(KERNEL_OUTPUT) \
		INSTALL_MOD_DIR=rt2x00 $(KERNEL_OUTPUT) modules_install
	/sbin/depmod -a

clean:
	@rm -f rt2x00_config.h
	@rm -f Modules.symvers Module.symvers
	@for folder in $(EXTMODDIRS); \
	do \
		rm -f $${folder}/*.o \
		rm -f $${folder}/*.ko \
		rm -f $${folder}/*.s \
		rm -f $${folder}/*.mod.c \
		rm -f $${folder}/.*.cmd \
		rm -f $${folder}/.*.flags \
		rm -f $${folder}/.*.o.d \
		rm -f $${folder}/.*.s.d \
		rm -f $${folder}/.#* \
		rm -f $${folder}/*~ \
		rm -fr $${folder}/.tmp_versions; \
	done