1##### CLEAR VARS
2
3DRV_CFLAGS =
4DRV_WPA_CFLAGS =
5DRV_AP_CFLAGS =
6DRV_OBJS =
7DRV_WPA_OBJS =
8DRV_AP_OBJS =
9DRV_LIBS =
10DRV_WPA_LIBS =
11DRV_AP_LIBS =
12
13##### COMMON DRIVERS
14
15ifdef CONFIG_DRIVER_WIRED
16DRV_CFLAGS += -DCONFIG_DRIVER_WIRED
17DRV_OBJS += ../src/drivers/driver_wired.o
18NEED_DRV_WIRED_COMMON=1
19endif
20
21ifdef CONFIG_DRIVER_MACSEC_LINUX
22DRV_CFLAGS += -DCONFIG_DRIVER_MACSEC_LINUX
23DRV_OBJS += ../src/drivers/driver_macsec_linux.o
24NEED_DRV_WIRED_COMMON=1
25NEED_LIBNL=y
26CONFIG_LIBNL3_ROUTE=y
27endif
28
29ifdef CONFIG_DRIVER_NL80211_BRCM
30DRV_CFLAGS += -DCONFIG_DRIVER_NL80211_BRCM
31endif
32
33ifdef CONFIG_DRIVER_MACSEC_QCA
34DRV_CFLAGS += -DCONFIG_DRIVER_MACSEC_QCA
35DRV_OBJS += ../src/drivers/driver_macsec_qca.o
36NEED_DRV_WIRED_COMMON=1
37endif
38
39ifdef NEED_DRV_WIRED_COMMON
40DRV_OBJS += ../src/drivers/driver_wired_common.o
41endif
42
43ifdef CONFIG_DRIVER_NL80211
44DRV_CFLAGS += -DCONFIG_DRIVER_NL80211
45DRV_OBJS += ../src/drivers/driver_nl80211.o
46DRV_OBJS += ../src/drivers/driver_nl80211_capa.o
47DRV_OBJS += ../src/drivers/driver_nl80211_event.o
48DRV_OBJS += ../src/drivers/driver_nl80211_monitor.o
49DRV_OBJS += ../src/drivers/driver_nl80211_scan.o
50ifdef CONFIG_DRIVER_NL80211_QCA
51DRV_CFLAGS += -DCONFIG_DRIVER_NL80211_QCA
52endif
53NEED_SME=y
54NEED_AP_MLME=y
55NEED_NETLINK=y
56NEED_LINUX_IOCTL=y
57NEED_RFKILL=y
58NEED_RADIOTAP=y
59NEED_LIBNL=y
60endif
61
62ifdef CONFIG_DRIVER_BSD
63ifndef CONFIG_L2_PACKET
64CONFIG_L2_PACKET=freebsd
65endif
66DRV_CFLAGS += -DCONFIG_DRIVER_BSD
67DRV_OBJS += ../src/drivers/driver_bsd.o
68CONFIG_L2_FREEBSD=y
69CONFIG_DNET_PCAP=y
70endif
71
72ifdef CONFIG_DRIVER_OPENBSD
73ifndef CONFIG_L2_PACKET
74CONFIG_L2_PACKET=freebsd
75endif
76DRV_CFLAGS += -DCONFIG_DRIVER_OPENBSD
77DRV_OBJS += ../src/drivers/driver_openbsd.o
78endif
79
80ifdef CONFIG_DRIVER_NONE
81DRV_CFLAGS += -DCONFIG_DRIVER_NONE
82DRV_OBJS += ../src/drivers/driver_none.o
83endif
84
85##### PURE AP DRIVERS
86
87ifdef CONFIG_DRIVER_HOSTAP
88DRV_AP_CFLAGS += -DCONFIG_DRIVER_HOSTAP
89DRV_AP_OBJS += ../src/drivers/driver_hostap.o
90CONFIG_WIRELESS_EXTENSION=y
91NEED_AP_MLME=y
92NEED_NETLINK=y
93NEED_LINUX_IOCTL=y
94endif
95
96ifdef CONFIG_DRIVER_ATHEROS
97DRV_AP_CFLAGS += -DCONFIG_DRIVER_ATHEROS
98DRV_AP_OBJS += ../src/drivers/driver_atheros.o
99CONFIG_L2_PACKET=linux
100NEED_NETLINK=y
101NEED_LINUX_IOCTL=y
102ifdef ATH_GCM_SUPPORT
103CFLAGS += -DATH_GCM_SUPPORT
104endif
105endif
106
107##### PURE CLIENT DRIVERS
108
109ifdef CONFIG_DRIVER_WEXT
110DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT
111CONFIG_WIRELESS_EXTENSION=y
112NEED_NETLINK=y
113NEED_LINUX_IOCTL=y
114NEED_RFKILL=y
115endif
116
117ifdef CONFIG_DRIVER_NDIS
118DRV_WPA_CFLAGS += -DCONFIG_DRIVER_NDIS
119DRV_WPA_OBJS += ../src/drivers/driver_ndis.o
120ifdef CONFIG_NDIS_EVENTS_INTEGRATED
121DRV_WPA_OBJS += ../src/drivers/driver_ndis_.o
122endif
123ifndef CONFIG_L2_PACKET
124CONFIG_L2_PACKET=pcap
125endif
126CONFIG_WINPCAP=y
127ifdef CONFIG_USE_NDISUIO
128DRV_WPA_CFLAGS += -DCONFIG_USE_NDISUIO
129endif
130endif
131
132ifdef CONFIG_DRIVER_ROBOSWITCH
133DRV_WPA_CFLAGS += -DCONFIG_DRIVER_ROBOSWITCH
134DRV_WPA_OBJS += ../src/drivers/driver_roboswitch.o
135endif
136
137ifdef CONFIG_WIRELESS_EXTENSION
138DRV_WPA_CFLAGS += -DCONFIG_WIRELESS_EXTENSION
139DRV_WPA_OBJS += ../src/drivers/driver_wext.o
140NEED_RFKILL=y
141endif
142
143ifdef NEED_NETLINK
144DRV_OBJS += ../src/drivers/netlink.o
145endif
146
147ifdef NEED_RFKILL
148DRV_OBJS += ../src/drivers/rfkill.o
149endif
150
151ifdef NEED_RADIOTAP
152DRV_OBJS += ../src/utils/radiotap.o
153endif
154
155ifdef CONFIG_FULL_DYNAMIC_VLAN
156NEED_LINUX_IOCTL=y
157ifdef CONFIG_VLAN_NETLINK
158NEED_LIBNL=y
159CONFIG_LIBNL3_ROUTE=y
160endif
161endif
162
163ifdef NEED_LINUX_IOCTL
164DRV_OBJS += ../src/drivers/linux_ioctl.o
165endif
166
167ifdef NEED_LIBNL
168ifndef CONFIG_LIBNL32
169ifndef CONFIG_LIBNL20
170ifndef CONFIG_LIBNL_TINY
171PKG_CONFIG ?= pkg-config
172HAVE_LIBNL3 := $(shell $(PKG_CONFIG) --exists libnl-3.0; echo $$?)
173ifeq ($(HAVE_LIBNL3),0)
174CONFIG_LIBNL32=y
175endif
176endif
177endif
178endif
179
180ifdef CONFIG_LIBNL32
181  DRV_LIBS += -lnl-3
182  DRV_LIBS += -lnl-genl-3
183  ifdef LIBNL_INC
184    DRV_CFLAGS += -I$(LIBNL_INC)
185  else
186    PKG_CONFIG ?= pkg-config
187    DRV_CFLAGS += $(shell $(PKG_CONFIG) --cflags libnl-3.0)
188  endif
189  ifdef CONFIG_LIBNL3_ROUTE
190    DRV_LIBS += -lnl-route-3
191    DRV_CFLAGS += -DCONFIG_LIBNL3_ROUTE
192  endif
193else
194  ifdef CONFIG_LIBNL_TINY
195    DRV_LIBS += -lnl-tiny
196  else
197    ifndef CONFIG_OSX
198      DRV_LIBS += -lnl
199      DRV_LIBS += -lnl-genl
200    endif
201  endif
202endif
203endif
204
205##### COMMON VARS
206DRV_BOTH_CFLAGS := $(DRV_CFLAGS) $(DRV_WPA_CFLAGS) $(DRV_AP_CFLAGS)
207DRV_WPA_CFLAGS += $(DRV_CFLAGS)
208DRV_AP_CFLAGS += $(DRV_CFLAGS)
209
210DRV_BOTH_LIBS := $(DRV_LIBS) $(DRV_WPA_LIBS) $(DRV_AP_LIBS)
211DRV_WPA_LIBS += $(DRV_LIBS)
212DRV_AP_LIBS += $(DRV_LIBS)
213
214DRV_BOTH_OBJS := $(DRV_OBJS) $(DRV_WPA_OBJS) $(DRV_AP_OBJS)
215DRV_WPA_OBJS += $(DRV_OBJS)
216DRV_AP_OBJS += $(DRV_OBJS)
217
218DRV_BOTH_LDFLAGS := $(DRV_LDFLAGS) $(DRV_WPA_LDFLAGS) $(DRV_AP_LDFLAGS)
219DRV_WPA_LDFLAGS += $(DRV_LDFLAGS)
220DRV_AP_LDFLAGS += $(DRV_LDFLAGS)
221