~asac/intellinuxwireless/ipw2200.upstream

« back to all changes in this revision

Viewing changes to Makefile

  • Committer: Alexander Sack
  • Date: 2007-09-12 14:51:51 UTC
  • Revision ID: asac@jwsdot.com-20070912145151-r6ll6icpjia3fjty
upstream 1.2.1 release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# Makefile for the Linux Wireless network device drivers.
 
3
#
 
4
# Original makefile by Peter Johanson
 
5
#
 
6
# NOTE: This make file can serve as both an external Makefile (launched
 
7
#       directly by the user), or as the sub-dir Makefile used by the kernel
 
8
#       build system.
 
9
 
 
10
# If CONFIG_IPW* isn't set, we'll assume the user has never configured
 
11
# their kernel to include this module and set up some defaults.
 
12
#
 
13
# NOTE: If you have previously added the IPW project to your kernel 
 
14
#       and configured it for inclusion, these settings will be 
 
15
#       overridden by your kernel configuration.
 
16
ifndef CONFIG_IPW2200
 
17
EXTERNAL_BUILD=y
 
18
CONFIG_IPW2200=m
 
19
CONFIG_IPW2200_DEBUG=y
 
20
CONFIG_IPW2200_QOS=y
 
21
 
 
22
# If you are not interested in using monitor mode, simply comment out:
 
23
#
 
24
# NOTE:  If you have problems compiling due to IW_MODE_MONITOR not being
 
25
#        defined then you need to update the wireless extension version
 
26
#        installed in your kernel, or comment this line out.
 
27
CONFIG_IPW2200_MONITOR=y
 
28
 
 
29
# If you are interested in using radiotap headers in monitor mode,
 
30
# simply uncomment:
 
31
#
 
32
# NOTE:  To use RADIOTAP you must also enable MONITOR above.
 
33
#CONFIG_IPW2200_RADIOTAP=y
 
34
 
 
35
# The above monitor mode provides standard monitor mode.  The following
 
36
# will create a new interface (named rtap%d) which will be sent all
 
37
# 802.11 frames received on the interface
 
38
#
 
39
# NOTE:  To use PROMISCUOUS you must also enable MONITOR above.
 
40
#CONFIG_IPW2200_PROMISCUOUS=y
 
41
 
 
42
endif
 
43
 
 
44
# We have to add drivers/net/wireless until ieee802_11.h is in the default
 
45
# include path
 
46
EXTRA_CFLAGS += -I$(TOPDIR)/drivers/net/wireless 
 
47
 
 
48
ifeq ($(IEEE80211_INC),)
 
49
        IEEE80211_INC := /lib/modules/$(shell uname -r)/include
 
50
        IEEE80211_MODVERDIR=/lib/modules/$(KVER)/net/ieee80211/.tmp_versions
 
51
else
 
52
        IEEE80211_MODVERDIR=$(IEEE80211_INC)/.tmp_versions
 
53
endif
 
54
EXTRA_CFLAGS += -I$(IEEE80211_INC)
 
55
 
 
56
ifeq ($(CONFIG_IPW2200_DEBUG),y)
 
57
        EXTRA_CFLAGS += -g -Wa,-adhlms=$@.lst
 
58
endif
 
59
 
 
60
ifdef KBUILD_EXTMOD
 
61
        EXTRA_CFLAGS += -I$(KBUILD_EXTMOD) -DKBUILD_EXTMOD
 
62
endif
 
63
 
 
64
list-m :=
 
65
list-$(CONFIG_IPW2200) += ipw2200
 
66
obj-$(CONFIG_IPW2200) += ipw2200.o
 
67
 
 
68
#
 
69
# Begin dual Makefile mode here.  First we provide support for when we
 
70
# are being invoked by the kernel build system
 
71
#
 
72
ifneq ($(KERNELRELEASE),)
 
73
 
 
74
#
 
75
# If you receive a compile message about multiple definitions of
 
76
# CONFIG_IPW2200_DEBUG, then you have IPW* into the full kernel build, and 
 
77
# these definitions are now being set up by the kernel build system.  
 
78
#
 
79
#
 
80
# To correct this, remove any CONFIG_{IPW,IEEE80211}* lines from 
 
