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