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 # Determine architecture of the kernel.
96 include $(TOP)/scripts/get_arch.mk
100 include $(TOP)/ath_hal/ah_target.inc
102 COPTS += -DTARGET='"$(TARGET)"'
104 # KMODPATH nominates the directory where the modules will be
106 KMODPATH := /lib/modules/$(KERNELRELEASE)/net
108 # Recognize 2.4.x kernels to support the old build system
109 ifeq ($(filter-out 2.4%,$(KERNELRELEASE)),)
116 export-objs = $(foreach m, $(obj-m), $($(m:.o=-objs)))
117 list-multi = $(obj-m)
124 # Path to the HAL source code.
130 # Path to HAL/OS interface code
132 ATH_HAL= $(TOP)/ath_hal
134 # Path to the 802.11 include files.
136 WLAN= $(TOP)/net80211
138 # Path to the Atheros device driver.
142 # Path to the rate control algorithms.
144 ATH_RATE= $(TOP)/ath_rate
146 # Path to the userspace utilities.
152 INCS= -include $(TOP)/include/compat.h -I$(TOP)/include
154 # TARGET defines the target platform architecture. It must match one of
155 # the target platforms supported by the HAL. The default target is the
156 # host machine architecture. You can override TARGET on the make command
157 # line or in the environment. See hal/linux/*.inc for the list of
159 ifeq (,$(wildcard $(HAL)/public/$(TARGET).inc))
160 TARGETS=$(basename $(notdir $(wildcard $(HAL)/public/*.inc)))
161 $(error TARGET $(TARGET) is invalid, valid targets are: $(TARGETS))
164 # HAL_DEBUG enables HAL debugging code
165 # At the moment this consists of wrappers around HAL functions so that
166 # stack traces are more decipherable.
172 # Don't let HAL mess with the toolchain - save toolchain variables
175 save_STRIP := $(STRIP)
176 save_OBJCOPY := $(OBJCOPY)
179 include $(HAL)/public/$(TARGET).inc
181 # Restore toolchain variables
184 STRIP := $(save_STRIP)
185 OBJCOPY := $(save_OBJCOPY)
188 include $(TOP)/BuildCaps.inc
190 # Ensure correct endianess
193 # Filter out compiler options that are not supported by all compilers
194 # and that are not needed to ensure compatible architecture and calling
196 COPTS := $(filter-out -mshort-load-bytes,$(COPTS))
199 # The following variables will affect developers only, and are used in the
200 # make-release.bash script.
202 # RELEASE_TMP is used as a temporary store for the files needed to create the
203 # release tarball. Packaging will take place in TMPDIR/madwifi-release.
207 # RELEASE_STORE is the (local) directory where the release tarball should be
208 # stored in. Defaults to the parent directory of the working copy used to
209 # create the release.
212 # expose these settings to make-release.bash
213 export RELEASE_TMP RELEASE_STORE