Makefile 15 KB

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