Makefile 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143
  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 -DCONFIG_IEEE80211R_AP
  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. OBJS += ../src/ap/fils_hlp.o
  266. NEED_SHA384=y
  267. NEED_AES_SIV=y
  268. endif
  269. ifdef CONFIG_WNM
  270. CFLAGS += -DCONFIG_WNM
  271. OBJS += ../src/ap/wnm_ap.o
  272. endif
  273. ifdef CONFIG_IEEE80211N
  274. CFLAGS += -DCONFIG_IEEE80211N
  275. endif
  276. ifdef CONFIG_IEEE80211AC
  277. CFLAGS += -DCONFIG_IEEE80211AC
  278. endif
  279. ifdef CONFIG_IEEE80211AX
  280. CFLAGS += -DCONFIG_IEEE80211AX
  281. endif
  282. ifdef CONFIG_MBO
  283. CFLAGS += -DCONFIG_MBO
  284. OBJS += ../src/ap/mbo_ap.o
  285. endif
  286. include ../src/drivers/drivers.mak
  287. OBJS += $(DRV_AP_OBJS)
  288. CFLAGS += $(DRV_AP_CFLAGS)
  289. LDFLAGS += $(DRV_AP_LDFLAGS)
  290. LIBS += $(DRV_AP_LIBS)
  291. ifdef CONFIG_L2_PACKET
  292. ifdef CONFIG_DNET_PCAP
  293. ifdef CONFIG_L2_FREEBSD
  294. LIBS += -lpcap
  295. OBJS += ../src/l2_packet/l2_packet_freebsd.o
  296. else
  297. LIBS += -ldnet -lpcap
  298. OBJS += ../src/l2_packet/l2_packet_pcap.o
  299. endif
  300. else
  301. OBJS += ../src/l2_packet/l2_packet_linux.o
  302. endif
  303. else
  304. OBJS += ../src/l2_packet/l2_packet_none.o
  305. endif
  306. ifdef CONFIG_ERP
  307. CFLAGS += -DCONFIG_ERP
  308. NEED_SHA256=y
  309. NEED_HMAC_SHA256_KDF=y
  310. endif
  311. ifdef CONFIG_EAP_MD5
  312. CFLAGS += -DEAP_SERVER_MD5
  313. OBJS += ../src/eap_server/eap_server_md5.o
  314. CHAP=y
  315. endif
  316. ifdef CONFIG_EAP_TLS
  317. CFLAGS += -DEAP_SERVER_TLS
  318. OBJS += ../src/eap_server/eap_server_tls.o
  319. TLS_FUNCS=y
  320. endif
  321. ifdef CONFIG_EAP_UNAUTH_TLS
  322. CFLAGS += -DEAP_SERVER_UNAUTH_TLS
  323. ifndef CONFIG_EAP_TLS
  324. OBJS += ../src/eap_server/eap_server_tls.o
  325. TLS_FUNCS=y
  326. endif
  327. endif
  328. ifdef CONFIG_EAP_PEAP
  329. CFLAGS += -DEAP_SERVER_PEAP
  330. OBJS += ../src/eap_server/eap_server_peap.o
  331. OBJS += ../src/eap_common/eap_peap_common.o
  332. TLS_FUNCS=y
  333. CONFIG_EAP_MSCHAPV2=y
  334. endif
  335. ifdef CONFIG_EAP_TTLS
  336. CFLAGS += -DEAP_SERVER_TTLS
  337. OBJS += ../src/eap_server/eap_server_ttls.o
  338. TLS_FUNCS=y
  339. CHAP=y
  340. endif
  341. ifdef CONFIG_EAP_MSCHAPV2
  342. CFLAGS += -DEAP_SERVER_MSCHAPV2
  343. OBJS += ../src/eap_server/eap_server_mschapv2.o
  344. MS_FUNCS=y
  345. endif
  346. ifdef CONFIG_EAP_GTC
  347. CFLAGS += -DEAP_SERVER_GTC
  348. OBJS += ../src/eap_server/eap_server_gtc.o
  349. endif
  350. ifdef CONFIG_EAP_SIM
  351. CFLAGS += -DEAP_SERVER_SIM
  352. OBJS += ../src/eap_server/eap_server_sim.o
  353. CONFIG_EAP_SIM_COMMON=y
  354. NEED_AES_CBC=y
  355. endif
  356. ifdef CONFIG_EAP_AKA
  357. CFLAGS += -DEAP_SERVER_AKA
  358. OBJS += ../src/eap_server/eap_server_aka.o
  359. CONFIG_EAP_SIM_COMMON=y
  360. NEED_SHA256=y
  361. NEED_AES_CBC=y
  362. endif
  363. ifdef CONFIG_EAP_AKA_PRIME
  364. CFLAGS += -DEAP_SERVER_AKA_PRIME
  365. endif
  366. ifdef CONFIG_EAP_SIM_COMMON
  367. OBJS += ../src/eap_common/eap_sim_common.o
  368. # Example EAP-SIM/AKA interface for GSM/UMTS authentication. This can be
  369. # replaced with another file implementating the interface specified in
  370. # eap_sim_db.h.
  371. OBJS += ../src/eap_server/eap_sim_db.o
  372. NEED_FIPS186_2_PRF=y
  373. endif
  374. ifdef CONFIG_EAP_PAX
  375. CFLAGS += -DEAP_SERVER_PAX
  376. OBJS += ../src/eap_server/eap_server_pax.o ../src/eap_common/eap_pax_common.o
  377. endif
  378. ifdef CONFIG_EAP_PSK
  379. CFLAGS += -DEAP_SERVER_PSK
  380. OBJS += ../src/eap_server/eap_server_psk.o ../src/eap_common/eap_psk_common.o
  381. NEED_AES_OMAC1=y
  382. NEED_AES_ENCBLOCK=y
  383. NEED_AES_EAX=y
  384. endif
  385. ifdef CONFIG_EAP_SAKE
  386. CFLAGS += -DEAP_SERVER_SAKE
  387. OBJS += ../src/eap_server/eap_server_sake.o ../src/eap_common/eap_sake_common.o
  388. endif
  389. ifdef CONFIG_EAP_GPSK
  390. CFLAGS += -DEAP_SERVER_GPSK
  391. OBJS += ../src/eap_server/eap_server_gpsk.o ../src/eap_common/eap_gpsk_common.o
  392. ifdef CONFIG_EAP_GPSK_SHA256
  393. CFLAGS += -DEAP_GPSK_SHA256
  394. endif
  395. NEED_SHA256=y
  396. NEED_AES_OMAC1=y
  397. endif
  398. ifdef CONFIG_EAP_PWD
  399. CFLAGS += -DEAP_SERVER_PWD
  400. OBJS += ../src/eap_server/eap_server_pwd.o ../src/eap_common/eap_pwd_common.o
  401. NEED_SHA256=y
  402. endif
  403. ifdef CONFIG_EAP_EKE
  404. CFLAGS += -DEAP_SERVER_EKE
  405. OBJS += ../src/eap_server/eap_server_eke.o ../src/eap_common/eap_eke_common.o
  406. NEED_DH_GROUPS=y
  407. NEED_DH_GROUPS_ALL=y
  408. endif
  409. ifdef CONFIG_EAP_VENDOR_TEST
  410. CFLAGS += -DEAP_SERVER_VENDOR_TEST
  411. OBJS += ../src/eap_server/eap_server_vendor_test.o
  412. endif
  413. ifdef CONFIG_EAP_FAST
  414. CFLAGS += -DEAP_SERVER_FAST
  415. OBJS += ../src/eap_server/eap_server_fast.o
  416. OBJS += ../src/eap_common/eap_fast_common.o
  417. TLS_FUNCS=y
  418. NEED_T_PRF=y
  419. NEED_AES_UNWRAP=y
  420. endif
  421. ifdef CONFIG_WPS
  422. CFLAGS += -DCONFIG_WPS -DEAP_SERVER_WSC
  423. OBJS += ../src/utils/uuid.o
  424. OBJS += ../src/ap/wps_hostapd.o
  425. OBJS += ../src/eap_server/eap_server_wsc.o ../src/eap_common/eap_wsc_common.o
  426. OBJS += ../src/wps/wps.o
  427. OBJS += ../src/wps/wps_common.o
  428. OBJS += ../src/wps/wps_attr_parse.o
  429. OBJS += ../src/wps/wps_attr_build.o
  430. OBJS += ../src/wps/wps_attr_process.o
  431. OBJS += ../src/wps/wps_dev_attr.o
  432. OBJS += ../src/wps/wps_enrollee.o
  433. OBJS += ../src/wps/wps_registrar.o
  434. NEED_DH_GROUPS=y
  435. NEED_SHA256=y
  436. NEED_BASE64=y
  437. NEED_AES_CBC=y
  438. NEED_MODEXP=y
  439. CONFIG_EAP=y
  440. ifdef CONFIG_WPS_NFC
  441. CFLAGS += -DCONFIG_WPS_NFC
  442. OBJS += ../src/wps/ndef.o
  443. NEED_WPS_OOB=y
  444. endif
  445. ifdef NEED_WPS_OOB
  446. CFLAGS += -DCONFIG_WPS_OOB
  447. endif
  448. ifdef CONFIG_WPS_UPNP
  449. CFLAGS += -DCONFIG_WPS_UPNP
  450. OBJS += ../src/wps/wps_upnp.o
  451. OBJS += ../src/wps/wps_upnp_ssdp.o
  452. OBJS += ../src/wps/wps_upnp_web.o
  453. OBJS += ../src/wps/wps_upnp_event.o
  454. OBJS += ../src/wps/wps_upnp_ap.o
  455. OBJS += ../src/wps/upnp_xml.o
  456. OBJS += ../src/wps/httpread.o
  457. OBJS += ../src/wps/http_client.o
  458. OBJS += ../src/wps/http_server.o
  459. endif
  460. ifdef CONFIG_WPS_STRICT
  461. CFLAGS += -DCONFIG_WPS_STRICT
  462. OBJS += ../src/wps/wps_validate.o
  463. endif
  464. ifdef CONFIG_WPS_TESTING
  465. CFLAGS += -DCONFIG_WPS_TESTING
  466. endif
  467. endif
  468. ifdef CONFIG_EAP_IKEV2
  469. CFLAGS += -DEAP_SERVER_IKEV2
  470. OBJS += ../src/eap_server/eap_server_ikev2.o ../src/eap_server/ikev2.o
  471. OBJS += ../src/eap_common/eap_ikev2_common.o ../src/eap_common/ikev2_common.o
  472. NEED_DH_GROUPS=y
  473. NEED_DH_GROUPS_ALL=y
  474. NEED_MODEXP=y
  475. NEED_CIPHER=y
  476. endif
  477. ifdef CONFIG_EAP_TNC
  478. CFLAGS += -DEAP_SERVER_TNC
  479. OBJS += ../src/eap_server/eap_server_tnc.o
  480. OBJS += ../src/eap_server/tncs.o
  481. NEED_BASE64=y
  482. ifndef CONFIG_DRIVER_BSD
  483. LIBS += -ldl
  484. endif
  485. endif
  486. # Basic EAP functionality is needed for EAPOL
  487. OBJS += eap_register.o
  488. OBJS += ../src/eap_server/eap_server.o
  489. OBJS += ../src/eap_common/eap_common.o
  490. OBJS += ../src/eap_server/eap_server_methods.o
  491. OBJS += ../src/eap_server/eap_server_identity.o
  492. CFLAGS += -DEAP_SERVER_IDENTITY
  493. ifdef CONFIG_EAP
  494. CFLAGS += -DEAP_SERVER
  495. endif
  496. ifdef CONFIG_PKCS12
  497. CFLAGS += -DPKCS12_FUNCS
  498. endif
  499. ifdef MS_FUNCS
  500. OBJS += ../src/crypto/ms_funcs.o
  501. NEED_DES=y
  502. NEED_MD4=y
  503. endif
  504. ifdef CHAP
  505. OBJS += ../src/eap_common/chap.o
  506. endif
  507. ifdef TLS_FUNCS
  508. NEED_DES=y
  509. # Shared TLS functions (needed for EAP_TLS, EAP_PEAP, and EAP_TTLS)
  510. CFLAGS += -DEAP_TLS_FUNCS
  511. OBJS += ../src/eap_server/eap_server_tls_common.o
  512. NEED_TLS_PRF=y
  513. endif
  514. ifndef CONFIG_TLS
  515. CONFIG_TLS=openssl
  516. endif
  517. ifdef CONFIG_TLSV11
  518. CFLAGS += -DCONFIG_TLSV11
  519. endif
  520. ifdef CONFIG_TLSV12
  521. CFLAGS += -DCONFIG_TLSV12
  522. NEED_SHA256=y
  523. endif
  524. ifeq ($(CONFIG_TLS), openssl)
  525. ifdef TLS_FUNCS
  526. OBJS += ../src/crypto/tls_openssl.o
  527. OBJS += ../src/crypto/tls_openssl_ocsp.o
  528. LIBS += -lssl
  529. endif
  530. OBJS += ../src/crypto/crypto_openssl.o
  531. HOBJS += ../src/crypto/crypto_openssl.o
  532. ifdef NEED_FIPS186_2_PRF
  533. OBJS += ../src/crypto/fips_prf_openssl.o
  534. endif
  535. NEED_SHA256=y
  536. NEED_TLS_PRF_SHA256=y
  537. LIBS += -lcrypto
  538. LIBS_h += -lcrypto
  539. ifdef CONFIG_TLS_ADD_DL
  540. LIBS += -ldl
  541. LIBS_h += -ldl
  542. endif
  543. endif
  544. ifeq ($(CONFIG_TLS), gnutls)
  545. ifdef TLS_FUNCS
  546. OBJS += ../src/crypto/tls_gnutls.o
  547. LIBS += -lgnutls -lgpg-error
  548. endif
  549. OBJS += ../src/crypto/crypto_gnutls.o
  550. HOBJS += ../src/crypto/crypto_gnutls.o
  551. ifdef NEED_FIPS186_2_PRF
  552. OBJS += ../src/crypto/fips_prf_internal.o
  553. SHA1OBJS += ../src/crypto/sha1-internal.o
  554. endif
  555. LIBS += -lgcrypt
  556. LIBS_h += -lgcrypt
  557. CONFIG_INTERNAL_SHA256=y
  558. CONFIG_INTERNAL_RC4=y
  559. CONFIG_INTERNAL_DH_GROUP5=y
  560. endif
  561. ifeq ($(CONFIG_TLS), internal)
  562. ifndef CONFIG_CRYPTO
  563. CONFIG_CRYPTO=internal
  564. endif
  565. ifdef TLS_FUNCS
  566. OBJS += ../src/crypto/crypto_internal-rsa.o
  567. OBJS += ../src/crypto/tls_internal.o
  568. OBJS += ../src/tls/tlsv1_common.o
  569. OBJS += ../src/tls/tlsv1_record.o
  570. OBJS += ../src/tls/tlsv1_cred.o
  571. OBJS += ../src/tls/tlsv1_server.o
  572. OBJS += ../src/tls/tlsv1_server_write.o
  573. OBJS += ../src/tls/tlsv1_server_read.o
  574. OBJS += ../src/tls/asn1.o
  575. OBJS += ../src/tls/rsa.o
  576. OBJS += ../src/tls/x509v3.o
  577. OBJS += ../src/tls/pkcs1.o
  578. OBJS += ../src/tls/pkcs5.o
  579. OBJS += ../src/tls/pkcs8.o
  580. NEED_SHA256=y
  581. NEED_BASE64=y
  582. NEED_TLS_PRF=y
  583. ifdef CONFIG_TLSV12
  584. NEED_TLS_PRF_SHA256=y
  585. endif
  586. NEED_MODEXP=y
  587. NEED_CIPHER=y
  588. CFLAGS += -DCONFIG_TLS_INTERNAL
  589. CFLAGS += -DCONFIG_TLS_INTERNAL_SERVER
  590. endif
  591. ifdef NEED_CIPHER
  592. NEED_DES=y
  593. OBJS += ../src/crypto/crypto_internal-cipher.o
  594. endif
  595. ifdef NEED_MODEXP
  596. OBJS += ../src/crypto/crypto_internal-modexp.o
  597. OBJS += ../src/tls/bignum.o
  598. endif
  599. ifeq ($(CONFIG_CRYPTO), libtomcrypt)
  600. OBJS += ../src/crypto/crypto_libtomcrypt.o
  601. LIBS += -ltomcrypt -ltfm
  602. LIBS_h += -ltomcrypt -ltfm
  603. CONFIG_INTERNAL_SHA256=y
  604. CONFIG_INTERNAL_RC4=y
  605. CONFIG_INTERNAL_DH_GROUP5=y
  606. endif
  607. ifeq ($(CONFIG_CRYPTO), internal)
  608. OBJS += ../src/crypto/crypto_internal.o
  609. NEED_AES_DEC=y
  610. CFLAGS += -DCONFIG_CRYPTO_INTERNAL
  611. ifdef CONFIG_INTERNAL_LIBTOMMATH
  612. CFLAGS += -DCONFIG_INTERNAL_LIBTOMMATH
  613. ifdef CONFIG_INTERNAL_LIBTOMMATH_FAST
  614. CFLAGS += -DLTM_FAST
  615. endif
  616. else
  617. LIBS += -ltommath
  618. LIBS_h += -ltommath
  619. endif
  620. CONFIG_INTERNAL_AES=y
  621. CONFIG_INTERNAL_DES=y
  622. CONFIG_INTERNAL_SHA1=y
  623. CONFIG_INTERNAL_MD4=y
  624. CONFIG_INTERNAL_MD5=y
  625. CONFIG_INTERNAL_SHA256=y
  626. CONFIG_INTERNAL_SHA384=y
  627. CONFIG_INTERNAL_SHA512=y
  628. CONFIG_INTERNAL_RC4=y
  629. CONFIG_INTERNAL_DH_GROUP5=y
  630. endif
  631. ifeq ($(CONFIG_CRYPTO), cryptoapi)
  632. OBJS += ../src/crypto/crypto_cryptoapi.o
  633. OBJS_p += ../src/crypto/crypto_cryptoapi.o
  634. CFLAGS += -DCONFIG_CRYPTO_CRYPTOAPI
  635. CONFIG_INTERNAL_SHA256=y
  636. CONFIG_INTERNAL_RC4=y
  637. endif
  638. endif
  639. ifeq ($(CONFIG_TLS), none)
  640. ifdef TLS_FUNCS
  641. OBJS += ../src/crypto/tls_none.o
  642. CFLAGS += -DEAP_TLS_NONE
  643. CONFIG_INTERNAL_AES=y
  644. CONFIG_INTERNAL_SHA1=y
  645. CONFIG_INTERNAL_MD5=y
  646. endif
  647. OBJS += ../src/crypto/crypto_none.o
  648. OBJS_p += ../src/crypto/crypto_none.o
  649. CONFIG_INTERNAL_SHA256=y
  650. CONFIG_INTERNAL_RC4=y
  651. endif
  652. ifndef TLS_FUNCS
  653. OBJS += ../src/crypto/tls_none.o
  654. ifeq ($(CONFIG_TLS), internal)
  655. CONFIG_INTERNAL_AES=y
  656. CONFIG_INTERNAL_SHA1=y
  657. CONFIG_INTERNAL_MD5=y
  658. CONFIG_INTERNAL_RC4=y
  659. endif
  660. endif
  661. AESOBJS = # none so far
  662. ifdef CONFIG_INTERNAL_AES
  663. AESOBJS += ../src/crypto/aes-internal.o ../src/crypto/aes-internal-enc.o
  664. endif
  665. ifneq ($(CONFIG_TLS), openssl)
  666. AESOBJS += ../src/crypto/aes-wrap.o
  667. endif
  668. ifdef NEED_AES_EAX
  669. AESOBJS += ../src/crypto/aes-eax.o
  670. NEED_AES_CTR=y
  671. endif
  672. ifdef NEED_AES_CTR
  673. AESOBJS += ../src/crypto/aes-ctr.o
  674. endif
  675. ifdef NEED_AES_ENCBLOCK
  676. AESOBJS += ../src/crypto/aes-encblock.o
  677. endif
  678. ifdef NEED_AES_OMAC1
  679. AESOBJS += ../src/crypto/aes-omac1.o
  680. endif
  681. ifdef NEED_AES_UNWRAP
  682. ifneq ($(CONFIG_TLS), openssl)
  683. NEED_AES_DEC=y
  684. AESOBJS += ../src/crypto/aes-unwrap.o
  685. endif
  686. endif
  687. ifdef NEED_AES_CBC
  688. NEED_AES_DEC=y
  689. ifneq ($(CONFIG_TLS), openssl)
  690. AESOBJS += ../src/crypto/aes-cbc.o
  691. endif
  692. endif
  693. ifdef NEED_AES_SIV
  694. AESOBJS += ../src/crypto/aes-siv.o
  695. endif
  696. ifdef NEED_AES_DEC
  697. ifdef CONFIG_INTERNAL_AES
  698. AESOBJS += ../src/crypto/aes-internal-dec.o
  699. endif
  700. endif
  701. ifdef NEED_AES
  702. OBJS += $(AESOBJS)
  703. endif
  704. ifdef NEED_SHA1
  705. ifneq ($(CONFIG_TLS), openssl)
  706. SHA1OBJS += ../src/crypto/sha1.o
  707. endif
  708. SHA1OBJS += ../src/crypto/sha1-prf.o
  709. ifdef CONFIG_INTERNAL_SHA1
  710. SHA1OBJS += ../src/crypto/sha1-internal.o
  711. ifdef NEED_FIPS186_2_PRF
  712. SHA1OBJS += ../src/crypto/fips_prf_internal.o
  713. endif
  714. endif
  715. ifneq ($(CONFIG_TLS), openssl)
  716. SHA1OBJS += ../src/crypto/sha1-pbkdf2.o
  717. endif
  718. ifdef NEED_T_PRF
  719. SHA1OBJS += ../src/crypto/sha1-tprf.o
  720. endif
  721. ifdef NEED_TLS_PRF
  722. SHA1OBJS += ../src/crypto/sha1-tlsprf.o
  723. endif
  724. endif
  725. ifdef NEED_SHA1
  726. OBJS += $(SHA1OBJS)
  727. endif
  728. ifneq ($(CONFIG_TLS), openssl)
  729. OBJS += ../src/crypto/md5.o
  730. endif
  731. ifdef NEED_MD5
  732. ifdef CONFIG_INTERNAL_MD5
  733. OBJS += ../src/crypto/md5-internal.o
  734. HOBJS += ../src/crypto/md5-internal.o
  735. endif
  736. endif
  737. ifdef NEED_MD4
  738. ifdef CONFIG_INTERNAL_MD4
  739. OBJS += ../src/crypto/md4-internal.o
  740. endif
  741. endif
  742. ifdef NEED_DES
  743. ifdef CONFIG_INTERNAL_DES
  744. OBJS += ../src/crypto/des-internal.o
  745. endif
  746. endif
  747. ifdef CONFIG_NO_RC4
  748. CFLAGS += -DCONFIG_NO_RC4
  749. endif
  750. ifdef NEED_RC4
  751. ifdef CONFIG_INTERNAL_RC4
  752. ifndef CONFIG_NO_RC4
  753. OBJS += ../src/crypto/rc4.o
  754. endif
  755. endif
  756. endif
  757. ifdef NEED_SHA256
  758. CFLAGS += -DCONFIG_SHA256
  759. ifneq ($(CONFIG_TLS), openssl)
  760. OBJS += ../src/crypto/sha256.o
  761. endif
  762. OBJS += ../src/crypto/sha256-prf.o
  763. ifdef CONFIG_INTERNAL_SHA256
  764. OBJS += ../src/crypto/sha256-internal.o
  765. endif
  766. ifdef NEED_TLS_PRF_SHA256
  767. OBJS += ../src/crypto/sha256-tlsprf.o
  768. endif
  769. ifdef NEED_HMAC_SHA256_KDF
  770. OBJS += ../src/crypto/sha256-kdf.o
  771. endif
  772. endif
  773. ifdef NEED_SHA384
  774. CFLAGS += -DCONFIG_SHA384
  775. ifneq ($(CONFIG_TLS), openssl)
  776. OBJS += ../src/crypto/sha384.o
  777. endif
  778. OBJS += ../src/crypto/sha384-prf.o
  779. endif
  780. ifdef CONFIG_INTERNAL_SHA384
  781. CFLAGS += -DCONFIG_INTERNAL_SHA384
  782. OBJS += ../src/crypto/sha384-internal.o
  783. endif
  784. ifdef CONFIG_INTERNAL_SHA512
  785. CFLAGS += -DCONFIG_INTERNAL_SHA512
  786. OBJS += ../src/crypto/sha512-internal.o
  787. endif
  788. ifdef NEED_DH_GROUPS
  789. OBJS += ../src/crypto/dh_groups.o
  790. endif
  791. ifdef NEED_DH_GROUPS_ALL
  792. CFLAGS += -DALL_DH_GROUPS
  793. endif
  794. ifdef CONFIG_INTERNAL_DH_GROUP5
  795. ifdef NEED_DH_GROUPS
  796. OBJS += ../src/crypto/dh_group5.o
  797. endif
  798. endif
  799. ifdef NEED_ECC
  800. CFLAGS += -DCONFIG_ECC
  801. endif
  802. ifdef CONFIG_NO_RANDOM_POOL
  803. CFLAGS += -DCONFIG_NO_RANDOM_POOL
  804. else
  805. OBJS += ../src/crypto/random.o
  806. HOBJS += ../src/crypto/random.o
  807. HOBJS += ../src/utils/eloop.o
  808. HOBJS += $(SHA1OBJS)
  809. ifneq ($(CONFIG_TLS), openssl)
  810. HOBJS += ../src/crypto/md5.o
  811. endif
  812. endif
  813. ifdef CONFIG_RADIUS_SERVER
  814. CFLAGS += -DRADIUS_SERVER
  815. OBJS += ../src/radius/radius_server.o
  816. endif
  817. ifdef CONFIG_IPV6
  818. CFLAGS += -DCONFIG_IPV6
  819. endif
  820. ifdef CONFIG_DRIVER_RADIUS_ACL
  821. CFLAGS += -DCONFIG_DRIVER_RADIUS_ACL
  822. endif
  823. ifdef NEED_BASE64
  824. OBJS += ../src/utils/base64.o
  825. endif
  826. ifdef NEED_AP_MLME
  827. OBJS += ../src/ap/wmm.o
  828. OBJS += ../src/ap/ap_list.o
  829. OBJS += ../src/ap/ieee802_11.o
  830. OBJS += ../src/ap/hw_features.o
  831. OBJS += ../src/ap/dfs.o
  832. CFLAGS += -DNEED_AP_MLME
  833. endif
  834. ifdef CONFIG_IEEE80211N
  835. OBJS += ../src/ap/ieee802_11_ht.o
  836. endif
  837. ifdef CONFIG_IEEE80211AC
  838. OBJS += ../src/ap/ieee802_11_vht.o
  839. endif
  840. ifdef CONFIG_P2P_MANAGER
  841. CFLAGS += -DCONFIG_P2P_MANAGER
  842. OBJS += ../src/ap/p2p_hostapd.o
  843. endif
  844. ifdef CONFIG_HS20
  845. CFLAGS += -DCONFIG_HS20
  846. OBJS += ../src/ap/hs20.o
  847. CONFIG_INTERWORKING=y
  848. endif
  849. ifdef CONFIG_INTERWORKING
  850. CFLAGS += -DCONFIG_INTERWORKING
  851. OBJS += ../src/common/gas.o
  852. OBJS += ../src/ap/gas_serv.o
  853. endif
  854. ifdef CONFIG_PROXYARP
  855. CFLAGS += -DCONFIG_PROXYARP
  856. OBJS += ../src/ap/x_snoop.o
  857. OBJS += ../src/ap/dhcp_snoop.o
  858. ifdef CONFIG_IPV6
  859. OBJS += ../src/ap/ndisc_snoop.o
  860. endif
  861. endif
  862. OBJS += ../src/drivers/driver_common.o
  863. ifdef CONFIG_WPA_CLI_EDIT
  864. OBJS_c += ../src/utils/edit.o
  865. else
  866. OBJS_c += ../src/utils/edit_simple.o
  867. endif
  868. ifdef CONFIG_ACS
  869. CFLAGS += -DCONFIG_ACS
  870. OBJS += ../src/ap/acs.o
  871. LIBS += -lm
  872. endif
  873. ifdef CONFIG_NO_STDOUT_DEBUG
  874. CFLAGS += -DCONFIG_NO_STDOUT_DEBUG
  875. endif
  876. ifdef CONFIG_DEBUG_SYSLOG
  877. CFLAGS += -DCONFIG_DEBUG_SYSLOG
  878. endif
  879. ifdef CONFIG_DEBUG_LINUX_TRACING
  880. CFLAGS += -DCONFIG_DEBUG_LINUX_TRACING
  881. endif
  882. ifdef CONFIG_DEBUG_FILE
  883. CFLAGS += -DCONFIG_DEBUG_FILE
  884. endif
  885. ifdef CONFIG_SQLITE
  886. CFLAGS += -DCONFIG_SQLITE
  887. LIBS += -lsqlite3
  888. LIBS_h += -lsqlite3
  889. endif
  890. ifdef CONFIG_FST
  891. CFLAGS += -DCONFIG_FST
  892. OBJS += ../src/fst/fst.o
  893. OBJS += ../src/fst/fst_group.o
  894. OBJS += ../src/fst/fst_iface.o
  895. OBJS += ../src/fst/fst_session.o
  896. OBJS += ../src/fst/fst_ctrl_aux.o
  897. ifdef CONFIG_FST_TEST
  898. CFLAGS += -DCONFIG_FST_TEST
  899. endif
  900. ifndef CONFIG_NO_CTRL_IFACE
  901. OBJS += ../src/fst/fst_ctrl_iface.o
  902. endif
  903. endif
  904. ALL=hostapd hostapd_cli
  905. all: verify_config $(ALL)
  906. Q=@
  907. E=echo
  908. ifeq ($(V), 1)
  909. Q=
  910. E=true
  911. endif
  912. ifeq ($(QUIET), 1)
  913. Q=@
  914. E=true
  915. endif
  916. ifdef CONFIG_CODE_COVERAGE
  917. %.o: %.c
  918. @$(E) " CC " $<
  919. $(Q)cd $(dir $@); $(CC) -c -o $(notdir $@) $(CFLAGS) $(notdir $<)
  920. else
  921. %.o: %.c
  922. $(Q)$(CC) -c -o $@ $(CFLAGS) $<
  923. @$(E) " CC " $<
  924. endif
  925. verify_config:
  926. @if [ ! -r .config ]; then \
  927. echo 'Building hostapd requires a configuration file'; \
  928. echo '(.config). See README for more instructions. You can'; \
  929. echo 'run "cp defconfig .config" to create an example'; \
  930. echo 'configuration.'; \
  931. exit 1; \
  932. fi
  933. $(DESTDIR)$(BINDIR)/%: %
  934. install -D $(<) $(@)
  935. install: $(addprefix $(DESTDIR)$(BINDIR)/,$(ALL))
  936. ../src/drivers/build.hostapd:
  937. @if [ -f ../src/drivers/build.wpa_supplicant ]; then \
  938. $(MAKE) -C ../src/drivers clean; \
  939. fi
  940. @touch ../src/drivers/build.hostapd
  941. BCHECK=../src/drivers/build.hostapd
  942. hostapd: $(BCHECK) $(OBJS)
  943. $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS)
  944. @$(E) " LD " $@
  945. ifdef CONFIG_WPA_TRACE
  946. OBJS_c += ../src/utils/trace.o
  947. endif
  948. hostapd_cli: $(OBJS_c)
  949. $(Q)$(CC) $(LDFLAGS) -o hostapd_cli $(OBJS_c) $(LIBS_c)
  950. @$(E) " LD " $@
  951. NOBJS = nt_password_hash.o ../src/crypto/ms_funcs.o $(SHA1OBJS)
  952. NOBJS += ../src/utils/common.o
  953. ifdef NEED_RC4
  954. ifdef CONFIG_INTERNAL_RC4
  955. ifndef CONFIG_NO_RC4
  956. NOBJS += ../src/crypto/rc4.o
  957. endif
  958. endif
  959. endif
  960. ifdef CONFIG_INTERNAL_MD5
  961. NOBJS += ../src/crypto/md5-internal.o
  962. endif
  963. NOBJS += ../src/crypto/crypto_openssl.o ../src/utils/os_$(CONFIG_OS).o
  964. NOBJS += ../src/utils/wpa_debug.o
  965. NOBJS += ../src/utils/wpabuf.o
  966. ifdef CONFIG_WPA_TRACE
  967. NOBJS += ../src/utils/trace.o
  968. LIBS_n += -lbfd
  969. endif
  970. ifdef TLS_FUNCS
  971. LIBS_n += -lcrypto
  972. endif
  973. 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
  974. HOBJS += ../src/crypto/aes-encblock.o
  975. ifdef CONFIG_INTERNAL_AES
  976. HOBJS += ../src/crypto/aes-internal.o
  977. HOBJS += ../src/crypto/aes-internal-enc.o
  978. endif
  979. nt_password_hash: $(NOBJS)
  980. $(Q)$(CC) $(LDFLAGS) -o nt_password_hash $(NOBJS) $(LIBS_n)
  981. @$(E) " LD " $@
  982. hlr_auc_gw: $(HOBJS)
  983. $(Q)$(CC) $(LDFLAGS) -o hlr_auc_gw $(HOBJS) $(LIBS_h)
  984. @$(E) " LD " $@
  985. lcov-html:
  986. lcov -c -d .. > lcov.info
  987. genhtml lcov.info --output-directory lcov-html
  988. clean:
  989. $(MAKE) -C ../src clean
  990. rm -f core *~ *.o hostapd hostapd_cli nt_password_hash hlr_auc_gw
  991. rm -f *.d *.gcno *.gcda *.gcov
  992. rm -f lcov.info
  993. rm -rf lcov-html
  994. -include $(OBJS:%.o=%.d)