81
# $(KSRC)/.config and $(KSRC)/include/linux/autoconf.h
 
82
 
83
 
 
84
EXTRA_CFLAGS += -DCONFIG_PM
 
85
 
 
86
ifeq ($(EXTERNAL_BUILD),y)
 
87
ifeq ($(CONFIG_IPW2200_DEBUG),y)
 
88
EXTRA_CFLAGS += -DCONFIG_IPW2200_DEBUG
 
89
endif
 
90
ifeq ($(CONFIG_IPW2200_MONITOR),y)
 
91
EXTRA_CFLAGS += -DCONFIG_IPW2200_MONITOR
 
92
ifeq ($(CONFIG_IPW2200_RADIOTAP),y)
 
93
EXTRA_CFLAGS += -DCONFIG_IPW2200_RADIOTAP
 
94
endif
 
95
ifeq ($(CONFIG_IPW2200_PROMISCUOUS),y)
 
96
EXTRA_CFLAGS += -DCONFIG_IPW2200_PROMISCUOUS
 
97
endif
 
98
endif
 
99
ifeq ($(CONFIG_IPW2200_QOS),y)
 
100
EXTRA_CFLAGS += -DCONFIG_IPW2200_QOS
 
101
endif
 
102
endif
 
103
 
 
104
else 
 
105
# Here we begin the portion that is executed if the user invoked this Makefile
 
106
# directly.
 
107
 
 
108
# KSRC should be set to the path to your sources
 
109
# modules are installed into KMISC
 
110
KVER  := $(shell uname -r)
 
111
KSRC := /lib/modules/$(KVER)/build
 
112
KMISC := /lib/modules/$(KVER)/kernel/drivers/net/wireless/
 
113
KMISC_INC := /lib/modules/$(KVER)/include
 
114
 
 
115
# KSRC_OUTPUT should be overridden if you are using a 2.6 kernel that
 
116
# has it's output sent elsewhere via KBUILD_OUTPUT= or O=
 
117
KSRC_OUTPUT := $(KSRC)
 
118
 
 
119
PWD=$(shell pwd)
 
120
 
 
121
VERFILE := $(KSRC_OUTPUT)/include/linux/version.h
 
122
KERNELRELEASE := $(shell \
 
123
        if [ -r $(VERFILE) ]; then \
 
124
                (cat $(VERFILE); echo UTS_RELEASE) | \
 
125
                $(CC) -I$(KSRC_OUTPUT) $(CFLAGS) -E - | \
 
126
                tail -n 1 | \
 
127
                xargs echo; \
 
128
        else \
 
129
                uname -r; \
 
130
        fi)
 
131
 
 
132
MODPATH := $(DESTDIR)/lib/modules/$(KERNELRELEASE)
 
133
 
 
134
all: check_inc modules
 
135
 
 
136
check_inc:
 
137
        @([ ! -e $(IEEE80211_INC)/net/ieee80211.h ] && \
 
138
        echo -e \
 
139
"\n ERROR: ieee80211.h not found in '$(IEEE80211_INC)'.\n\n"\
 
140
"You need to install the ieee80211 subsystem from http://ieee80211.sf.net\n"\
 
141
"and point this build to the location where you installed those sources, eg.:\n\n"\
 
142
"% make IEEE80211_INC=/usr/src/ieee80211/\n\n"\
 
143
"will look for ieee80211.h in /usr/src/ieee80211/net/\n") || exit 0
 
144
        @[ -e $(IEEE80211_INC)/net/ieee80211.h ]
 
145
 
 
146
clean:
 
147
        rm -f *.mod.c *.mod *.o *.ko .*.cmd .*.flags .lst *.lst
 
148
        rm -rf $(PWD)/tmp Modules.symvers Module.symvers
 
149
        for file in *.{c,h}; do \
 
150
                sed -i -e "s:\ *$$::g" -e "s:\t*$$::g" $$file; \
 
151
        done
 
152
 
 
153
distclean: clean
 
154
        rm -f tags TAGS
 
155
 
 
156
TMP=$(PWD)/tmp
 
157
MODVERDIR=$(TMP)/.tmp_versions
 
