forked from kriswebdev/android_aircrack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.mak
121 lines (98 loc) · 2.88 KB
/
common.mak
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
PKG_CONFIG ?= pkg-config
ifndef TOOL_PREFIX
TOOL_PREFIX =
endif
ifndef OSNAME
OSNAME = $(shell uname -s | sed -e 's/.*CYGWIN.*/cygwin/g' -e 's,/,-,g')
endif
ifndef SQLITE
SQLITE = false
endif
ifndef LIBAIRPCAP
LIBAIRPCAP =
endif
ifeq ($(OSNAME), cygwin)
EXE = .exe
PIC =
SQLITE = false
else
EXE =
PIC = -fPIC
ifndef SQLITE
SQLITE = true
endif
endif
COMMON_CFLAGS =
ifeq ($(subst TRUE,true,$(filter TRUE true,$(sqlite) $(SQLITE))),true)
COMMON_CFLAGS += -I/usr/local/include -DHAVE_SQLITE
endif
ifeq ($(OSNAME), cygwin)
COMMON_CFLAGS += -DCYGWIN
else ifeq ($(libnl), true)
NL3xFOUND := $(shell $(PKG_CONFIG) --atleast-version=3.2 libnl-3.0 && echo Y)
ifneq ($(NL3xFOUND),Y)
NL31FOUND := $(shell $(PKG_CONFIG) --exact-version=3.1 libnl-3.1 && echo Y)
ifneq ($(NL31FOUND),Y)
NL3FOUND := $(shell $(PKG_CONFIG) --atleast-version=3 libnl-3.0 && echo Y)
ifneq ($(NL3FOUND),Y)
NL1FOUND := $(shell $(PKG_CONFIG) --atleast-version=1 libnl-1 && echo Y)
endif
endif
endif
ifeq ($(NL1FOUND),Y)
NLLIBNAME = libnl-1
endif
ifeq ($(NL3xFOUND),Y)
COMMON_CFLAGS += -DCONFIG_LIBNL30
LIBS += -lnl-genl-3
NLLIBNAME = libnl-3.0
endif
ifeq ($(NL3FOUND),Y)
COMMON_CFLAGS += -DCONFIG_LIBNL30
LIBS += -lnl-genl
NLLIBNAME = libnl-3.0
endif
# nl-3.1 has a broken libnl-gnl-3.1.pc file
# as show by pkg-config --debug --libs --cflags --exact-version=3.1 libnl-genl-3.1;echo $?
ifeq ($(NL31FOUND),Y)
COMMON_CFLAGS += -DCONFIG_LIBNL30
LIBS += -lnl-genl
NLLIBNAME = libnl-3.1
endif
ifeq ($(NLLIBNAME),)
$(error Cannot find development files for any supported version of libnl. install either libnl1 or libnl3.)
endif
LIBS += $(shell $(PKG_CONFIG) --libs $(NLLIBNAME))
COMMON_CFLAGS += $(shell $(PKG_CONFIG) --cflags $(NLLIBNAME))
endif
ifeq ($(subst TRUE,true,$(filter TRUE true,$(airpcap) $(AIRPCAP))),true)
LIBAIRPCAP = -DHAVE_AIRPCAP -I$(AC_ROOT)/../developers/Airpcap_Devpack/include
endif
ifneq ($(origin CC),environment)
CC = $(TOOL_PREFIX)gcc
endif
RANLIB ?= $(TOOL_PREFIX)ranlib
ifneq ($(origin AR),environment)
AR = $(TOOL_PREFIX)ar
endif
REVISION = $(shell $(AC_ROOT)/evalrev $(AC_ROOT))
REVFLAGS ?= -D_REVISION=$(REVISION)
OPTFLAGS = -D_FILE_OFFSET_BITS=64
CFLAGS ?= -g -W -Wall -O3
CFLAGS += $(OPTFLAGS) $(REVFLAGS) $(COMMON_CFLAGS)
prefix = /usr/local
bindir = $(prefix)/bin
sbindir = $(prefix)/sbin
mandir = $(prefix)/share/man/man1
smandir = $(prefix)/share/man/man8
datadir = $(prefix)/share
docdir = $(datadir)/doc/aircrack-ng
libdir = $(prefix)/lib
etcdir = $(prefix)/etc/aircrack-ng
GCC_OVER45 = $(shell expr 45 \<= `$(CC) -dumpversion | awk -F. '{ print $1$2 }'`)
ifeq ($(GCC_OVER45), 0)
GCC_OVER45 = $(shell expr 4.5 \<= `$(CC) -dumpversion | awk -F. '{ print $1$2 }'`)
endif
ifeq ($(GCC_OVER45), 1)
CFLAGS += -Wno-unused-but-set-variable -Wno-array-bounds
endif