Use netdev_notifier_info_to_dev(), needed for Linux 3.11+
[madwifi/.git] / Makefile
1 #
2 # Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
3 # All rights reserved.
4 #
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
7 # are met:
8 # 1. Redistributions of source code must retain the above copyright
9 #    notice, this list of conditions and the following disclaimer,
10 #    without modification.
11 # 2. Redistributions in binary form must reproduce at minimum a disclaimer
12 #    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
13 #    redistribution must be conditioned upon including a substantially
14 #    similar Disclaimer requirement for further binary redistribution.
15 # 3. Neither the names of the above-listed copyright holders nor the names
16 #    of any contributors may be used to endorse or promote products derived
17 #    from this software without specific prior written permission.
18 #
19 # Alternatively, this software may be distributed under the terms of the
20 # GNU General Public License ("GPL") version 2 as published by the Free
21 # Software Foundation.
22 #
23 # NO WARRANTY
24 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 # LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
27 # AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
28 # THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
29 # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
32 # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
34 # THE POSSIBILITY OF SUCH DAMAGES.
35 #
36 # $Id: //depot/sw/linuxsrc/src/802_11/madwifi/madwifi/Makefile $
37 #
38
39 #
40 # Makefile for the HAL-based Atheros driver.
41 #
42
43 obj := $(firstword $(obj) $(SUBDIRS) .)
44 TOP = $(obj)
45
46 include $(TOP)/Makefile.inc
47
48 obj-y := ath/ ath_hal/ ath_rate/ net80211/
49
50 ifdef CRYPTO_TESTING
51 obj-y += regression/
52 endif
53
54 .PHONY: all
55 all: modules tools
56
57 .PHONY: modules
58 modules: configcheck
59 ifdef LINUX24
60         for i in $(obj-y); do \
61                 $(MAKE) -C $$i || exit 1; \
62         done
63 else
64         $(MAKE) -C $(KERNELPATH) SUBDIRS=$(shell pwd) modules
65 endif
66
67 # conflicts with the 'tools' subdirectory
68 .PHONY: tools
69 tools:
70         $(MAKE) -C $(TOOLS) all || exit 1
71
72 .PHONY: install
73 install: install-modules install-tools
74
75 .PHONY: install-modules
76 install-modules: modules
77         @# check if there are modules left from an old installation
78         @# might cause make to abort the build
79         sh scripts/find-madwifi-modules.sh -r $(KERNELRELEASE) $(DESTDIR)
80
81         for i in $(obj-y); do \
82                 $(MAKE) -C $$i install || exit 1; \
83         done
84 ifeq ($(DESTDIR),)
85         (export KMODPATH=$(KMODPATH); /sbin/depmod -ae $(KERNELRELEASE))
86 endif
87
88 .PHONY: install-tools
89 install-tools: tools
90         $(MAKE) -C $(TOOLS) install || exit 1
91
92 .PHONY: uninstall ininstall-modules
93 uninstall: uninstall-tools uninstall-modules
94 uninstall-modules:
95         sh scripts/find-madwifi-modules.sh -r $(KERNELRELEASE) $(DESTDIR)
96
97 .PHONY: list-modules find-modules
98 list-modules: find-modules
99 find-modules:
100         sh scripts/find-madwifi-modules.sh -l $(KERNELRELEASE)
101
102 .PHONY: uninstall-tools
103 uninstall-tools:
104         $(MAKE) -C $(TOOLS) uninstall
105
106 .PHONY: reinstall reinstall-tools reinstall-modules
107 reinstall: uninstall install
108 reinstall-tools: uninstall-tools install-tools
109 reinstall-modules: uninstall-modules install-modules
110
111 .PHONY: clean
112 clean:
113         for i in $(obj-y); do \
114                 $(MAKE) -C $$i clean; \
115         done
116         -$(MAKE) -C $(TOOLS) clean
117         rm -rf .tmp_versions
118         rm -f modules.order *.symvers Module.markers
119
120 .PHONY: info
121 info:
122         @echo "The following settings will be used for compilation:"
123         @echo "BUS          : $(BUS)"
124         @echo "KERNELRELEASE: $(KERNELRELEASE)"
125         @echo "KERNELPATH   : $(KERNELPATH)"
126         @echo "KERNELCONF   : $(KERNELCONF)"
127         @echo "KMODPATH     : $(KMODPATH)"
128         @echo "KMODSUF      : $(KMODSUF)"
129
130 .PHONY: sanitycheck
131 sanitycheck:
132         @echo -n "Checking requirements... "
133         
134         @# check if specified rate control is available
135         @if [ ! -d $(ATH_RATE) ]; then \
136             echo "FAILED"; \
137             echo "Selected rate control $(ATH_RATE) not available."; \
138             exit 1; \
139         fi
140         
141         @echo "ok."
142
143 .PHONY: release
144 release:
145         sh scripts/make-release.bash
146
147 .PHONY: unload 
148 unload:
149         bash scripts/madwifi-unload
150
151 .PHONY: configcheck
152 configcheck: sanitycheck
153         @echo -n "Checking kernel configuration... "
154         
155         @# check kernel version
156         @case $(KERNELRELEASE) in \
157             2.[456].*) ;; \
158             [3-9].*) ;; \
159             *) echo "FAILED"; \
160                echo "Only kernel versions 2.4.x and above are supported."; \
161                echo "You have $(KERNELRELEASE)."; \
162                exit 1 ;; \
163         esac
164         
165         @# check kernel configuration
166         @if [ -z "$(CONFIG_SYSCTL)" ]; then \
167             echo "FAILED"; \
168             echo "Please enable sysctl support."; \
169             exit 1; \
170         fi
171         
172 ifeq ($(strip $(BUS)),PCI)
173         @# check PCI support
174         @if [ -z "$(CONFIG_PCI)" ]; then \
175             echo "FAILED"; \
176             echo "Please enable PCI support."; \
177             exit 1; \
178         fi
179 endif
180         
181         @# check wireless extensions support is enabled
182         @if [ -z "$(CONFIG_NET_RADIO)$(CONFIG_WIRELESS_EXT)" ]; then \
183             echo "FAILED"; \
184             echo "Please enable wireless extensions."; \
185             exit 1; \
186         fi
187         
188         @# check crypto support is enabled
189         @if [ -z "$(CONFIG_CRYPTO)" ]; then \
190             echo "FAILED"; \
191             echo "Please enable crypto API."; \
192             exit 1; \
193         fi
194         
195         @echo "ok."