1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
|
# horst - Highly Optimized Radio Scanning Tool
#
# Copyright (C) 2005-2016 Bruno Randolf (br1@einfach.org)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# build options
DEBUG=1
PCAP=0
WEXT=0
LIBNL=3.0
OSX=0
NAME=horst
VERSION=5.1
#VERSION=$(shell git describe --tags)
OBJS= \
average.o \
capture$(if $(filter 1,$(PCAP)),-pcap).o \
channel.o \
conf_options.o \
control.o \
display-channel.o \
display-essid.o \
display-filter.o \
display-help.o \
display-history.o \
display-main.o \
display-spectrum.o \
display-statistics.o \
display.o \
essid.o \
ieee80211_util.o \
ifctrl-ioctl.o \
listsort.o \
main.o \
network.o \
node.o \
protocol_parser.o \
wlan_parser.o \
radiotap/radiotap.o \
util.o \
wlan_util.o
PKG_CONFIG ?= pkg-config
LIBS=-lncurses -lm
CFLAGS+=-std=gnu99 -Wall -Wextra -g -I. -DVERSION=\"$(VERSION)\"
ifeq ($(OSX),1)
PCAP=1
WEXT=0
LIBNL=0
LIBS+=-framework CoreWLAN -framework CoreData -framework Foundation
OBJS+=mach_clock_gettime.o
endif
ifeq ($(DEBUG),1)
CFLAGS+=-DDO_DEBUG
endif
ifeq ($(PCAP),1)
CFLAGS+=-DPCAP
LIBS+=-lpcap
endif
ifeq ($(WEXT),1)
OBJS += ifctrl-wext.o
else
ifeq ($(LIBNL),0)
ifeq ($(OSX),0)
OBJS += ifctrl-dummy.o
endif
else
OBJS += ifctrl-nl80211.o
CFLAGS += $(shell $(PKG_CONFIG) --cflags libnl-$(LIBNL))
ifeq ($(LIBNL),tiny)
LIBS+=-lnl-tiny
else
LIBS+=-lnl-3 -lnl-genl-3
endif
endif
endif
PREFIX?=/usr/local
DESTDIR?=/
.PHONY: all check clean force
all: $(NAME)
.objdeps.mk: $(OBJS:%.o=%.c)
$(CC) -MM -I. $^ >$@
ifeq ($(OSX),1)
$(CC) -MM -I. ifctrl-osx.m >>$@
endif
-include .objdeps.mk
ifeq ($(OSX),1)
OBJS += ifctrl-osx.o
endif
$(NAME): $(OBJS)
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
$(OBJS): .buildflags
check:
sparse $(CFLAGS) *.[ch]
clean:
-rm -f *.o radiotap/*.o *~
-rm -f $(NAME)
-rm -f .buildflags
-rm -f .objdeps.mk
install:
mkdir -p $(DESTDIR)$(PREFIX)/sbin/
mkdir -p $(DESTDIR)/etc
mkdir -p $(DESTDIR)$(PREFIX)/share/man/man8/
mkdir -p $(DESTDIR)$(PREFIX)/share/man/man5
cp horst $(DESTDIR)$(PREFIX)/sbin/
cp horst.conf $(DESTDIR)/etc/
gzip horst.8 -c > $(DESTDIR)$(PREFIX)/share/man/man8/horst.8.gz
gzip horst.conf.5 -c > $(DESTDIR)$(PREFIX)/share/man/man5/horst.conf.5.gz
.buildflags: force
echo '$(CFLAGS)' | cmp -s - $@ || echo '$(CFLAGS)' > $@
|