Makefile 23 KB

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