158
 
 
159
modules:
 
160
        mkdir -p $(MODVERDIR)
 
161
        -@([ -f $(IEEE80211_MODVERDIR)/../Module.symvers ] && \
 
162
            cp $(IEEE80211_MODVERDIR)/../Module.symvers $(PWD)) || \
 
163
          ([ -f $(IEEE80211_MODVERDIR)/../Modules.symvers ] && \
 
164
            cp $(IEEE80211_MODVERDIR)/../Modules.symvers $(PWD)) || \
 
165
          ([ -f $(IEEE80211_MODVERDIR)/ieee80211.mod ] && \
 
166
            cp $(IEEE80211_MODVERDIR)/*.mod $(MODVERDIR)) || true
 
167
        $(MAKE) -C $(KSRC) M=$(PWD) MODVERDIR=$(MODVERDIR) modules
 
168
 
 
169
 
 
170
patch_kernel:
 
171
        @echo -e \
 
172
"\n This will install this IPW2200 driver into your\n"\
 
173
" kernel tree located here:\n"\
 
174
"\n${KSRC}\n\n"\
 
175
" If you would like to instal to a different location, run\n"\
 
176
" this as follows: make KSRC=/path/to/kernel patch_kernel \n"
 
177
        @(read -p "Do you wish to continue? [Yn] " reply; \
 
178
        case $$reply in \
 
179
                Y|y|"") exit 0 ;; \
 
180
                *) echo "Terminating patch prcoess." ; exit 1 ;; \
 
181
        esac)
 
182
        @if [ "$(shell whoami)" != "root" ]; then \
 
183
            echo -e \
 
184
"\nIf this fails, you may need to be root to patch the kernel.\n" ; \
 
185
        fi
 
186
        @(grep -q "ipw2200" ${KSRC}/drivers/net/wireless/Makefile || \
 
187
                echo \
 
188
"obj-\$$(CONFIG_IPW2200)         += ipw2200.o" >> \
 
189
                ${KSRC}/drivers/net/wireless/Makefile)
 
190
        @cp README.ipw2200 ${KSRC}/Documentation/networking
 
191
        @cp ipw2200.{c,h} ${KSRC}/drivers/net/wireless
 
192
        @cp compat.{c,h} ${KSRC}/drivers/net/wireless
 
193
        @cp in-tree/Kconfig.ipw2200 ${KSRC}/drivers/net/wireless
 
194
        @(grep -q "Kconfig\.ipw2200" ${KSRC}/drivers/net/wireless/Kconfig || \
 
195
        grep -q "IPW2200" ${KSRC}/drivers/net/wireless/Kconfig || \
 
196
                sed -i -e "s:^endmenu:source \"drivers/net/wireless/Kconfig.ipw2200\"\n\nendmenu:g" ${KSRC}/drivers/net/wireless/Kconfig)
 
197
        @echo -e "Kernel has been udpated to include this ipw2200 driver.\n"
 
198
 
 
199
install: modules
 
200
        install -d $(KMISC)
 
201
        install -m 644 -c $(addsuffix .ko,$(list-m)) $(KMISC)
 
202
        /sbin/depmod -a ${KVER}
 
203
        @echo "Don't forget to copy firmware to your hotplug's firmware directory and have the "
 
204
        @echo "hotplug tools in place."
 
205
        @echo "See INSTALL for more information."
 
206
 
 
207
uninstall:
 
208
        rm -rf $(addprefix $(KMISC),$(addsuffix .ko,$(list-m)))
 
209
        /sbin/depmod -a ${KVER}
 
210
 
 
211
endif # End of internal build
 
212
 
 
213
 
 
214
.PHONY: TAGS tags check_inc
 
215
 
 
216
RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS \) -prune -o
 
217
define all-sources
 
218
        ( find . $(RCS_FIND_IGNORE) -name '*.[chS]' -print )
 
219
endef
 
220
 
 
221
TAGS:
 
222
        $(all-sources) | etags -
 
223
tags:
 
224
        rm -f $@
 
225
        CTAGSF=`ctags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_NOVERS"`; \
 
226
        $(all-sources) | xargs ctags $$CTAGSF -a
 
227