Makefile 22 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112
  1. ifndef CC
  2. CC=gcc
  3. endif
  4. ifndef CFLAGS
  5. CFLAGS = -MMD -O2 -Wall -g
  6. endif
  7. ifdef LIBS
  8. # If LIBS is set with some global build system defaults, clone those for
  9. # LIBS_c, LIBS_h, and LIBS_n to cover hostapd_cli, hlr_auc_gw, and
  10. # nt_password_hash as well.
  11. ifndef LIBS_c
  12. LIBS_c := $(LIBS)
  13. endif
  14. ifndef LIBS_h
  15. LIBS_h := $(LIBS)
  16. endif
  17. ifndef LIBS_n
  18. LIBS_n := $(LIBS)
  19. endif
  20. endif
  21. CFLAGS += $(EXTRA_CFLAGS)
  22. CFLAGS += -I$(abspath ../src)
  23. CFLAGS += -I$(abspath ../src/utils)
  24. export BINDIR ?= /usr/local/bin/
  25. -include .config
  26. ifndef CONFIG_NO_GITVER
  27. # Add VERSION_STR postfix for builds from a git repository
  28. ifeq ($(wildcard ../.git),../.git)
  29. GITVER := $(shell git describe --dirty=+)
  30. ifneq ($(GITVER),)
  31. CFLAGS += -DGIT_VERSION_STR_POSTFIX=\"-$(GITVER)\"
  32. endif
  33. endif
  34. endif
  35. ifdef CONFIG_TESTING_OPTIONS
  36. CFLAGS += -DCONFIG_TESTING_OPTIONS
  37. CONFIG_WPS_TESTING=y
  38. endif
  39. ifndef CONFIG_OS
  40. ifdef CONFIG_NATIVE_WINDOWS
  41. CONFIG_OS=win32
  42. else
  43. CONFIG_OS=unix
  44. endif
  45. endif
  46. ifeq ($(CONFIG_OS), internal)
  47. CFLAGS += -DOS_NO_C_LIB_DEFINES
  48. endif
  49. ifdef CONFIG_NATIVE_WINDOWS
  50. CFLAGS += -DCONFIG_NATIVE_WINDOWS
  51. LIBS += -lws2_32
  52. endif
  53. OBJS += main.o
  54. OBJS += config_file.o
  55. OBJS += ../src/ap/hostapd.o
  56. OBJS += ../src/ap/wpa_auth_glue.o
  57. OBJS += ../src/ap/drv_callbacks.o
  58. OBJS += ../src/ap/ap_drv_ops.o
  59. OBJS += ../src/ap/utils.o
  60. OBJS += ../src/ap/authsrv.o
  61. OBJS += ../src/ap/ieee802_1x.o
  62. OBJS += ../src/ap/ap_config.o
  63. OBJS += ../src/ap/eap_user_db.o
  64. OBJS += ../src/ap/ieee802_11_auth.o
  65. OBJS += ../src/ap/sta_info.o
  66. OBJS += ../src/ap/wpa_auth.o
  67. OBJS += ../src/ap/tkip_countermeasures.o
  68. OBJS += ../src/ap/ap_mlme.o
  69. OBJS += ../src/ap/wpa_auth_ie.o
  70. OBJS += ../src/ap/preauth_auth.o
  71. OBJS += ../src/ap/pmksa_cache_auth.o
  72. OBJS += ../src/ap/ieee802_11_shared.o
  73. OBJS += ../src/ap/beacon.o
  74. OBJS += ../src/ap/bss_load.o
  75. OBJS_c = hostapd_cli.o ../src/common/wpa_ctrl.o ../src/utils/os_$(CONFIG_OS).o
  76. NEED_RC4=y
  77. NEED_AES=y
  78. NEED_MD5=y
  79. NEED_SHA1=y
  80. OBJS += ../src/drivers/drivers.o
  81. CFLAGS += -DHOSTAPD
  82. ifdef CONFIG_MODULE_TESTS
  83. CFLAGS += -DCONFIG_MODULE_TESTS
  84. OBJS += hapd_module_tests.o
  85. endif
  86. ifdef CONFIG_WPA_TRACE
  87. CFLAGS += -DWPA_TRACE
  88. OBJS += ../src/utils/trace.o
  89. HOBJS += ../src/utils/trace.o
  90. LDFLAGS += -rdynamic
  91. CFLAGS += -funwind-tables
  92. ifdef CONFIG_WPA_TRACE_BFD
  93. CFLAGS += -DPACKAGE="hostapd" -DWPA_TRACE_BFD
  94. LIBS += -lbfd -ldl -liberty -lz
  95. LIBS_c += -lbfd -ldl -liberty -lz
  96. LIBS_h += -lbfd -ldl -liberty -lz
  97. endif
  98. endif
  99. ifndef CONFIG_ELOOP
  100. CONFIG_ELOOP=eloop
  101. endif
  102. OBJS += ../src/utils/$(CONFIG_ELOOP).o
  103. OBJS_c += ../src/utils/$(CONFIG_ELOOP).o
  104. ifeq ($(CONFIG_ELOOP), eloop)
  105. # Using glibc < 2.17 requires -lrt for clock_gettime()
  106. LIBS += -lrt
  107. LIBS_c += -lrt
  108. LIBS_h += -lrt
  109. LIBS_n += -lrt
  110. endif
  111. ifdef CONFIG_ELOOP_POLL
  112. CFLAGS += -DCONFIG_ELOOP_POLL
  113. endif
  114. ifdef CONFIG_ELOOP_EPOLL
  115. CFLAGS += -DCONFIG_ELOOP_EPOLL
  116. endif
  117. ifdef CONFIG_ELOOP_KQUEUE
  118. CFLAGS += -DCONFIG_ELOOP_KQUEUE
  119. endif
  120. OBJS += ../src/utils/common.o
  121. OBJS_c += ../src/utils/common.o
  122. OBJS += ../src/utils/wpa_debug.o
  123. OBJS_c += ../src/utils/wpa_debug.o
  124. OBJS += ../src/utils/wpabuf.o
  125. OBJS += ../src/utils/os_$(CONFIG_OS).o
  126. OBJS += ../src/utils/ip_addr.o
  127. OBJS += ../src/common/ieee802_11_common.o
  128. OBJS += ../src/common/wpa_common.o
  129. OBJS += ../src/common/hw_features_common.o
  130. OBJS += ../src/eapol_auth/eapol_auth_sm.o
  131. ifdef CONFIG_CODE_COVERAGE
  132. CFLAGS += -O0 -fprofile-arcs -ftest-coverage
  133. LIBS += -lgcov
  134. LIBS_c += -lgcov
  135. LIBS_h += -lgcov
  136. LIBS_n += -lgcov
  137. endif
  138. ifndef CONFIG_NO_DUMP_STATE
  139. # define HOSTAPD_DUMP_STATE to include support for dumping internal state
  140. # through control interface commands (undefine it, if you want to save in
  141. # binary size)
  142. CFLAGS += -DHOSTAPD_DUMP_STATE
  143. OBJS += ../src/eapol_auth/eapol_auth_dump.o
  144. endif
  145. ifdef CONFIG_NO_RADIUS
  146. CFLAGS += -DCONFIG_NO_RADIUS
  147. CONFIG_NO_ACCOUNTING=y
  148. else
  149. OBJS += ../src/radius/radius.o
  150. OBJS += ../src/radius/radius_client.o
  151. OBJS += ../src/radius/radius_das.o
  152. endif
  153. ifdef CONFIG_NO_ACCOUNTING
  154. CFLAGS += -DCONFIG_NO_ACCOUNTING
  155. else
  156. OBJS += ../src/ap/accounting.o
  157. endif
  158. ifdef CONFIG_NO_VLAN
  159. CFLAGS += -DCONFIG_NO_VLAN
  160. else
  161. OBJS += ../src/ap/vlan_init.o
  162. OBJS += ../src/ap/vlan_ifconfig.o
  163. OBJS += ../src/ap/vlan.o
  164. ifdef CONFIG_FULL_DYNAMIC_VLAN
  165. # Define CONFIG_FULL_DYNAMIC_VLAN to have hostapd manipulate bridges
  166. # and VLAN interfaces for the VLAN feature.
  167. CFLAGS += -DCONFIG_FULL_DYNAMIC_VLAN
  168. OBJS += ../src/ap/vlan_full.o
  169. ifdef CONFIG_VLAN_NETLINK
  170. OBJS += ../src/ap/vlan_util.o
  171. else
  172. OBJS += ../src/ap/vlan_ioctl.o
  173. endif
  174. endif
  175. endif
  176. ifdef CONFIG_NO_CTRL_IFACE
  177. CFLAGS += -DCONFIG_NO_CTRL_IFACE
  178. else
  179. ifeq ($(CONFIG_CTRL_IFACE), udp)
  180. CFLAGS += -DCONFIG_CTRL_IFACE_UDP
  181. else
  182. ifeq ($(CONFIG_CTRL_IFACE), udp6)
  183. CFLAGS += -DCONFIG_CTRL_IFACE_UDP
  184. CFLAGS += -DCONFIG_CTRL_IFACE_UDP_IPV6
  185. else
  186. ifeq ($(CONFIG_CTRL_IFACE), udp-remote)
  187. CFLAGS += -DCONFIG_CTRL_IFACE_UDP
  188. CFLAGS += -DCONFIG_CTRL_IFACE_UDP_REMOTE
  189. else
  190. ifeq ($(CONFIG_CTRL_IFACE), udp6-remote)
  191. CFLAGS += -DCONFIG_CTRL_IFACE_UDP
  192. CFLAGS += -DCONFIG_CTRL_IFACE_UDP_REMOTE
  193. CFLAGS += -DCONFIG_CTRL_IFACE_UDP_IPV6
  194. else
  195. CFLAGS += -DCONFIG_CTRL_IFACE_UNIX
  196. endif
  197. endif
  198. endif
  199. endif
  200. OBJS += ../src/common/ctrl_iface_common.o
  201. OBJS += ctrl_iface.o
  202. OBJS += ../src/ap/ctrl_iface_ap.o
  203. endif
  204. ifndef CONFIG_NO_CTRL_IFACE
  205. CFLAGS += -DCONFIG_CTRL_IFACE
  206. endif
  207. ifdef CONFIG_IAPP
  208. CFLAGS += -DCONFIG_IAPP
  209. OBJS += ../src/ap/iapp.o
  210. endif
  211. ifdef CONFIG_RSN_PREAUTH
  212. CFLAGS += -DCONFIG_RSN_PREAUTH
  213. CONFIG_L2_PACKET=y
  214. endif
  215. ifdef CONFIG_PEERKEY
  216. CFLAGS += -DCONFIG_PEERKEY
  217. OBJS += ../src/ap/peerkey_auth.o
  218. endif
  219. ifdef CONFIG_HS20
  220. NEED_AES_OMAC1=y
  221. CONFIG_PROXYARP=y
  222. endif
  223. ifdef CONFIG_PROXYARP
  224. CONFIG_L2_PACKET=y
  225. endif
  226. ifdef CONFIG_SUITEB
  227. CFLAGS += -DCONFIG_SUITEB
  228. NEED_SHA256=y
  229. NEED_AES_OMAC1=y
  230. endif
  231. ifdef CONFIG_SUITEB192
  232. CFLAGS += -DCONFIG_SUITEB192
  233. NEED_SHA384=y
  234. endif
  235. ifdef CONFIG_IEEE80211W
  236. CFLAGS += -DCONFIG_IEEE80211W
  237. NEED_SHA256=y
  238. NEED_AES_OMAC1=y
  239. endif
  240. ifdef CONFIG_IEEE80211R
  241. CFLAGS += -DCONFIG_IEEE80211R
  242. OBJS += ../src/ap/wpa_auth_ft.o
  243. NEED_SHA256=y
  244. NEED_AES_OMAC1=y
  245. NEED_AES_UNWRAP=y
  246. endif
  247. ifdef CONFIG_SAE
  248. CFLAGS += -DCONFIG_SAE
  249. OBJS += ../src/common/sae.o
  250. NEED_ECC=y
  251. NEED_DH_GROUPS=y
  252. NEED_AP_MLME=y
  253. endif
  254. ifdef CONFIG_WNM
  255. CFLAGS += -DCONFIG_WNM
  256. OBJS += ../src/ap/wnm_ap.o
  257. endif
  258. ifdef CONFIG_IEEE80211N
  259. CFLAGS += -DCONFIG_IEEE80211N
  260. endif
  261. ifdef CONFIG_IEEE80211AC
  262. CFLAGS += -DCONFIG_IEEE80211AC
  263. endif
  264. ifdef CONFIG_MBO
  265. CFLAGS += -DCONFIG_MBO
  266. OBJS += ../src/ap/mbo_ap.o
  267. endif
  268. include ../src/drivers/drivers.mak
  269. OBJS += $(DRV_AP_OBJS)
  270. CFLAGS += $(DRV_AP_CFLAGS)
  271. LDFLAGS += $(DRV_AP_LDFLAGS)
  272. LIBS += $(DRV_AP_LIBS)
  273. ifdef CONFIG_L2_PACKET
  274. ifdef CONFIG_DNET_PCAP
  275. ifdef CONFIG_L2_FREEBSD
  276. LIBS += -lpcap
  277. OBJS += ../src/l2_packet/l2_packet_freebsd.o
  278. else
  279. LIBS += -ldnet -lpcap
  280. OBJS += ../src/l2_packet/l2_packet_pcap.o
  281. endif
  282. else
  283. OBJS += ../src/l2_packet/l2_packet_linux.o
  284. endif
  285. else
  286. OBJS += ../src/l2_packet/l2_packet_none.o
  287. endif
  288. ifdef CONFIG_ERP
  289. CFLAGS += -DCONFIG_ERP
  290. NEED_SHA256=y
  291. NEED_HMAC_SHA256_KDF=y
  292. endif
  293. ifdef CONFIG_EAP_MD5
  294. CFLAGS += -DEAP_SERVER_MD5
  295. OBJS += ../src/eap_server/eap_server_md5.o
  296. CHAP=y
  297. endif
  298. ifdef CONFIG_EAP_TLS
  299. CFLAGS += -DEAP_SERVER_TLS
  300. OBJS += ../src/eap_server/eap_server_tls.o
  301. TLS_FUNCS=y
  302. endif
  303. ifdef CONFIG_EAP_UNAUTH_TLS
  304. CFLAGS += -DEAP_SERVER_UNAUTH_TLS
  305. ifndef CONFIG_EAP_TLS
  306. OBJS += ../src/eap_server/eap_server_tls.o
  307. TLS_FUNCS=y
  308. endif
  309. endif
  310. ifdef CONFIG_EAP_PEAP
  311. CFLAGS += -DEAP_SERVER_PEAP
  312. OBJS += ../src/eap_server/eap_server_peap.o
  313. OBJS += ../src/eap_common/eap_peap_common.o
  314. TLS_FUNCS=y
  315. CONFIG_EAP_MSCHAPV2=y
  316. endif
  317. ifdef CONFIG_EAP_TTLS
  318. CFLAGS += -DEAP_SERVER_TTLS
  319. OBJS += ../src/eap_server/eap_server_ttls.o
  320. TLS_FUNCS=y
  321. CHAP=y
  322. endif
  323. ifdef CONFIG_EAP_MSCHAPV2
  324. CFLAGS += -DEAP_SERVER_MSCHAPV2
  325. OBJS += ../src/eap_server/eap_server_mschapv2.o
  326. MS_FUNCS=y
  327. endif
  328. ifdef CONFIG_EAP_GTC
  329. CFLAGS += -DEAP_SERVER_GTC
  330. OBJS += ../src/eap_server/eap_server_gtc.o
  331. endif
  332. ifdef CONFIG_EAP_SIM
  333. CFLAGS += -DEAP_SERVER_SIM
  334. OBJS += ../src/eap_server/eap_server_sim.o
  335. CONFIG_EAP_SIM_COMMON=y
  336. NEED_AES_CBC=y
  337. endif
  338. ifdef CONFIG_EAP_AKA
  339. CFLAGS += -DEAP_SERVER_AKA
  340. OBJS += ../src/eap_server/eap_server_aka.o
  341. CONFIG_EAP_SIM_COMMON=y
  342. NEED_SHA256=y
  343. NEED_AES_CBC=y
  344. endif
  345. ifdef CONFIG_EAP_AKA_PRIME
  346. CFLAGS += -DEAP_SERVER_AKA_PRIME
  347. endif
  348. ifdef CONFIG_EAP_SIM_COMMON
  349. OBJS += ../src/eap_common/eap_sim_common.o
  350. # Example EAP-SIM/AKA interface for GSM/UMTS authentication. This can be
  351. # replaced with another file implementating the interface specified in
  352. # eap_sim_db.h.
  353. OBJS += ../src/eap_server/eap_sim_db.o
  354. NEED_FIPS186_2_PRF=y
  355. endif
  356. ifdef CONFIG_EAP_PAX
  357. CFLAGS += -DEAP_SERVER_PAX
  358. OBJS += ../src/eap_server/eap_server_pax.o ../src/eap_common/eap_pax_common.o
  359. endif
  360. ifdef CONFIG_EAP_PSK
  361. CFLAGS += -DEAP_SERVER_PSK
  362. OBJS += ../src/eap_server/eap_server_psk.o ../src/eap_common/eap_psk_common.o
  363. NEED_AES_OMAC1=y
  364. NEED_AES_ENCBLOCK=y
  365. NEED_AES_EAX=y
  366. endif
  367. ifdef CONFIG_EAP_SAKE
  368. CFLAGS += -DEAP_SERVER_SAKE
  369. OBJS += ../src/eap_server/eap_server_sake.o ../src/eap_common/eap_sake_common.o
  370. endif
  371. ifdef CONFIG_EAP_GPSK
  372. CFLAGS += -DEAP_SERVER_GPSK
  373. OBJS += ../src/eap_server/eap_server_gpsk.o ../src/eap_common/eap_gpsk_common.o
  374. ifdef CONFIG_EAP_GPSK_SHA256
  375. CFLAGS += -DEAP_GPSK_SHA256
  376. endif
  377. NEED_SHA256=y
  378. NEED_AES_OMAC1=y
  379. endif
  380. ifdef CONFIG_EAP_PWD
  381. CFLAGS += -DEAP_SERVER_PWD
  382. OBJS += ../src/eap_server/eap_server_pwd.o ../src/eap_common/eap_pwd_common.o
  383. NEED_SHA256=y
  384. endif
  385. ifdef CONFIG_EAP_EKE
  386. CFLAGS += -DEAP_SERVER_EKE
  387. OBJS += ../src/eap_server/eap_server_eke.o ../src/eap_common/eap_eke_common.o
  388. NEED_DH_GROUPS=y
  389. NEED_DH_GROUPS_ALL=y
  390. endif
  391. ifdef CONFIG_EAP_VENDOR_TEST
  392. CFLAGS += -DEAP_SERVER_VENDOR_TEST
  393. OBJS += ../src/eap_server/eap_server_vendor_test.o
  394. endif
  395. ifdef CONFIG_EAP_FAST
  396. CFLAGS += -DEAP_SERVER_FAST
  397. OBJS += ../src/eap_server/eap_server_fast.o
  398. OBJS += ../src/eap_common/eap_fast_common.o
  399. TLS_FUNCS=y
  400. NEED_T_PRF=y
  401. NEED_AES_UNWRAP=y
  402. endif
  403. ifdef CONFIG_WPS
  404. CFLAGS += -DCONFIG_WPS -DEAP_SERVER_WSC
  405. OBJS += ../src/utils/uuid.o
  406. OBJS += ../src/ap/wps_hostapd.o
  407. OBJS += ../src/eap_server/eap_server_wsc.o ../src/eap_common/eap_wsc_common.o
  408. OBJS += ../src/wps/wps.o
  409. OBJS += ../src/wps/wps_common.o
  410. OBJS += ../src/wps/wps_attr_parse.o
  411. OBJS += ../src/wps/wps_attr_build.o
  412. OBJS += ../src/wps/wps_attr_process.o
  413. OBJS += ../src/wps/wps_dev_attr.o
  414. OBJS += ../src/wps/wps_enrollee.o
  415. OBJS += ../src/wps/wps_registrar.o
  416. NEED_DH_GROUPS=y
  417. NEED_SHA256=y
  418. NEED_BASE64=y
  419. NEED_AES_CBC=y
  420. NEED_MODEXP=y
  421. CONFIG_EAP=y
  422. ifdef CONFIG_WPS_NFC
  423. CFLAGS += -DCONFIG_WPS_NFC
  424. OBJS += ../src/wps/ndef.o
  425. NEED_WPS_OOB=y
  426. endif
  427. ifdef NEED_WPS_OOB
  428. CFLAGS += -DCONFIG_WPS_OOB
  429. endif
  430. ifdef CONFIG_WPS_UPNP
  431. CFLAGS += -DCONFIG_WPS_UPNP
  432. OBJS += ../src/wps/wps_upnp.o
  433. OBJS += ../src/wps/wps_upnp_ssdp.o
  434. OBJS += ../src/wps/wps_upnp_web.o
  435. OBJS += ../src/wps/wps_upnp_event.o
  436. OBJS += ../src/wps/wps_upnp_ap.o
  437. OBJS += ../src/wps/upnp_xml.o
  438. OBJS += ../src/wps/httpread.o
  439. OBJS += ../src/wps/http_client.o
  440. OBJS += ../src/wps/http_server.o
  441. endif
  442. ifdef CONFIG_WPS_STRICT
  443. CFLAGS += -DCONFIG_WPS_STRICT
  444. OBJS += ../src/wps/wps_validate.o
  445. endif
  446. ifdef CONFIG_WPS_TESTING
  447. CFLAGS += -DCONFIG_WPS_TESTING
  448. endif
  449. endif
  450. ifdef CONFIG_EAP_IKEV2
  451. CFLAGS += -DEAP_SERVER_IKEV2
  452. OBJS += ../src/eap_server/eap_server_ikev2.o ../src/eap_server/ikev2.o
  453. OBJS += ../src/eap_common/eap_ikev2_common.o ../src/eap_common/ikev2_common.o
  454. NEED_DH_GROUPS=y
  455. NEED_DH_GROUPS_ALL=y
  456. NEED_MODEXP=y
  457. NEED_CIPHER=y
  458. endif
  459. ifdef CONFIG_EAP_TNC
  460. CFLAGS += -DEAP_SERVER_TNC
  461. OBJS += ../src/eap_server/eap_server_tnc.o
  462. OBJS += ../src/eap_server/tncs.o
  463. NEED_BASE64=y
  464. ifndef CONFIG_DRIVER_BSD
  465. LIBS += -ldl
  466. endif
  467. endif
  468. # Basic EAP functionality is needed for EAPOL
  469. OBJS += eap_register.o
  470. OBJS += ../src/eap_server/eap_server.o
  471. OBJS += ../src/eap_common/eap_common.o
  472. OBJS += ../src/eap_server/eap_server_methods.o
  473. OBJS += ../src/eap_server/eap_server_identity.o
  474. CFLAGS += -DEAP_SERVER_IDENTITY
  475. ifdef CONFIG_EAP
  476. CFLAGS += -DEAP_SERVER
  477. endif
  478. ifdef CONFIG_PKCS12
  479. CFLAGS += -DPKCS12_FUNCS
  480. endif
  481. ifdef MS_FUNCS
  482. OBJS += ../src/crypto/ms_funcs.o
  483. NEED_DES=y
  484. NEED_MD4=y
  485. endif
  486. ifdef CHAP
  487. OBJS += ../src/eap_common/chap.o
  488. endif
  489. ifdef TLS_FUNCS
  490. NEED_DES=y
  491. # Shared TLS functions (needed for EAP_TLS, EAP_PEAP, and EAP_TTLS)
  492. CFLAGS += -DEAP_TLS_FUNCS
  493. OBJS += ../src/eap_server/eap_server_tls_common.o
  494. NEED_TLS_PRF=y
  495. endif
  496. ifndef CONFIG_TLS
  497. CONFIG_TLS=openssl
  498. endif
  499. ifdef CONFIG_TLSV11
  500. CFLAGS += -DCONFIG_TLSV11
  501. endif
  502. ifdef CONFIG_TLSV12
  503. CFLAGS += -DCONFIG_TLSV12
  504. NEED_SHA256=y
  505. endif
  506. ifeq ($(CONFIG_TLS), openssl)
  507. ifdef TLS_FUNCS
  508. OBJS += ../src/crypto/tls_openssl.o
  509. OBJS += ../src/crypto/tls_openssl_ocsp.o
  510. LIBS += -lssl
  511. endif
  512. OBJS += ../src/crypto/crypto_openssl.o
  513. HOBJS += ../src/crypto/crypto_openssl.o
  514. ifdef NEED_FIPS186_2_PRF
  515. OBJS += ../src/crypto/fips_prf_openssl.o
  516. endif
  517. NEED_SHA256=y
  518. NEED_TLS_PRF_SHA256=y
  519. LIBS += -lcrypto
  520. LIBS_h += -lcrypto
  521. ifdef CONFIG_TLS_ADD_DL
  522. LIBS += -ldl
  523. LIBS_h += -ldl
  524. endif
  525. endif
  526. ifeq ($(CONFIG_TLS), gnutls)
  527. ifdef TLS_FUNCS
  528. OBJS += ../src/crypto/tls_gnutls.o
  529. LIBS += -lgnutls -lgpg-error
  530. endif
  531. OBJS += ../src/crypto/crypto_gnutls.o
  532. HOBJS += ../src/crypto/crypto_gnutls.o
  533. ifdef NEED_FIPS186_2_PRF
  534. OBJS += ../src/crypto/fips_prf_internal.o
  535. SHA1OBJS += ../src/crypto/sha1-internal.o
  536. endif
  537. LIBS += -lgcrypt
  538. LIBS_h += -lgcrypt
  539. CONFIG_INTERNAL_SHA256=y
  540. CONFIG_INTERNAL_RC4=y
  541. CONFIG_INTERNAL_DH_GROUP5=y
  542. endif
  543. ifeq ($(CONFIG_TLS), internal)
  544. ifndef CONFIG_CRYPTO
  545. CONFIG_CRYPTO=internal
  546. endif
  547. ifdef TLS_FUNCS
  548. OBJS += ../src/crypto/crypto_internal-rsa.o
  549. OBJS += ../src/crypto/tls_internal.o
  550. OBJS += ../src/tls/tlsv1_common.o
  551. OBJS += ../src/tls/tlsv1_record.o
  552. OBJS += ../src/tls/tlsv1_cred.o
  553. OBJS += ../src/tls/tlsv1_server.o
  554. OBJS += ../src/tls/tlsv1_server_write.o
  555. OBJS += ../src/tls/tlsv1_server_read.o
  556. OBJS += ../src/tls/asn1.o
  557. OBJS += ../src/tls/rsa.o
  558. OBJS += ../src/tls/x509v3.o
  559. OBJS += ../src/tls/pkcs1.o
  560. OBJS += ../src/tls/pkcs5.o
  561. OBJS += ../src/tls/pkcs8.o
  562. NEED_SHA256=y
  563. NEED_BASE64=y
  564. NEED_TLS_PRF=y
  565. ifdef CONFIG_TLSV12
  566. NEED_TLS_PRF_SHA256=y
  567. endif
  568. NEED_MODEXP=y
  569. NEED_CIPHER=y
  570. CFLAGS += -DCONFIG_TLS_INTERNAL
  571. CFLAGS += -DCONFIG_TLS_INTERNAL_SERVER
  572. endif
  573. ifdef NEED_CIPHER
  574. NEED_DES=y
  575. OBJS += ../src/crypto/crypto_internal-cipher.o
  576. endif
  577. ifdef NEED_MODEXP
  578. OBJS += ../src/crypto/crypto_internal-modexp.o
  579. OBJS += ../src/tls/bignum.o
  580. endif
  581. ifeq ($(CONFIG_CRYPTO), libtomcrypt)
  582. OBJS += ../src/crypto/crypto_libtomcrypt.o
  583. LIBS += -ltomcrypt -ltfm
  584. LIBS_h += -ltomcrypt -ltfm
  585. CONFIG_INTERNAL_SHA256=y
  586. CONFIG_INTERNAL_RC4=y
  587. CONFIG_INTERNAL_DH_GROUP5=y
  588. endif
  589. ifeq ($(CONFIG_CRYPTO), internal)
  590. OBJS += ../src/crypto/crypto_internal.o
  591. NEED_AES_DEC=y
  592. CFLAGS += -DCONFIG_CRYPTO_INTERNAL
  593. ifdef CONFIG_INTERNAL_LIBTOMMATH
  594. CFLAGS += -DCONFIG_INTERNAL_LIBTOMMATH
  595. ifdef CONFIG_INTERNAL_LIBTOMMATH_FAST
  596. CFLAGS += -DLTM_FAST
  597. endif
  598. else
  599. LIBS += -ltommath
  600. LIBS_h += -ltommath
  601. endif
  602. CONFIG_INTERNAL_AES=y
  603. CONFIG_INTERNAL_DES=y
  604. CONFIG_INTERNAL_SHA1=y
  605. CONFIG_INTERNAL_MD4=y
  606. CONFIG_INTERNAL_MD5=y
  607. CONFIG_INTERNAL_SHA256=y
  608. CONFIG_INTERNAL_SHA384=y
  609. CONFIG_INTERNAL_SHA512=y
  610. CONFIG_INTERNAL_RC4=y
  611. CONFIG_INTERNAL_DH_GROUP5=y
  612. endif
  613. ifeq ($(CONFIG_CRYPTO), cryptoapi)
  614. OBJS += ../src/crypto/crypto_cryptoapi.o
  615. OBJS_p += ../src/crypto/crypto_cryptoapi.o
  616. CFLAGS += -DCONFIG_CRYPTO_CRYPTOAPI
  617. CONFIG_INTERNAL_SHA256=y
  618. CONFIG_INTERNAL_RC4=y
  619. endif
  620. endif
  621. ifeq ($(CONFIG_TLS), none)
  622. ifdef TLS_FUNCS
  623. OBJS += ../src/crypto/tls_none.o
  624. CFLAGS += -DEAP_TLS_NONE
  625. CONFIG_INTERNAL_AES=y
  626. CONFIG_INTERNAL_SHA1=y
  627. CONFIG_INTERNAL_MD5=y
  628. endif
  629. OBJS += ../src/crypto/crypto_none.o
  630. OBJS_p += ../src/crypto/crypto_none.o
  631. CONFIG_INTERNAL_SHA256=y
  632. CONFIG_INTERNAL_RC4=y
  633. endif
  634. ifndef TLS_FUNCS
  635. OBJS += ../src/crypto/tls_none.o
  636. ifeq ($(CONFIG_TLS), internal)
  637. CONFIG_INTERNAL_AES=y
  638. CONFIG_INTERNAL_SHA1=y
  639. CONFIG_INTERNAL_MD5=y
  640. CONFIG_INTERNAL_RC4=y
  641. endif
  642. endif
  643. AESOBJS = # none so far
  644. ifdef CONFIG_INTERNAL_AES
  645. AESOBJS += ../src/crypto/aes-internal.o ../src/crypto/aes-internal-enc.o
  646. endif
  647. ifneq ($(CONFIG_TLS), openssl)
  648. AESOBJS += ../src/crypto/aes-wrap.o
  649. endif
  650. ifdef NEED_AES_EAX
  651. AESOBJS += ../src/crypto/aes-eax.o
  652. NEED_AES_CTR=y
  653. endif
  654. ifdef NEED_AES_CTR
  655. AESOBJS += ../src/crypto/aes-ctr.o
  656. endif
  657. ifdef NEED_AES_ENCBLOCK
  658. AESOBJS += ../src/crypto/aes-encblock.o
  659. endif
  660. ifdef NEED_AES_OMAC1
  661. AESOBJS += ../src/crypto/aes-omac1.o
  662. endif
  663. ifdef NEED_AES_UNWRAP
  664. ifneq ($(CONFIG_TLS), openssl)
  665. NEED_AES_DEC=y
  666. AESOBJS += ../src/crypto/aes-unwrap.o
  667. endif
  668. endif
  669. ifdef NEED_AES_CBC
  670. NEED_AES_DEC=y
  671. ifneq ($(CONFIG_TLS), openssl)
  672. AESOBJS += ../src/crypto/aes-cbc.o
  673. endif
  674. endif
  675. ifdef NEED_AES_DEC
  676. ifdef CONFIG_INTERNAL_AES
  677. AESOBJS += ../src/crypto/aes-internal-dec.o
  678. endif
  679. endif
  680. ifdef NEED_AES
  681. OBJS += $(AESOBJS)
  682. endif
  683. ifdef NEED_SHA1
  684. ifneq ($(CONFIG_TLS), openssl)
  685. SHA1OBJS += ../src/crypto/sha1.o
  686. endif
  687. SHA1OBJS += ../src/crypto/sha1-prf.o
  688. ifdef CONFIG_INTERNAL_SHA1
  689. SHA1OBJS += ../src/crypto/sha1-internal.o
  690. ifdef NEED_FIPS186_2_PRF
  691. SHA1OBJS += ../src/crypto/fips_prf_internal.o
  692. endif
  693. endif
  694. ifneq ($(CONFIG_TLS), openssl)
  695. SHA1OBJS += ../src/crypto/sha1-pbkdf2.o
  696. endif
  697. ifdef NEED_T_PRF
  698. SHA1OBJS += ../src/crypto/sha1-tprf.o
  699. endif
  700. ifdef NEED_TLS_PRF
  701. SHA1OBJS += ../src/crypto/sha1-tlsprf.o
  702. endif
  703. endif
  704. ifdef NEED_SHA1
  705. OBJS += $(SHA1OBJS)
  706. endif
  707. ifneq ($(CONFIG_TLS), openssl)
  708. OBJS += ../src/crypto/md5.o
  709. endif
  710. ifdef NEED_MD5
  711. ifdef CONFIG_INTERNAL_MD5
  712. OBJS += ../src/crypto/md5-internal.o
  713. HOBJS += ../src/crypto/md5-internal.o
  714. endif
  715. endif
  716. ifdef NEED_MD4
  717. ifdef CONFIG_INTERNAL_MD4
  718. OBJS += ../src/crypto/md4-internal.o
  719. endif
  720. endif
  721. ifdef NEED_DES
  722. ifdef CONFIG_INTERNAL_DES
  723. OBJS += ../src/crypto/des-internal.o
  724. endif
  725. endif
  726. ifdef CONFIG_NO_RC4
  727. CFLAGS += -DCONFIG_NO_RC4
  728. endif
  729. ifdef NEED_RC4
  730. ifdef CONFIG_INTERNAL_RC4
  731. ifndef CONFIG_NO_RC4
  732. OBJS += ../src/crypto/rc4.o
  733. endif
  734. endif
  735. endif
  736. ifdef NEED_SHA256
  737. CFLAGS += -DCONFIG_SHA256
  738. ifneq ($(CONFIG_TLS), openssl)
  739. OBJS += ../src/crypto/sha256.o
  740. endif
  741. OBJS += ../src/crypto/sha256-prf.o
  742. ifdef CONFIG_INTERNAL_SHA256
  743. OBJS += ../src/crypto/sha256-internal.o
  744. endif
  745. ifdef NEED_TLS_PRF_SHA256
  746. OBJS += ../src/crypto/sha256-tlsprf.o
  747. endif
  748. ifdef NEED_HMAC_SHA256_KDF
  749. OBJS += ../src/crypto/sha256-kdf.o
  750. endif
  751. endif
  752. ifdef NEED_SHA384
  753. CFLAGS += -DCONFIG_SHA384
  754. OBJS += ../src/crypto/sha384-prf.o
  755. endif
  756. ifdef CONFIG_INTERNAL_SHA384
  757. CFLAGS += -DCONFIG_INTERNAL_SHA384
  758. OBJS += ../src/crypto/sha384-internal.o
  759. endif
  760. ifdef CONFIG_INTERNAL_SHA512
  761. CFLAGS += -DCONFIG_INTERNAL_SHA512
  762. OBJS += ../src/crypto/sha512-internal.o
  763. endif
  764. ifdef NEED_DH_GROUPS
  765. OBJS += ../src/crypto/dh_groups.o
  766. endif
  767. ifdef NEED_DH_GROUPS_ALL
  768. CFLAGS += -DALL_DH_GROUPS
  769. endif
  770. ifdef CONFIG_INTERNAL_DH_GROUP5
  771. ifdef NEED_DH_GROUPS
  772. OBJS += ../src/crypto/dh_group5.o
  773. endif
  774. endif
  775. ifdef NEED_ECC
  776. CFLAGS += -DCONFIG_ECC
  777. endif
  778. ifdef CONFIG_NO_RANDOM_POOL
  779. CFLAGS += -DCONFIG_NO_RANDOM_POOL
  780. else
  781. OBJS += ../src/crypto/random.o
  782. HOBJS += ../src/crypto/random.o
  783. HOBJS += ../src/utils/eloop.o
  784. HOBJS += $(SHA1OBJS)
  785. ifneq ($(CONFIG_TLS), openssl)
  786. HOBJS += ../src/crypto/md5.o
  787. endif
  788. endif
  789. ifdef CONFIG_RADIUS_SERVER
  790. CFLAGS += -DRADIUS_SERVER
  791. OBJS += ../src/radius/radius_server.o
  792. endif
  793. ifdef CONFIG_IPV6
  794. CFLAGS += -DCONFIG_IPV6
  795. endif
  796. ifdef CONFIG_DRIVER_RADIUS_ACL
  797. CFLAGS += -DCONFIG_DRIVER_RADIUS_ACL
  798. endif
  799. ifdef NEED_BASE64
  800. OBJS += ../src/utils/base64.o
  801. endif
  802. ifdef NEED_AP_MLME
  803. OBJS += ../src/ap/wmm.o
  804. OBJS += ../src/ap/ap_list.o
  805. OBJS += ../src/ap/ieee802_11.o
  806. OBJS += ../src/ap/hw_features.o
  807. OBJS += ../src/ap/dfs.o
  808. CFLAGS += -DNEED_AP_MLME
  809. endif
  810. ifdef CONFIG_IEEE80211N
  811. OBJS += ../src/ap/ieee802_11_ht.o
  812. endif
  813. ifdef CONFIG_IEEE80211AC
  814. OBJS += ../src/ap/ieee802_11_vht.o
  815. endif
  816. ifdef CONFIG_P2P_MANAGER
  817. CFLAGS += -DCONFIG_P2P_MANAGER
  818. OBJS += ../src/ap/p2p_hostapd.o
  819. endif
  820. ifdef CONFIG_HS20
  821. CFLAGS += -DCONFIG_HS20
  822. OBJS += ../src/ap/hs20.o
  823. CONFIG_INTERWORKING=y
  824. endif
  825. ifdef CONFIG_INTERWORKING
  826. CFLAGS += -DCONFIG_INTERWORKING
  827. OBJS += ../src/common/gas.o
  828. OBJS += ../src/ap/gas_serv.o
  829. endif
  830. ifdef CONFIG_PROXYARP
  831. CFLAGS += -DCONFIG_PROXYARP
  832. OBJS += ../src/ap/x_snoop.o
  833. OBJS += ../src/ap/dhcp_snoop.o
  834. ifdef CONFIG_IPV6
  835. OBJS += ../src/ap/ndisc_snoop.o
  836. endif
  837. endif
  838. OBJS += ../src/drivers/driver_common.o
  839. ifdef CONFIG_WPA_CLI_EDIT
  840. OBJS_c += ../src/utils/edit.o
  841. else
  842. OBJS_c += ../src/utils/edit_simple.o
  843. endif
  844. ifdef CONFIG_ACS
  845. CFLAGS += -DCONFIG_ACS
  846. OBJS += ../src/ap/acs.o
  847. LIBS += -lm
  848. endif
  849. ifdef CONFIG_NO_STDOUT_DEBUG
  850. CFLAGS += -DCONFIG_NO_STDOUT_DEBUG
  851. endif
  852. ifdef CONFIG_DEBUG_LINUX_TRACING
  853. CFLAGS += -DCONFIG_DEBUG_LINUX_TRACING
  854. endif
  855. ifdef CONFIG_DEBUG_FILE
  856. CFLAGS += -DCONFIG_DEBUG_FILE
  857. endif
  858. ifdef CONFIG_SQLITE
  859. CFLAGS += -DCONFIG_SQLITE
  860. LIBS += -lsqlite3
  861. LIBS_h += -lsqlite3
  862. endif
  863. ifdef CONFIG_FST
  864. CFLAGS += -DCONFIG_FST
  865. OBJS += ../src/fst/fst.o
  866. OBJS += ../src/fst/fst_group.o
  867. OBJS += ../src/fst/fst_iface.o
  868. OBJS += ../src/fst/fst_session.o
  869. OBJS += ../src/fst/fst_ctrl_aux.o
  870. ifdef CONFIG_FST_TEST
  871. CFLAGS += -DCONFIG_FST_TEST
  872. endif
  873. ifndef CONFIG_NO_CTRL_IFACE
  874. OBJS += ../src/fst/fst_ctrl_iface.o
  875. endif
  876. endif
  877. ALL=hostapd hostapd_cli
  878. all: verify_config $(ALL)
  879. Q=@
  880. E=echo
  881. ifeq ($(V), 1)
  882. Q=
  883. E=true
  884. endif
  885. ifeq ($(QUIET), 1)
  886. Q=@
  887. E=true
  888. endif
  889. ifdef CONFIG_CODE_COVERAGE
  890. %.o: %.c
  891. @$(E) " CC " $<
  892. $(Q)cd $(dir $@); $(CC) -c -o $(notdir $@) $(CFLAGS) $(notdir $<)
  893. else
  894. %.o: %.c
  895. $(Q)$(CC) -c -o $@ $(CFLAGS) $<
  896. @$(E) " CC " $<
  897. endif
  898. verify_config:
  899. @if [ ! -r .config ]; then \
  900. echo 'Building hostapd requires a configuration file'; \
  901. echo '(.config). See README for more instructions. You can'; \
  902. echo 'run "cp defconfig .config" to create an example'; \
  903. echo 'configuration.'; \
  904. exit 1; \
  905. fi
  906. $(DESTDIR)$(BINDIR)/%: %
  907. install -D $(<) $(@)
  908. install: $(addprefix $(DESTDIR)$(BINDIR)/,$(ALL))
  909. ../src/drivers/build.hostapd:
  910. @if [ -f ../src/drivers/build.wpa_supplicant ]; then \
  911. $(MAKE) -C ../src/drivers clean; \
  912. fi
  913. @touch ../src/drivers/build.hostapd
  914. BCHECK=../src/drivers/build.hostapd
  915. hostapd: $(BCHECK) $(OBJS)
  916. $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS)
  917. @$(E) " LD " $@
  918. ifdef CONFIG_WPA_TRACE
  919. OBJS_c += ../src/utils/trace.o
  920. endif
  921. hostapd_cli: $(OBJS_c)
  922. $(Q)$(CC) $(LDFLAGS) -o hostapd_cli $(OBJS_c) $(LIBS_c)
  923. @$(E) " LD " $@
  924. NOBJS = nt_password_hash.o ../src/crypto/ms_funcs.o $(SHA1OBJS)
  925. NOBJS += ../src/utils/common.o
  926. ifdef NEED_RC4
  927. ifdef CONFIG_INTERNAL_RC4
  928. ifndef CONFIG_NO_RC4
  929. NOBJS += ../src/crypto/rc4.o
  930. endif
  931. endif
  932. endif
  933. ifdef CONFIG_INTERNAL_MD5
  934. NOBJS += ../src/crypto/md5-internal.o
  935. endif
  936. NOBJS += ../src/crypto/crypto_openssl.o ../src/utils/os_$(CONFIG_OS).o
  937. NOBJS += ../src/utils/wpa_debug.o
  938. NOBJS += ../src/utils/wpabuf.o
  939. ifdef CONFIG_WPA_TRACE
  940. NOBJS += ../src/utils/trace.o
  941. LIBS_n += -lbfd
  942. endif
  943. ifdef TLS_FUNCS
  944. LIBS_n += -lcrypto
  945. endif
  946. HOBJS += hlr_auc_gw.o ../src/utils/common.o ../src/utils/wpa_debug.o ../src/utils/os_$(CONFIG_OS).o ../src/utils/wpabuf.o ../src/crypto/milenage.o
  947. HOBJS += ../src/crypto/aes-encblock.o
  948. ifdef CONFIG_INTERNAL_AES
  949. HOBJS += ../src/crypto/aes-internal.o
  950. HOBJS += ../src/crypto/aes-internal-enc.o
  951. endif
  952. nt_password_hash: $(NOBJS)
  953. $(Q)$(CC) $(LDFLAGS) -o nt_password_hash $(NOBJS) $(LIBS_n)
  954. @$(E) " LD " $@
  955. hlr_auc_gw: $(HOBJS)
  956. $(Q)$(CC) $(LDFLAGS) -o hlr_auc_gw $(HOBJS) $(LIBS_h)
  957. @$(E) " LD " $@
  958. lcov-html:
  959. lcov -c -d .. > lcov.info
  960. genhtml lcov.info --output-directory lcov-html
  961. clean:
  962. $(MAKE) -C ../src clean
  963. rm -f core *~ *.o hostapd hostapd_cli nt_password_hash hlr_auc_gw
  964. rm -f *.d *.gcno *.gcda *.gcov
  965. rm -f lcov.info
  966. rm -rf lcov-html
  967. -include $(OBJS:%.o=%.d)