Fix typos
[madwifi/.git] / tools / Makefile
1 #       $FreeBSD: src/tools/tools/ath/Makefile,v 1.3 2003/12/07 21:38:44 sam Exp $
2 #
3 # Copyright (c) 2002-2005       Sam Leffler, Errno Consulting
4 # All rights reserved.
5 #
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
8 # are met:
9 # 1. Redistributions of source code must retain the above copyright
10 #    notice, this list of conditions and the following disclaimer.
11 # 2. Redistributions in binary form must reproduce the above copyright
12 #    notice, this list of conditions and the following disclaimer in the
13 #    documentation and/or other materials provided with the distribution.
14 #
15 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 # SUCH DAMAGE.
26 #
27 TOP = ..
28
29 # USER_CROSS_COMPILE is a string that is prepended to all toolchain
30 # executables, such as gcc, ld, as, objcopy etc.  This is used for
31 # cross-compiling userspace binaries.  If not defined, CROSS_COMPILE
32 # is used.
33 USER_CROSS_COMPILE ?= $(CROSS_COMPILE)
34 STRIP ?= $(USER_CROSS_COMPILE)strip
35 CC = $(USER_CROSS_COMPILE)gcc
36
37 BINDIR ?= /usr/local/bin
38 MANDIR ?= /usr/local/man
39
40 #
41 # Path to the HAL source code.
42 #
43 ifeq ($(HAL),)
44 HAL = $(TOP)/ath_hal
45 endif
46
47
48 PROGRAMS = athstats 80211stats athkey athchans athctrl \
49         athdebug 80211debug wlanconfig wpakey
50
51 SUBDIRS = ath_info
52
53 INCS = -I. -I$(HAL) -I$(TOP)
54 CFLAGS = -g -O2 -Wall
55 ALL_CFLAGS = $(CFLAGS) $(INCS)
56 LDFLAGS =
57
58 all: all-subdirs $(PROGRAMS)
59
60 all-subdirs:
61         for d in $(SUBDIRS); do \
62                 $(MAKE) -C $$d || exit 1; \
63         done
64
65 athstats: athstats.c
66         $(CC) -o athstats $(ALL_CFLAGS) -I$(TOP)/ath $(LDFLAGS) athstats.c
67 80211stats: 80211stats.c
68         $(CC) -o 80211stats $(ALL_CFLAGS) $(LDFLAGS) 80211stats.c
69 athkey: athkey.c
70         $(CC) -o athkey $(ALL_CFLAGS) $(LDFLAGS) athkey.c
71 athchans: athchans.c
72         $(CC) -o athchans $(ALL_CFLAGS) $(LDFLAGS) athchans.c
73 athctrl: athctrl.c
74         $(CC) -o athctrl $(ALL_CFLAGS) $(LDFLAGS) athctrl.c
75 athdebug: athdebug.c
76         $(CC) -o athdebug $(ALL_CFLAGS) $(LDFLAGS) athdebug.c
77 wlanconfig: wlanconfig.c
78         $(CC) -o wlanconfig $(ALL_CFLAGS) $(LDFLAGS) wlanconfig.c
79 80211debug: 80211debug.c
80         $(CC) -o 80211debug $(ALL_CFLAGS) $(LDFLAGS) 80211debug.c
81 wpakey: wpakey.c
82         $(CC) -o wpakey $(ALL_CFLAGS) $(LDFLAGS) wpakey.c
83
84 install: all
85         install -d $(DESTDIR)$(BINDIR)
86         for i in $(PROGRAMS); do \
87                 install $$i $(DESTDIR)$(BINDIR)/$$i; \
88                 $(STRIP) $(DESTDIR)$(BINDIR)/$$i; \
89         done
90         install -d $(DESTDIR)$(MANDIR)/man8
91         install -m 0644 man/*.8 $(DESTDIR)$(MANDIR)/man8
92         install $(TOP)/scripts/madwifi-unload $(DESTDIR)$(BINDIR)/madwifi-unload
93         for d in $(SUBDIRS); do \
94                 $(MAKE) -C $$d install || exit 1; \
95         done
96
97 uninstall:
98         for i in $(PROGRAMS); do \
99                 rm -f $(DESTDIR)$(BINDIR)/$$i; \
100         done
101         for i in $(PROGRAMS:=.8); do \
102                 rm -f $(DESTDIR)$(MANDIR)/man8/$$i; \
103         done
104         for d in $(SUBDIRS); do \
105                 $(MAKE) -C $$d uninstall || exit 1; \
106         done
107
108 clean:
109         rm -f $(PROGRAMS) core a.out
110         for d in $(SUBDIRS); do \
111                 $(MAKE) -C $$d clean; \
112         done
113
114 .PHONY: all all-subdirs clean install uninstall