sample: eliminate clever code to determine which proc file is accessed
[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         $(MAKE) -C $(KERNELPATH) SUBDIRS=$(shell pwd) modules
60
61 # conflicts with the 'tools' subdirectory
62 .PHONY: tools
63 tools:
64         $(MAKE) -C $(TOOLS) all || exit 1
65
66 .PHONY: install
67 install: install-modules install-tools
68
69 .PHONY: install-modules
70 install-modules: modules
71         @# check if there are modules left from an old installation
72         @# might cause make to abort the build
73         sh scripts/find-madwifi-modules.sh -r $(KERNELRELEASE) $(DESTDIR)
74
75         for i in $(obj-y); do \
76                 $(MAKE) -C $$i install || exit 1; \
77         done
78         $(MAKE) depmod
79
80 .PHONY: install-tools
81 install-tools: tools
82         $(MAKE) -C $(TOOLS) install || exit 1
83
84 .PHONY: uninstall
85 uninstall: uninstall-tools uninstall-modules
86
87 .PHONY: uninstall-modules
88 uninstall-modules:
89         sh scripts/find-madwifi-modules.sh -r $(KERNELRELEASE) $(DESTDIR)
90         $(MAKE) depmod
91
92 .PHONY: list-modules find-modules
93 list-modules: find-modules
94 find-modules:
95         sh scripts/find-madwifi-modules.sh -l $(KERNELRELEASE)
96
97 .PHONY: uninstall-tools
98 uninstall-tools:
99         $(MAKE) -C $(TOOLS) uninstall
100
101 .PHONY: reinstall reinstall-tools reinstall-modules
102 reinstall: uninstall install
103 reinstall-tools: uninstall-tools install-tools
104 reinstall-modules: uninstall-modules install-modules
105
106 .PHONY: clean
107 clean:
108         for i in $(obj-y); do \
109                 $(MAKE) -C $$i clean; \
110         done
111         -$(MAKE) -C $(TOOLS) clean
112         rm -rf .tmp_versions
113         rm -f modules.order *.symvers Module.markers
114
115 .PHONY: info
116 info:
117         @echo "The following settings will be used for compilation:"
118         @echo "BUS          : $(BUS)"
119         @echo "KERNELRELEASE: $(KERNELRELEASE)"
120         @echo "KERNELPATH   : $(KERNELPATH)"
121         @echo "KERNELCONF   : $(KERNELCONF)"
122         @echo "KMODPATH     : $(KMODPATH)"
123         @echo "KMODSUF      : $(KMODSUF)"
124
125 .PHONY: sanitycheck
126 sanitycheck:
127         @echo -n "Checking requirements... "
128         
129         @# check if specified rate control is available
130         @if [ ! -d $(ATH_RATE) ]; then \
131             echo "FAILED"; \
132             echo "Selected rate control $(ATH_RATE) not available."; \
133             exit 1; \
134         fi
135         
136         @echo "ok."
137
138 .PHONY: release
139 release:
140         sh scripts/make-release.bash
141
142 .PHONY: unload 
143 unload:
144         bash scripts/madwifi-unload
145
146 .PHONY: configcheck
147 configcheck: sanitycheck
148         @echo -n "Checking kernel configuration... "
149         
150         @# check kernel version
151         @case $(KERNELRELEASE) in \
152             2.6.*) ;; \
153             [3-9].*) ;; \
154             *) echo "FAILED"; \
155                echo "Only kernel versions 2.6.13 and above are supported."; \
156                echo "You have $(KERNELRELEASE)."; \
157                exit 1 ;; \
158         esac
159         
160         @# check kernel configuration
161         @if [ -z "$(CONFIG_SYSCTL)" ]; then \
162             echo "FAILED"; \
163             echo "Please enable sysctl support."; \
164             exit 1; \
165         fi
166         
167 ifeq ($(strip $(BUS)),PCI)
168         @# check PCI support
169         @if [ -z "$(CONFIG_PCI)" ]; then \
170             echo "FAILED"; \
171             echo "Please enable PCI support."; \
172             exit 1; \
173         fi
174 endif
175         
176         @# check wireless extensions support is enabled
177         @if [ -z "$(CONFIG_NET_RADIO)$(CONFIG_WIRELESS_EXT)" ]; then \
178             echo "FAILED"; \
179             echo "Please enable wireless extensions."; \
180             exit 1; \
181         fi
182         
183         @# check crypto support is enabled
184         @if [ -z "$(CONFIG_CRYPTO)" ]; then \
185             echo "FAILED"; \
186             echo "Please enable crypto API."; \
187             exit 1; \
188         fi
189         
190         @echo "ok."
191
192 .PHONY: depmod
193 depmod:
194 ifeq ($(DESTDIR),)
195         /sbin/depmod -aeF $(KERNELPATH)/System.map $(KERNELRELEASE)
196 endif