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