Makefile 15 KB

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