2 # Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
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.
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.
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.
36 # $Id: //depot/sw/linuxsrc/src/802_11/madwifi/madwifi/Makefile.inc#11 $
39 # other locales sometimes cause trouble
42 # BUS defines the bus type to which the wireless devices is attached.
43 # Currently, the valid BUS types are PCI and AHB. If BUS is not
44 # defined, then, we assume the bus type is PCI
49 # DESTDIR is used as path prefix during installation.
52 # KERNELPATH is the path to the Linux kernel build tree. Unless a
53 # separate build directory was used for the kernel build, it's the same
54 # as the kernel source tree. KERNELPATH is used to access the kernel
55 # configuration, include files and the build system. To build for
56 # another kernel, set KERNELPATH manually, for example with:
57 # make KERNELPATH=/path/to/kernel/source
59 # The default KERNELPATH points to the directory where the currently
60 # running kernel was compiled. Note that the configuration and the
61 # version of the kernel tree might have changed since then.
62 ifeq ($(wildcard $(KERNELPATH)),)
63 KERNELPATH = /lib/modules/$(shell uname -r)/build
64 # sanity check: does KERNELPATH exist?
65 ifeq ($(shell cd $(KERNELPATH) && pwd),)
66 $(error $(KERNELPATH) is missing, please set KERNELPATH)
71 # KERNELRELEASE is the target kernel's version. It's always taken from
72 # the kernel build tree. Kernel Makefile doesn't always know the exact
73 # kernel version (especially for vendor stock kernels), so we get it
74 # from <linux/version.h> instead. But simply grepping it from version.h
75 # doesn't work, since some distributions have multiple UTS_RELEASE
77 # This trick has been inspired by the lm_sensors project.
79 KERNELRELEASE := $(shell $(CC) -I $(KERNELPATH)/include -E $(TOP)/kernelversion.c | grep uts_release | cut -f2 -d'"')
80 ifeq (,$(KERNELRELEASE))
81 $(error Cannot detect kernel version - please check compiler and KERNELPATH)
85 # KERNELCONF is the name of the file that holds the configuration
86 # of the target kernel.
87 KERNELCONF ?= $(KERNELPATH)/.config
89 # sanity check: does KERNELCONF exist?
90 ifeq ($(wildcard $(KERNELCONF)),)
91 $(error KERNELCONF: $(KERNELCONF) does not exist.)
95 # KMODPATH nominates the directory where the modules will be
97 KMODPATH := /lib/modules/$(KERNELRELEASE)/net
99 # Recognize 2.4.x kernels to support the old build system
100 ifeq ($(filter-out 2.4%,$(KERNELRELEASE)),)
107 export-objs = $(foreach m, $(obj-m), $($(m:.o=-objs)))
108 list-multi = $(obj-m)
115 # Path to the HAL source code.
121 # Path to the 802.11 include files.
123 WLAN= $(TOP)/net80211
125 # Path to the Atheros device driver.
129 # Path to the rate control algorithms.
131 ATH_RATE= $(TOP)/ath_rate
133 # Path to the userspace utilities.
137 WARNINGS = -Werror -Wall
139 INCS= -include $(TOP)/include/compat.h -I$(TOP)/include
141 ifndef ATH_DEBUG_SPINLOCKS
142 export ATH_DEBUG_SPINLOCKS=0
145 ifndef IEEE80211_DEBUG_REFCNT
146 export IEEE80211_DEBUG_REFCNT=0
157 ifeq ($(strip $(ATH_DEBUG_SPINLOCKS)),1)
158 COPTS+= -DATH_DEBUG_SPINLOCKS=1
161 ifeq ($(strip $(IEEE80211_DEBUG_REFCNT)),1)
162 COPTS+= -DIEEE80211_DEBUG_REFCNT=1
165 # HAL_DEBUG enables HAL debugging code
166 # At the moment this consists of wrappers around HAL functions so that
167 # stack traces are more decipherable.
168 ifeq ($(strip $(HAL_DEBUG)),1)
169 COPTS+= -fno-inline -DAH_DEBUG=1
172 include $(TOP)/BuildCaps.inc
174 ifeq ($(strip $(ATH_DEBUG)),1)
175 EXTRA_CFLAGS += -DAR_DEBUG -DIEEE80211_DEBUG
178 ifeq ($(strip $(ATH_DEBUG_SPINLOCKS)),1)
179 EXTRA_CFLAGS += -DATH_DEBUG_SPINLOCKS
182 ifeq ($(strip $(IEEE80211_DEBUG_REFCNT)),1)
183 EXTRA_CFLAGS += -DIEEE80211_DEBUG_REFCNT
186 # Ensure correct endianess
189 # Filter out compiler options that are not supported by all compilers
190 # and that are not needed to ensure compatible architecture and calling
192 COPTS := $(filter-out -mshort-load-bytes -mapcs-32,$(COPTS))
195 # The following variables will affect developers only, and are used in the
196 # make-release.bash script.
198 # RELEASE_TMP is used as a temporary store for the files needed to create the
199 # release tarball. Packaging will take place in TMPDIR/madwifi-release.
203 # RELEASE_STORE is the (local) directory where the release tarball should be
204 # stored in. Defaults to the parent directory of the working copy used to
205 # create the release.
208 # expose these settings to make-release.bash
209 export RELEASE_TMP RELEASE_STORE