Makefile 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750
  1. ifndef CC
  2. CC=gcc
  3. endif
  4. ifndef CFLAGS
  5. CFLAGS = -MMD -O2 -Wall -g
  6. endif
  7. CFLAGS += -I../src
  8. CFLAGS += -I../src/utils
  9. # Uncomment following line and set the path to your kernel tree include
  10. # directory if your C library does not include all header files.
  11. # CFLAGS += -DUSE_KERNEL_HEADERS -I/usr/src/linux/include
  12. -include .config
  13. ifndef CONFIG_OS
  14. ifdef CONFIG_NATIVE_WINDOWS
  15. CONFIG_OS=win32
  16. else
  17. CONFIG_OS=unix
  18. endif
  19. endif
  20. ifeq ($(CONFIG_OS), internal)
  21. CFLAGS += -DOS_NO_C_LIB_DEFINES
  22. endif
  23. ifdef CONFIG_NATIVE_WINDOWS
  24. CFLAGS += -DCONFIG_NATIVE_WINDOWS
  25. LIBS += -lws2_32
  26. endif
  27. OBJS = hostapd.o main.o ieee802_1x.o \
  28. config.o ieee802_11_auth.o \
  29. sta_info.o wpa.o \
  30. preauth.o pmksa_cache.o \
  31. drv_callbacks.o \
  32. tkip_countermeasures.o \
  33. mlme.o wpa_auth_ie.o
  34. NEED_RC4=y
  35. NEED_AES=y
  36. NEED_MD5=y
  37. NEED_SHA1=y
  38. OBJS += ../src/drivers/drivers.o
  39. OBJS += ../src/drivers/scan_helpers.o
  40. CFLAGS += -DHOSTAPD
  41. OBJS += ../src/utils/eloop.o
  42. OBJS += ../src/utils/common.o
  43. OBJS += ../src/utils/wpa_debug.o
  44. OBJS += ../src/utils/wpabuf.o
  45. OBJS += ../src/utils/os_$(CONFIG_OS).o
  46. OBJS += ../src/utils/ip_addr.o
  47. OBJS += ../src/common/ieee802_11_common.o
  48. OBJS += ../src/common/wpa_common.o
  49. OBJS += ../src/eapol_auth/eapol_auth_sm.o
  50. ifndef CONFIG_NO_DUMP_STATE
  51. # define HOSTAPD_DUMP_STATE to include SIGUSR1 handler for dumping state to
  52. # a file (undefine it, if you want to save in binary size)
  53. CFLAGS += -DHOSTAPD_DUMP_STATE
  54. OBJS += dump_state.o
  55. OBJS += ../src/eapol_auth/eapol_auth_dump.o
  56. endif
  57. ifdef CONFIG_NO_RADIUS
  58. CFLAGS += -DCONFIG_NO_RADIUS
  59. CONFIG_NO_ACCOUNTING=y
  60. else
  61. OBJS += ../src/radius/radius.o
  62. OBJS += ../src/radius/radius_client.o
  63. endif
  64. ifdef CONFIG_NO_ACCOUNTING
  65. CFLAGS += -DCONFIG_NO_ACCOUNTING
  66. else
  67. OBJS += accounting.o
  68. endif
  69. ifdef CONFIG_NO_VLAN
  70. CFLAGS += -DCONFIG_NO_VLAN
  71. else
  72. OBJS += vlan_init.o
  73. endif
  74. ifdef CONFIG_NO_CTRL_IFACE
  75. CFLAGS += -DCONFIG_NO_CTRL_IFACE
  76. else
  77. OBJS += ctrl_iface.o
  78. OBJS += ctrl_iface_ap.o
  79. endif
  80. OBJS += ../src/crypto/md5.o
  81. CFLAGS += -DCONFIG_CTRL_IFACE -DCONFIG_CTRL_IFACE_UNIX
  82. ifdef CONFIG_IAPP
  83. CFLAGS += -DCONFIG_IAPP
  84. OBJS += iapp.o
  85. endif
  86. ifdef CONFIG_RSN_PREAUTH
  87. CFLAGS += -DCONFIG_RSN_PREAUTH
  88. CONFIG_L2_PACKET=y
  89. endif
  90. ifdef CONFIG_PEERKEY
  91. CFLAGS += -DCONFIG_PEERKEY
  92. OBJS += peerkey.o
  93. endif
  94. ifdef CONFIG_IEEE80211W
  95. CFLAGS += -DCONFIG_IEEE80211W
  96. NEED_SHA256=y
  97. NEED_AES_OMAC1=y
  98. endif
  99. ifdef CONFIG_IEEE80211R
  100. CFLAGS += -DCONFIG_IEEE80211R
  101. OBJS += wpa_ft.o
  102. NEED_SHA256=y
  103. NEED_AES_OMAC1=y
  104. NEED_AES_UNWRAP=y
  105. endif
  106. ifdef CONFIG_IEEE80211N
  107. CFLAGS += -DCONFIG_IEEE80211N
  108. endif
  109. include ../src/drivers/drivers.mak
  110. OBJS += $(DRV_AP_OBJS)
  111. CFLAGS += $(DRV_AP_CFLAGS)
  112. LDFLAGS += $(DRV_AP_LDFLAGS)
  113. LIBS += $(DRV_AP_LIBS)
  114. ifdef CONFIG_L2_PACKET
  115. ifdef CONFIG_DNET_PCAP
  116. ifdef CONFIG_L2_FREEBSD
  117. LIBS += -lpcap
  118. OBJS += ../src/l2_packet/l2_packet_freebsd.o
  119. else
  120. LIBS += -ldnet -lpcap
  121. OBJS += ../src/l2_packet/l2_packet_pcap.o
  122. endif
  123. else
  124. OBJS += ../src/l2_packet/l2_packet_linux.o
  125. endif
  126. else
  127. OBJS += ../src/l2_packet/l2_packet_none.o
  128. endif
  129. ifdef CONFIG_EAP_MD5
  130. CFLAGS += -DEAP_SERVER_MD5
  131. OBJS += ../src/eap_server/eap_md5.o
  132. CHAP=y
  133. endif
  134. ifdef CONFIG_EAP_TLS
  135. CFLAGS += -DEAP_SERVER_TLS
  136. OBJS += ../src/eap_server/eap_tls.o
  137. TLS_FUNCS=y
  138. endif
  139. ifdef CONFIG_EAP_PEAP
  140. CFLAGS += -DEAP_SERVER_PEAP
  141. OBJS += ../src/eap_server/eap_peap.o
  142. OBJS += ../src/eap_common/eap_peap_common.o
  143. TLS_FUNCS=y
  144. CONFIG_EAP_MSCHAPV2=y
  145. endif
  146. ifdef CONFIG_EAP_TTLS
  147. CFLAGS += -DEAP_SERVER_TTLS
  148. OBJS += ../src/eap_server/eap_ttls.o
  149. TLS_FUNCS=y
  150. CHAP=y
  151. endif
  152. ifdef CONFIG_EAP_MSCHAPV2
  153. CFLAGS += -DEAP_SERVER_MSCHAPV2
  154. OBJS += ../src/eap_server/eap_mschapv2.o
  155. MS_FUNCS=y
  156. endif
  157. ifdef CONFIG_EAP_GTC
  158. CFLAGS += -DEAP_SERVER_GTC
  159. OBJS += ../src/eap_server/eap_gtc.o
  160. endif
  161. ifdef CONFIG_EAP_SIM
  162. CFLAGS += -DEAP_SERVER_SIM
  163. OBJS += ../src/eap_server/eap_sim.o
  164. CONFIG_EAP_SIM_COMMON=y
  165. NEED_AES_CBC=y
  166. endif
  167. ifdef CONFIG_EAP_AKA
  168. CFLAGS += -DEAP_SERVER_AKA
  169. OBJS += ../src/eap_server/eap_aka.o
  170. CONFIG_EAP_SIM_COMMON=y
  171. NEED_SHA256=y
  172. NEED_AES_CBC=y
  173. endif
  174. ifdef CONFIG_EAP_AKA_PRIME
  175. CFLAGS += -DEAP_SERVER_AKA_PRIME
  176. endif
  177. ifdef CONFIG_EAP_SIM_COMMON
  178. OBJS += ../src/eap_common/eap_sim_common.o
  179. # Example EAP-SIM/AKA interface for GSM/UMTS authentication. This can be
  180. # replaced with another file implementating the interface specified in
  181. # eap_sim_db.h.
  182. OBJS += ../src/eap_server/eap_sim_db.o
  183. NEED_FIPS186_2_PRF=y
  184. endif
  185. ifdef CONFIG_EAP_PAX
  186. CFLAGS += -DEAP_SERVER_PAX
  187. OBJS += ../src/eap_server/eap_pax.o ../src/eap_common/eap_pax_common.o
  188. endif
  189. ifdef CONFIG_EAP_PSK
  190. CFLAGS += -DEAP_SERVER_PSK
  191. OBJS += ../src/eap_server/eap_psk.o ../src/eap_common/eap_psk_common.o
  192. NEED_AES_OMAC1=y
  193. NEED_AES_ENCBLOCK=y
  194. NEED_AES_EAX=y
  195. endif
  196. ifdef CONFIG_EAP_SAKE
  197. CFLAGS += -DEAP_SERVER_SAKE
  198. OBJS += ../src/eap_server/eap_sake.o ../src/eap_common/eap_sake_common.o
  199. endif
  200. ifdef CONFIG_EAP_GPSK
  201. CFLAGS += -DEAP_SERVER_GPSK
  202. OBJS += ../src/eap_server/eap_gpsk.o ../src/eap_common/eap_gpsk_common.o
  203. ifdef CONFIG_EAP_GPSK_SHA256
  204. CFLAGS += -DEAP_SERVER_GPSK_SHA256
  205. endif
  206. NEED_SHA256=y
  207. NEED_AES_OMAC1=y
  208. endif
  209. ifdef CONFIG_EAP_VENDOR_TEST
  210. CFLAGS += -DEAP_SERVER_VENDOR_TEST
  211. OBJS += ../src/eap_server/eap_vendor_test.o
  212. endif
  213. ifdef CONFIG_EAP_FAST
  214. CFLAGS += -DEAP_SERVER_FAST
  215. OBJS += ../src/eap_server/eap_fast.o
  216. OBJS += ../src/eap_common/eap_fast_common.o
  217. TLS_FUNCS=y
  218. NEED_T_PRF=y
  219. NEED_AES_UNWRAP=y
  220. endif
  221. ifdef CONFIG_WPS
  222. CFLAGS += -DCONFIG_WPS -DEAP_SERVER_WSC
  223. OBJS += ../src/utils/uuid.o
  224. OBJS += wps_hostapd.o
  225. OBJS += ../src/eap_server/eap_wsc.o ../src/eap_common/eap_wsc_common.o
  226. OBJS += ../src/wps/wps.o
  227. OBJS += ../src/wps/wps_common.o
  228. OBJS += ../src/wps/wps_attr_parse.o
  229. OBJS += ../src/wps/wps_attr_build.o
  230. OBJS += ../src/wps/wps_attr_process.o
  231. OBJS += ../src/wps/wps_dev_attr.o
  232. OBJS += ../src/wps/wps_enrollee.o
  233. OBJS += ../src/wps/wps_registrar.o
  234. NEED_DH_GROUPS=y
  235. NEED_SHA256=y
  236. NEED_BASE64=y
  237. NEED_AES_CBC=y
  238. NEED_MODEXP=y
  239. ifdef CONFIG_WPS_UFD
  240. CFLAGS += -DCONFIG_WPS_UFD
  241. OBJS += ../src/wps/wps_ufd.o
  242. NEED_WPS_OOB=y
  243. endif
  244. ifdef CONFIG_WPS_NFC
  245. CFLAGS += -DCONFIG_WPS_NFC
  246. OBJS += ../src/wps/ndef.o
  247. OBJS += ../src/wps/wps_nfc.o
  248. NEED_WPS_OOB=y
  249. ifdef CONFIG_WPS_NFC_PN531
  250. PN531_PATH ?= /usr/local/src/nfc
  251. CFLAGS += -DCONFIG_WPS_NFC_PN531
  252. CFLAGS += -I${PN531_PATH}/inc
  253. OBJS += ../src/wps/wps_nfc_pn531.o
  254. LIBS += ${PN531_PATH}/lib/wpsnfc.dll
  255. LIBS += ${PN531_PATH}/lib/libnfc_mapping_pn53x.dll
  256. endif
  257. endif
  258. ifdef NEED_WPS_OOB
  259. CFLAGS += -DCONFIG_WPS_OOB
  260. endif
  261. ifdef CONFIG_WPS_UPNP
  262. CFLAGS += -DCONFIG_WPS_UPNP
  263. OBJS += ../src/wps/wps_upnp.o
  264. OBJS += ../src/wps/wps_upnp_ssdp.o
  265. OBJS += ../src/wps/wps_upnp_web.o
  266. OBJS += ../src/wps/wps_upnp_event.o
  267. OBJS += ../src/wps/upnp_xml.o
  268. OBJS += ../src/wps/httpread.o
  269. OBJS += ../src/wps/http_client.o
  270. OBJS += ../src/wps/http_server.o
  271. endif
  272. endif
  273. ifdef CONFIG_EAP_IKEV2
  274. CFLAGS += -DEAP_SERVER_IKEV2
  275. OBJS += ../src/eap_server/eap_ikev2.o ../src/eap_server/ikev2.o
  276. OBJS += ../src/eap_common/eap_ikev2_common.o ../src/eap_common/ikev2_common.o
  277. NEED_DH_GROUPS=y
  278. NEED_DH_GROUPS_ALL=y
  279. NEED_MODEXP=y
  280. NEED_CIPHER=y
  281. endif
  282. ifdef CONFIG_EAP_TNC
  283. CFLAGS += -DEAP_SERVER_TNC
  284. OBJS += ../src/eap_server/eap_tnc.o
  285. OBJS += ../src/eap_server/tncs.o
  286. NEED_BASE64=y
  287. ifndef CONFIG_DRIVER_BSD
  288. LIBS += -ldl
  289. endif
  290. endif
  291. # Basic EAP functionality is needed for EAPOL
  292. OBJS += eap_register.o
  293. OBJS += ../src/eap_server/eap.o
  294. OBJS += ../src/eap_common/eap_common.o
  295. OBJS += ../src/eap_server/eap_methods.o
  296. OBJS += ../src/eap_server/eap_identity.o
  297. CFLAGS += -DEAP_SERVER_IDENTITY
  298. ifdef CONFIG_EAP
  299. CFLAGS += -DEAP_SERVER
  300. endif
  301. ifdef CONFIG_PKCS12
  302. CFLAGS += -DPKCS12_FUNCS
  303. endif
  304. ifdef MS_FUNCS
  305. OBJS += ../src/crypto/ms_funcs.o
  306. NEED_DES=y
  307. NEED_MD4=y
  308. endif
  309. ifdef CHAP
  310. OBJS += ../src/eap_common/chap.o
  311. endif
  312. ifdef TLS_FUNCS
  313. NEED_DES=y
  314. # Shared TLS functions (needed for EAP_TLS, EAP_PEAP, and EAP_TTLS)
  315. CFLAGS += -DEAP_TLS_FUNCS
  316. OBJS += ../src/eap_server/eap_tls_common.o
  317. NEED_TLS_PRF=y
  318. endif
  319. ifndef CONFIG_TLS
  320. CONFIG_TLS=openssl
  321. endif
  322. ifeq ($(CONFIG_TLS), openssl)
  323. ifdef TLS_FUNCS
  324. OBJS += ../src/crypto/tls_openssl.o
  325. LIBS += -lssl
  326. endif
  327. OBJS += ../src/crypto/crypto_openssl.o
  328. HOBJS += ../src/crypto/crypto_openssl.o
  329. ifdef NEED_FIPS186_2_PRF
  330. OBJS += ../src/crypto/fips_prf_openssl.o
  331. endif
  332. LIBS += -lcrypto
  333. LIBS_h += -lcrypto
  334. endif
  335. ifeq ($(CONFIG_TLS), gnutls)
  336. ifdef TLS_FUNCS
  337. OBJS += ../src/crypto/tls_gnutls.o
  338. LIBS += -lgnutls -lgpg-error
  339. ifdef CONFIG_GNUTLS_EXTRA
  340. CFLAGS += -DCONFIG_GNUTLS_EXTRA
  341. LIBS += -lgnutls-extra
  342. endif
  343. endif
  344. OBJS += ../src/crypto/crypto_gnutls.o
  345. HOBJS += ../src/crypto/crypto_gnutls.o
  346. ifdef NEED_FIPS186_2_PRF
  347. OBJS += ../src/crypto/fips_prf_gnutls.o
  348. endif
  349. LIBS += -lgcrypt
  350. LIBS_h += -lgcrypt
  351. CONFIG_INTERNAL_SHA256=y
  352. CONFIG_INTERNAL_RC4=y
  353. CONFIG_INTERNAL_DH_GROUP5=y
  354. endif
  355. ifeq ($(CONFIG_TLS), schannel)
  356. ifdef TLS_FUNCS
  357. OBJS += ../src/crypto/tls_schannel.o
  358. endif
  359. OBJS += ../src/crypto/crypto_cryptoapi.o
  360. OBJS_p += ../src/crypto/crypto_cryptoapi.o
  361. CONFIG_INTERNAL_SHA256=y
  362. CONFIG_INTERNAL_RC4=y
  363. CONFIG_INTERNAL_DH_GROUP5=y
  364. endif
  365. ifeq ($(CONFIG_TLS), nss)
  366. ifdef TLS_FUNCS
  367. OBJS += ../src/crypto/tls_nss.o
  368. LIBS += -lssl3
  369. endif
  370. OBJS += ../src/crypto/crypto_nss.o
  371. ifdef NEED_FIPS186_2_PRF
  372. OBJS += ../src/crypto/fips_prf_nss.o
  373. endif
  374. LIBS += -lnss3
  375. LIBS_h += -lnss3
  376. CONFIG_INTERNAL_MD4=y
  377. CONFIG_INTERNAL_DH_GROUP5=y
  378. endif
  379. ifeq ($(CONFIG_TLS), internal)
  380. ifndef CONFIG_CRYPTO
  381. CONFIG_CRYPTO=internal
  382. endif
  383. ifdef TLS_FUNCS
  384. OBJS += ../src/crypto/crypto_internal-rsa.o
  385. OBJS += ../src/crypto/tls_internal.o
  386. OBJS += ../src/tls/tlsv1_common.o
  387. OBJS += ../src/tls/tlsv1_record.o
  388. OBJS += ../src/tls/tlsv1_cred.o
  389. OBJS += ../src/tls/tlsv1_server.o
  390. OBJS += ../src/tls/tlsv1_server_write.o
  391. OBJS += ../src/tls/tlsv1_server_read.o
  392. OBJS += ../src/tls/asn1.o
  393. OBJS += ../src/tls/rsa.o
  394. OBJS += ../src/tls/x509v3.o
  395. OBJS += ../src/tls/pkcs1.o
  396. OBJS += ../src/tls/pkcs5.o
  397. OBJS += ../src/tls/pkcs8.o
  398. NEED_SHA256=y
  399. NEED_BASE64=y
  400. NEED_TLS_PRF=y
  401. NEED_MODEXP=y
  402. NEED_CIPHER=y
  403. CFLAGS += -DCONFIG_TLS_INTERNAL
  404. CFLAGS += -DCONFIG_TLS_INTERNAL_SERVER
  405. endif
  406. ifdef NEED_CIPHER
  407. NEED_DES=y
  408. OBJS += ../src/crypto/crypto_internal-cipher.o
  409. endif
  410. ifdef NEED_MODEXP
  411. OBJS += ../src/crypto/crypto_internal-modexp.o
  412. OBJS += ../src/tls/bignum.o
  413. endif
  414. ifeq ($(CONFIG_CRYPTO), libtomcrypt)
  415. OBJS += ../src/crypto/crypto_libtomcrypt.o
  416. LIBS += -ltomcrypt -ltfm
  417. LIBS_h += -ltomcrypt -ltfm
  418. CONFIG_INTERNAL_SHA256=y
  419. CONFIG_INTERNAL_RC4=y
  420. CONFIG_INTERNAL_DH_GROUP5=y
  421. endif
  422. ifeq ($(CONFIG_CRYPTO), internal)
  423. OBJS += ../src/crypto/crypto_internal.o
  424. NEED_AES_DEC=y
  425. CFLAGS += -DCONFIG_CRYPTO_INTERNAL
  426. ifdef CONFIG_INTERNAL_LIBTOMMATH
  427. CFLAGS += -DCONFIG_INTERNAL_LIBTOMMATH
  428. ifdef CONFIG_INTERNAL_LIBTOMMATH_FAST
  429. CFLAGS += -DLTM_FAST
  430. endif
  431. else
  432. LIBS += -ltommath
  433. LIBS_h += -ltommath
  434. endif
  435. CONFIG_INTERNAL_AES=y
  436. CONFIG_INTERNAL_DES=y
  437. CONFIG_INTERNAL_SHA1=y
  438. CONFIG_INTERNAL_MD4=y
  439. CONFIG_INTERNAL_MD5=y
  440. CONFIG_INTERNAL_SHA256=y
  441. CONFIG_INTERNAL_RC4=y
  442. CONFIG_INTERNAL_DH_GROUP5=y
  443. endif
  444. ifeq ($(CONFIG_CRYPTO), cryptoapi)
  445. OBJS += ../src/crypto/crypto_cryptoapi.o
  446. OBJS_p += ../src/crypto/crypto_cryptoapi.o
  447. CFLAGS += -DCONFIG_CRYPTO_CRYPTOAPI
  448. CONFIG_INTERNAL_SHA256=y
  449. CONFIG_INTERNAL_RC4=y
  450. endif
  451. endif
  452. ifeq ($(CONFIG_TLS), none)
  453. ifdef TLS_FUNCS
  454. OBJS += ../src/crypto/tls_none.o
  455. CFLAGS += -DEAP_TLS_NONE
  456. CONFIG_INTERNAL_AES=y
  457. CONFIG_INTERNAL_SHA1=y
  458. CONFIG_INTERNAL_MD5=y
  459. endif
  460. OBJS += ../src/crypto/crypto_none.o
  461. OBJS_p += ../src/crypto/crypto_none.o
  462. CONFIG_INTERNAL_SHA256=y
  463. CONFIG_INTERNAL_RC4=y
  464. endif
  465. ifndef TLS_FUNCS
  466. OBJS += ../src/crypto/tls_none.o
  467. ifeq ($(CONFIG_TLS), internal)
  468. CONFIG_INTERNAL_AES=y
  469. CONFIG_INTERNAL_SHA1=y
  470. CONFIG_INTERNAL_MD5=y
  471. CONFIG_INTERNAL_RC4=y
  472. endif
  473. endif
  474. AESOBJS = # none so far
  475. ifdef CONFIG_INTERNAL_AES
  476. AESOBJS += ../src/crypto/aes-internal.o ../src/crypto/aes-internal-enc.o
  477. endif
  478. AESOBJS += ../src/crypto/aes-wrap.o
  479. ifdef NEED_AES_EAX
  480. AESOBJS += ../src/crypto/aes-eax.o
  481. NEED_AES_CTR=y
  482. endif
  483. ifdef NEED_AES_CTR
  484. AESOBJS += ../src/crypto/aes-ctr.o
  485. endif
  486. ifdef NEED_AES_ENCBLOCK
  487. AESOBJS += ../src/crypto/aes-encblock.o
  488. endif
  489. ifdef NEED_AES_OMAC1
  490. AESOBJS += ../src/crypto/aes-omac1.o
  491. endif
  492. ifdef NEED_AES_UNWRAP
  493. NEED_AES_DEC=y
  494. AESOBJS += ../src/crypto/aes-unwrap.o
  495. endif
  496. ifdef NEED_AES_CBC
  497. NEED_AES_DEC=y
  498. AESOBJS += ../src/crypto/aes-cbc.o
  499. endif
  500. ifdef NEED_AES_DEC
  501. ifdef CONFIG_INTERNAL_AES
  502. AESOBJS += ../src/crypto/aes-internal-dec.o
  503. endif
  504. endif
  505. ifdef NEED_AES
  506. OBJS += $(AESOBJS)
  507. endif
  508. ifdef NEED_SHA1
  509. SHA1OBJS += ../src/crypto/sha1.o
  510. ifdef CONFIG_INTERNAL_SHA1
  511. SHA1OBJS += ../src/crypto/sha1-internal.o
  512. ifdef NEED_FIPS186_2_PRF
  513. SHA1OBJS += ../src/crypto/fips_prf_internal.o
  514. endif
  515. endif
  516. SHA1OBJS += ../src/crypto/sha1-pbkdf2.o
  517. ifdef NEED_T_PRF
  518. SHA1OBJS += ../src/crypto/sha1-tprf.o
  519. endif
  520. ifdef NEED_TLS_PRF
  521. SHA1OBJS += ../src/crypto/sha1-tlsprf.o
  522. endif
  523. endif
  524. ifdef NEED_SHA1
  525. OBJS += $(SHA1OBJS)
  526. endif
  527. ifdef NEED_MD5
  528. ifdef CONFIG_INTERNAL_MD5
  529. OBJS += ../src/crypto/md5-internal.o
  530. endif
  531. endif
  532. ifdef NEED_MD4
  533. ifdef CONFIG_INTERNAL_MD4
  534. OBJS += ../src/crypto/md4-internal.o
  535. endif
  536. endif
  537. ifdef NEED_DES
  538. ifdef CONFIG_INTERNAL_DES
  539. OBJS += ../src/crypto/des-internal.o
  540. endif
  541. endif
  542. ifdef NEED_RC4
  543. ifdef CONFIG_INTERNAL_RC4
  544. OBJS += ../src/crypto/rc4.o
  545. endif
  546. endif
  547. ifdef NEED_SHA256
  548. OBJS += ../src/crypto/sha256.o
  549. ifdef CONFIG_INTERNAL_SHA256
  550. OBJS += ../src/crypto/sha256-internal.o
  551. endif
  552. endif
  553. ifdef CONFIG_INTERNAL_DH_GROUP5
  554. ifdef NEED_DH_GROUPS
  555. OBJS += ../src/crypto/dh_groups.o
  556. OBJS += ../src/crypto/dh_group5.o
  557. ifdef NEED_DH_GROUPS_ALL
  558. CFLAGS += -DALL_DH_GROUPS
  559. endif
  560. endif
  561. else
  562. ifdef NEED_DH_GROUPS_ALL
  563. OBJS += ../src/crypto/dh_groups.o
  564. CFLAGS += -DALL_DH_GROUPS
  565. endif
  566. endif
  567. ifdef CONFIG_RADIUS_SERVER
  568. CFLAGS += -DRADIUS_SERVER
  569. OBJS += ../src/radius/radius_server.o
  570. endif
  571. ifdef CONFIG_IPV6
  572. CFLAGS += -DCONFIG_IPV6
  573. endif
  574. ifdef CONFIG_DRIVER_RADIUS_ACL
  575. CFLAGS += -DCONFIG_DRIVER_RADIUS_ACL
  576. endif
  577. ifdef CONFIG_FULL_DYNAMIC_VLAN
  578. # define CONFIG_FULL_DYNAMIC_VLAN to have hostapd manipulate bridges
  579. # and vlan interfaces for the vlan feature.
  580. CFLAGS += -DCONFIG_FULL_DYNAMIC_VLAN
  581. endif
  582. ifdef NEED_BASE64
  583. OBJS += ../src/utils/base64.o
  584. endif
  585. ifdef NEED_AP_MLME
  586. OBJS += beacon.o wme.o ap_list.o ieee802_11.o
  587. OBJS += hw_features.o
  588. ifdef CONFIG_IEEE80211N
  589. OBJS += ieee802_11_ht.o
  590. endif
  591. CFLAGS += -DNEED_AP_MLME
  592. endif
  593. ifdef CONFIG_NO_STDOUT_DEBUG
  594. CFLAGS += -DCONFIG_NO_STDOUT_DEBUG
  595. endif
  596. ALL=hostapd hostapd_cli
  597. all: verify_config $(ALL)
  598. Q=@
  599. E=echo
  600. ifeq ($(V), 1)
  601. Q=
  602. E=true
  603. endif
  604. %.o: %.c
  605. $(Q)$(CC) -c -o $@ $(CFLAGS) $<
  606. @$(E) " CC " $<
  607. verify_config:
  608. @if [ ! -r .config ]; then \
  609. echo 'Building hostapd requires a configuration file'; \
  610. echo '(.config). See README for more instructions. You can'; \
  611. echo 'run "cp defconfig .config" to create an example'; \
  612. echo 'configuration.'; \
  613. exit 1; \
  614. fi
  615. install: all
  616. for i in $(ALL); do cp $$i /usr/local/bin/$$i; done
  617. ../src/drivers/build.hostapd:
  618. @if [ -e ../src/drivers/build.wpa_supplicant ]; then \
  619. $(MAKE) -C ../src/drivers clean; \
  620. fi
  621. @touch ../src/drivers/build.hostapd
  622. BCHECK=../src/drivers/build.hostapd
  623. hostapd: $(BCHECK) $(OBJS)
  624. $(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS)
  625. OBJS_c = hostapd_cli.o ../src/common/wpa_ctrl.o ../src/utils/os_$(CONFIG_OS).o
  626. hostapd_cli: $(OBJS_c)
  627. $(CC) $(LDFLAGS) -o hostapd_cli $(OBJS_c)
  628. NOBJS = nt_password_hash.o ../src/crypto/ms_funcs.o $(SHA1OBJS) ../src/crypto/rc4.o ../src/crypto/md5.o
  629. ifdef CONFIG_INTERNAL_MD5
  630. NOBJS += ../src/crypto/md5-internal.o
  631. endif
  632. NOBJS += ../src/crypto/crypto_openssl.o ../src/utils/os_$(CONFIG_OS).o
  633. ifdef TLS_FUNCS
  634. LIBS_n += -lcrypto
  635. endif
  636. 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
  637. HOBJS += ../src/crypto/aes-encblock.o
  638. ifdef CONFIG_INTERNAL_AES
  639. HOBJS += ../src/crypto/aes-internal.o
  640. HOBJS += ../src/crypto/aes-internal-enc.o
  641. endif
  642. nt_password_hash: $(NOBJS)
  643. $(CC) $(LDFLAGS) -o nt_password_hash $(NOBJS) $(LIBS_n)
  644. hlr_auc_gw: $(HOBJS)
  645. $(CC) $(LDFLAGS) -o hlr_auc_gw $(HOBJS) $(LIBS_h)
  646. clean:
  647. $(MAKE) -C ../src clean
  648. rm -f core *~ *.o hostapd hostapd_cli nt_password_hash hlr_auc_gw
  649. rm -f *.d
  650. -include $(OBJS:%.o=%.d)