Home | History | Annotate | Download | only in hostapd
      1 ifndef CC
      2 CC=gcc
      3 endif
      4 
      5 ifndef CFLAGS
      6 CFLAGS = -MMD -O2 -Wall -g
      7 endif
      8 
      9 CFLAGS += -I../src
     10 CFLAGS += -I../src/utils
     11 
     12 # Uncomment following line and set the path to your kernel tree include
     13 # directory if your C library does not include all header files.
     14 # CFLAGS += -DUSE_KERNEL_HEADERS -I/usr/src/linux/include
     15 
     16 -include .config
     17 
     18 ifndef CONFIG_OS
     19 ifdef CONFIG_NATIVE_WINDOWS
     20 CONFIG_OS=win32
     21 else
     22 CONFIG_OS=unix
     23 endif
     24 endif
     25 
     26 ifeq ($(CONFIG_OS), internal)
     27 CFLAGS += -DOS_NO_C_LIB_DEFINES
     28 endif
     29 
     30 ifdef CONFIG_NATIVE_WINDOWS
     31 CFLAGS += -DCONFIG_NATIVE_WINDOWS
     32 LIBS += -lws2_32
     33 endif
     34 
     35 OBJS += main.o
     36 OBJS += config_file.o
     37 
     38 OBJS += ../src/ap/hostapd.o
     39 OBJS += ../src/ap/wpa_auth_glue.o
     40 OBJS += ../src/ap/drv_callbacks.o
     41 OBJS += ../src/ap/ap_drv_ops.o
     42 OBJS += ../src/ap/utils.o
     43 OBJS += ../src/ap/authsrv.o
     44 OBJS += ../src/ap/ieee802_1x.o
     45 OBJS += ../src/ap/ap_config.o
     46 OBJS += ../src/ap/eap_user_db.o
     47 OBJS += ../src/ap/ieee802_11_auth.o
     48 OBJS += ../src/ap/sta_info.o
     49 OBJS += ../src/ap/wpa_auth.o
     50 OBJS += ../src/ap/tkip_countermeasures.o
     51 OBJS += ../src/ap/ap_mlme.o
     52 OBJS += ../src/ap/wpa_auth_ie.o
     53 OBJS += ../src/ap/preauth_auth.o
     54 OBJS += ../src/ap/pmksa_cache_auth.o
     55 OBJS += ../src/ap/ieee802_11_shared.o
     56 OBJS += ../src/ap/beacon.o
     57 
     58 OBJS_c = hostapd_cli.o ../src/common/wpa_ctrl.o ../src/utils/os_$(CONFIG_OS).o
     59 
     60 NEED_RC4=y
     61 NEED_AES=y
     62 NEED_MD5=y
     63 NEED_SHA1=y
     64 
     65 OBJS += ../src/drivers/drivers.o
     66 CFLAGS += -DHOSTAPD
     67 
     68 ifdef CONFIG_WPA_TRACE
     69 CFLAGS += -DWPA_TRACE
     70 OBJS += ../src/utils/trace.o
     71 HOBJS += ../src/utils/trace.o
     72 LDFLAGS += -rdynamic
     73 CFLAGS += -funwind-tables
     74 ifdef CONFIG_WPA_TRACE_BFD
     75 CFLAGS += -DWPA_TRACE_BFD
     76 LIBS += -lbfd
     77 LIBS_c += -lbfd
     78 LIBS_h += -lbfd
     79 endif
     80 endif
     81 
     82 ifndef CONFIG_ELOOP
     83 CONFIG_ELOOP=eloop
     84 endif
     85 OBJS += ../src/utils/$(CONFIG_ELOOP).o
     86 OBJS_c += ../src/utils/$(CONFIG_ELOOP).o
     87 OBJS += ../src/utils/common.o
     88 OBJS += ../src/utils/wpa_debug.o
     89 OBJS_c += ../src/utils/wpa_debug.o
     90 OBJS += ../src/utils/wpabuf.o
     91 OBJS += ../src/utils/os_$(CONFIG_OS).o
     92 OBJS += ../src/utils/ip_addr.o
     93 
     94 OBJS += ../src/common/ieee802_11_common.o
     95 OBJS += ../src/common/wpa_common.o
     96 
     97 OBJS += ../src/eapol_auth/eapol_auth_sm.o
     98 
     99 
    100 ifndef CONFIG_NO_DUMP_STATE
    101 # define HOSTAPD_DUMP_STATE to include SIGUSR1 handler for dumping state to
    102 # a file (undefine it, if you want to save in binary size)
    103 CFLAGS += -DHOSTAPD_DUMP_STATE
    104 OBJS += dump_state.o
    105 OBJS += ../src/eapol_auth/eapol_auth_dump.o
    106 endif
    107 
    108 ifdef CONFIG_NO_RADIUS
    109 CFLAGS += -DCONFIG_NO_RADIUS
    110 CONFIG_NO_ACCOUNTING=y
    111 else
    112 OBJS += ../src/radius/radius.o
    113 OBJS += ../src/radius/radius_client.o
    114 OBJS += ../src/radius/radius_das.o
    115 endif
    116 
    117 ifdef CONFIG_NO_ACCOUNTING
    118 CFLAGS += -DCONFIG_NO_ACCOUNTING
    119 else
    120 OBJS += ../src/ap/accounting.o
    121 endif
    122 
    123 ifdef CONFIG_NO_VLAN
    124 CFLAGS += -DCONFIG_NO_VLAN
    125 else
    126 OBJS += ../src/ap/vlan_init.o
    127 ifdef CONFIG_VLAN_NETLINK
    128 ifdef CONFIG_FULL_DYNAMIC_VLAN
    129 OBJS += ../src/ap/vlan_util.o
    130 endif
    131 CFLAGS += -DCONFIG_VLAN_NETLINK
    132 endif
    133 endif
    134 
    135 ifdef CONFIG_NO_CTRL_IFACE
    136 CFLAGS += -DCONFIG_NO_CTRL_IFACE
    137 else
    138 OBJS += ctrl_iface.o
    139 OBJS += ../src/ap/ctrl_iface_ap.o
    140 endif
    141 
    142 OBJS += ../src/crypto/md5.o
    143 
    144 CFLAGS += -DCONFIG_CTRL_IFACE -DCONFIG_CTRL_IFACE_UNIX
    145 
    146 ifdef CONFIG_IAPP
    147 CFLAGS += -DCONFIG_IAPP
    148 OBJS += ../src/ap/iapp.o
    149 endif
    150 
    151 ifdef CONFIG_RSN_PREAUTH
    152 CFLAGS += -DCONFIG_RSN_PREAUTH
    153 CONFIG_L2_PACKET=y
    154 endif
    155 
    156 ifdef CONFIG_PEERKEY
    157 CFLAGS += -DCONFIG_PEERKEY
    158 OBJS += ../src/ap/peerkey_auth.o
    159 endif
    160 
    161 ifdef CONFIG_IEEE80211W
    162 CFLAGS += -DCONFIG_IEEE80211W
    163 NEED_SHA256=y
    164 NEED_AES_OMAC1=y
    165 endif
    166 
    167 ifdef CONFIG_IEEE80211R
    168 CFLAGS += -DCONFIG_IEEE80211R
    169 OBJS += ../src/ap/wpa_auth_ft.o
    170 NEED_SHA256=y
    171 NEED_AES_OMAC1=y
    172 NEED_AES_UNWRAP=y
    173 endif
    174 
    175 ifdef CONFIG_SAE
    176 CFLAGS += -DCONFIG_SAE
    177 OBJS += ../src/common/sae.o
    178 NEED_ECC=y
    179 NEED_DH_GROUPS=y
    180 endif
    181 
    182 ifdef CONFIG_WNM
    183 CFLAGS += -DCONFIG_WNM
    184 OBJS += ../src/ap/wnm_ap.o
    185 endif
    186 
    187 ifdef CONFIG_IEEE80211N
    188 CFLAGS += -DCONFIG_IEEE80211N
    189 endif
    190 
    191 ifdef CONFIG_IEEE80211AC
    192 CFLAGS += -DCONFIG_IEEE80211AC
    193 endif
    194 
    195 include ../src/drivers/drivers.mak
    196 OBJS += $(DRV_AP_OBJS)
    197 CFLAGS += $(DRV_AP_CFLAGS)
    198 LDFLAGS += $(DRV_AP_LDFLAGS)
    199 LIBS += $(DRV_AP_LIBS)
    200 
    201 ifdef CONFIG_L2_PACKET
    202 ifdef CONFIG_DNET_PCAP
    203 ifdef CONFIG_L2_FREEBSD
    204 LIBS += -lpcap
    205 OBJS += ../src/l2_packet/l2_packet_freebsd.o
    206 else
    207 LIBS += -ldnet -lpcap
    208 OBJS += ../src/l2_packet/l2_packet_pcap.o
    209 endif
    210 else
    211 OBJS += ../src/l2_packet/l2_packet_linux.o
    212 endif
    213 else
    214 OBJS += ../src/l2_packet/l2_packet_none.o
    215 endif
    216 
    217 
    218 ifdef CONFIG_EAP_MD5
    219 CFLAGS += -DEAP_SERVER_MD5
    220 OBJS += ../src/eap_server/eap_server_md5.o
    221 CHAP=y
    222 endif
    223 
    224 ifdef CONFIG_EAP_TLS
    225 CFLAGS += -DEAP_SERVER_TLS
    226 OBJS += ../src/eap_server/eap_server_tls.o
    227 TLS_FUNCS=y
    228 endif
    229 
    230 ifdef CONFIG_EAP_UNAUTH_TLS
    231 CFLAGS += -DEAP_SERVER_UNAUTH_TLS
    232 ifndef CONFIG_EAP_TLS
    233 OBJS += ../src/eap_server/eap_server_tls.o
    234 TLS_FUNCS=y
    235 endif
    236 endif
    237 
    238 ifdef CONFIG_EAP_PEAP
    239 CFLAGS += -DEAP_SERVER_PEAP
    240 OBJS += ../src/eap_server/eap_server_peap.o
    241 OBJS += ../src/eap_common/eap_peap_common.o
    242 TLS_FUNCS=y
    243 CONFIG_EAP_MSCHAPV2=y
    244 endif
    245 
    246 ifdef CONFIG_EAP_TTLS
    247 CFLAGS += -DEAP_SERVER_TTLS
    248 OBJS += ../src/eap_server/eap_server_ttls.o
    249 TLS_FUNCS=y
    250 CHAP=y
    251 endif
    252 
    253 ifdef CONFIG_EAP_MSCHAPV2
    254 CFLAGS += -DEAP_SERVER_MSCHAPV2
    255 OBJS += ../src/eap_server/eap_server_mschapv2.o
    256 MS_FUNCS=y
    257 endif
    258 
    259 ifdef CONFIG_EAP_GTC
    260 CFLAGS += -DEAP_SERVER_GTC
    261 OBJS += ../src/eap_server/eap_server_gtc.o
    262 endif
    263 
    264 ifdef CONFIG_EAP_SIM
    265 CFLAGS += -DEAP_SERVER_SIM
    266 OBJS += ../src/eap_server/eap_server_sim.o
    267 CONFIG_EAP_SIM_COMMON=y
    268 NEED_AES_CBC=y
    269 endif
    270 
    271 ifdef CONFIG_EAP_AKA
    272 CFLAGS += -DEAP_SERVER_AKA
    273 OBJS += ../src/eap_server/eap_server_aka.o
    274 CONFIG_EAP_SIM_COMMON=y
    275 NEED_SHA256=y
    276 NEED_AES_CBC=y
    277 endif
    278 
    279 ifdef CONFIG_EAP_AKA_PRIME
    280 CFLAGS += -DEAP_SERVER_AKA_PRIME
    281 endif
    282 
    283 ifdef CONFIG_EAP_SIM_COMMON
    284 OBJS += ../src/eap_common/eap_sim_common.o
    285 # Example EAP-SIM/AKA interface for GSM/UMTS authentication. This can be
    286 # replaced with another file implementating the interface specified in
    287 # eap_sim_db.h.
    288 OBJS += ../src/eap_server/eap_sim_db.o
    289 NEED_FIPS186_2_PRF=y
    290 endif
    291 
    292 ifdef CONFIG_EAP_PAX
    293 CFLAGS += -DEAP_SERVER_PAX
    294 OBJS += ../src/eap_server/eap_server_pax.o ../src/eap_common/eap_pax_common.o
    295 endif
    296 
    297 ifdef CONFIG_EAP_PSK
    298 CFLAGS += -DEAP_SERVER_PSK
    299 OBJS += ../src/eap_server/eap_server_psk.o ../src/eap_common/eap_psk_common.o
    300 NEED_AES_OMAC1=y
    301 NEED_AES_ENCBLOCK=y
    302 NEED_AES_EAX=y
    303 endif
    304 
    305 ifdef CONFIG_EAP_SAKE
    306 CFLAGS += -DEAP_SERVER_SAKE
    307 OBJS += ../src/eap_server/eap_server_sake.o ../src/eap_common/eap_sake_common.o
    308 endif
    309 
    310 ifdef CONFIG_EAP_GPSK
    311 CFLAGS += -DEAP_SERVER_GPSK
    312 OBJS += ../src/eap_server/eap_server_gpsk.o ../src/eap_common/eap_gpsk_common.o
    313 ifdef CONFIG_EAP_GPSK_SHA256
    314 CFLAGS += -DEAP_SERVER_GPSK_SHA256
    315 endif
    316 NEED_SHA256=y
    317 NEED_AES_OMAC1=y
    318 endif
    319 
    320 ifdef CONFIG_EAP_PWD
    321 CFLAGS += -DEAP_SERVER_PWD
    322 OBJS += ../src/eap_server/eap_server_pwd.o ../src/eap_common/eap_pwd_common.o
    323 NEED_SHA256=y
    324 endif
    325 
    326 ifdef CONFIG_EAP_VENDOR_TEST
    327 CFLAGS += -DEAP_SERVER_VENDOR_TEST
    328 OBJS += ../src/eap_server/eap_server_vendor_test.o
    329 endif
    330 
    331 ifdef CONFIG_EAP_FAST
    332 CFLAGS += -DEAP_SERVER_FAST
    333 OBJS += ../src/eap_server/eap_server_fast.o
    334 OBJS += ../src/eap_common/eap_fast_common.o
    335 TLS_FUNCS=y
    336 NEED_T_PRF=y
    337 NEED_AES_UNWRAP=y
    338 endif
    339 
    340 ifdef CONFIG_WPS
    341 ifdef CONFIG_WPS2
    342 CFLAGS += -DCONFIG_WPS2
    343 endif
    344 
    345 CFLAGS += -DCONFIG_WPS -DEAP_SERVER_WSC
    346 OBJS += ../src/utils/uuid.o
    347 OBJS += ../src/ap/wps_hostapd.o
    348 OBJS += ../src/eap_server/eap_server_wsc.o ../src/eap_common/eap_wsc_common.o
    349 OBJS += ../src/wps/wps.o
    350 OBJS += ../src/wps/wps_common.o
    351 OBJS += ../src/wps/wps_attr_parse.o
    352 OBJS += ../src/wps/wps_attr_build.o
    353 OBJS += ../src/wps/wps_attr_process.o
    354 OBJS += ../src/wps/wps_dev_attr.o
    355 OBJS += ../src/wps/wps_enrollee.o
    356 OBJS += ../src/wps/wps_registrar.o
    357 NEED_DH_GROUPS=y
    358 NEED_SHA256=y
    359 NEED_BASE64=y
    360 NEED_AES_CBC=y
    361 NEED_MODEXP=y
    362 CONFIG_EAP=y
    363 
    364 ifdef CONFIG_WPS_NFC
    365 CFLAGS += -DCONFIG_WPS_NFC
    366 OBJS += ../src/wps/ndef.o
    367 NEED_WPS_OOB=y
    368 endif
    369 
    370 ifdef NEED_WPS_OOB
    371 CFLAGS += -DCONFIG_WPS_OOB
    372 endif
    373 
    374 ifdef CONFIG_WPS_UPNP
    375 CFLAGS += -DCONFIG_WPS_UPNP
    376 OBJS += ../src/wps/wps_upnp.o
    377 OBJS += ../src/wps/wps_upnp_ssdp.o
    378 OBJS += ../src/wps/wps_upnp_web.o
    379 OBJS += ../src/wps/wps_upnp_event.o
    380 OBJS += ../src/wps/wps_upnp_ap.o
    381 OBJS += ../src/wps/upnp_xml.o
    382 OBJS += ../src/wps/httpread.o
    383 OBJS += ../src/wps/http_client.o
    384 OBJS += ../src/wps/http_server.o
    385 endif
    386 
    387 ifdef CONFIG_WPS_STRICT
    388 CFLAGS += -DCONFIG_WPS_STRICT
    389 OBJS += ../src/wps/wps_validate.o
    390 endif
    391 
    392 ifdef CONFIG_WPS_TESTING
    393 CFLAGS += -DCONFIG_WPS_TESTING
    394 endif
    395 
    396 endif
    397 
    398 ifdef CONFIG_EAP_IKEV2
    399 CFLAGS += -DEAP_SERVER_IKEV2
    400 OBJS += ../src/eap_server/eap_server_ikev2.o ../src/eap_server/ikev2.o
    401 OBJS += ../src/eap_common/eap_ikev2_common.o ../src/eap_common/ikev2_common.o
    402 NEED_DH_GROUPS=y
    403 NEED_DH_GROUPS_ALL=y
    404 NEED_MODEXP=y
    405 NEED_CIPHER=y
    406 endif
    407 
    408 ifdef CONFIG_EAP_TNC
    409 CFLAGS += -DEAP_SERVER_TNC
    410 OBJS += ../src/eap_server/eap_server_tnc.o
    411 OBJS += ../src/eap_server/tncs.o
    412 NEED_BASE64=y
    413 ifndef CONFIG_DRIVER_BSD
    414 LIBS += -ldl
    415 endif
    416 endif
    417 
    418 # Basic EAP functionality is needed for EAPOL
    419 OBJS += eap_register.o
    420 OBJS += ../src/eap_server/eap_server.o
    421 OBJS += ../src/eap_common/eap_common.o
    422 OBJS += ../src/eap_server/eap_server_methods.o
    423 OBJS += ../src/eap_server/eap_server_identity.o
    424 CFLAGS += -DEAP_SERVER_IDENTITY
    425 
    426 ifdef CONFIG_EAP
    427 CFLAGS += -DEAP_SERVER
    428 endif
    429 
    430 ifdef CONFIG_PKCS12
    431 CFLAGS += -DPKCS12_FUNCS
    432 endif
    433 
    434 ifdef MS_FUNCS
    435 OBJS += ../src/crypto/ms_funcs.o
    436 NEED_DES=y
    437 NEED_MD4=y
    438 endif
    439 
    440 ifdef CHAP
    441 OBJS += ../src/eap_common/chap.o
    442 endif
    443 
    444 ifdef TLS_FUNCS
    445 NEED_DES=y
    446 # Shared TLS functions (needed for EAP_TLS, EAP_PEAP, and EAP_TTLS)
    447 CFLAGS += -DEAP_TLS_FUNCS
    448 OBJS += ../src/eap_server/eap_server_tls_common.o
    449 NEED_TLS_PRF=y
    450 endif
    451 
    452 ifndef CONFIG_TLS
    453 CONFIG_TLS=openssl
    454 endif
    455 
    456 ifdef CONFIG_TLSV11
    457 CFLAGS += -DCONFIG_TLSV11
    458 endif
    459 
    460 ifdef CONFIG_TLSV12
    461 CFLAGS += -DCONFIG_TLSV12
    462 NEED_SHA256=y
    463 endif
    464 
    465 ifeq ($(CONFIG_TLS), openssl)
    466 ifdef TLS_FUNCS
    467 OBJS += ../src/crypto/tls_openssl.o
    468 LIBS += -lssl
    469 endif
    470 OBJS += ../src/crypto/crypto_openssl.o
    471 HOBJS += ../src/crypto/crypto_openssl.o
    472 ifdef NEED_FIPS186_2_PRF
    473 OBJS += ../src/crypto/fips_prf_openssl.o
    474 endif
    475 LIBS += -lcrypto
    476 LIBS_h += -lcrypto
    477 endif
    478 
    479 ifeq ($(CONFIG_TLS), gnutls)
    480 ifdef TLS_FUNCS
    481 OBJS += ../src/crypto/tls_gnutls.o
    482 LIBS += -lgnutls -lgpg-error
    483 endif
    484 OBJS += ../src/crypto/crypto_gnutls.o
    485 HOBJS += ../src/crypto/crypto_gnutls.o
    486 ifdef NEED_FIPS186_2_PRF
    487 OBJS += ../src/crypto/fips_prf_gnutls.o
    488 endif
    489 LIBS += -lgcrypt
    490 LIBS_h += -lgcrypt
    491 CONFIG_INTERNAL_SHA256=y
    492 CONFIG_INTERNAL_RC4=y
    493 CONFIG_INTERNAL_DH_GROUP5=y
    494 endif
    495 
    496 ifeq ($(CONFIG_TLS), schannel)
    497 ifdef TLS_FUNCS
    498 OBJS += ../src/crypto/tls_schannel.o
    499 endif
    500 OBJS += ../src/crypto/crypto_cryptoapi.o
    501 OBJS_p += ../src/crypto/crypto_cryptoapi.o
    502 CONFIG_INTERNAL_SHA256=y
    503 CONFIG_INTERNAL_RC4=y
    504 CONFIG_INTERNAL_DH_GROUP5=y
    505 endif
    506 
    507 ifeq ($(CONFIG_TLS), nss)
    508 ifdef TLS_FUNCS
    509 OBJS += ../src/crypto/tls_nss.o
    510 LIBS += -lssl3
    511 endif
    512 OBJS += ../src/crypto/crypto_nss.o
    513 ifdef NEED_FIPS186_2_PRF
    514 OBJS += ../src/crypto/fips_prf_nss.o
    515 endif
    516 LIBS += -lnss3
    517 LIBS_h += -lnss3
    518 CONFIG_INTERNAL_MD4=y
    519 CONFIG_INTERNAL_DH_GROUP5=y
    520 endif
    521 
    522 ifeq ($(CONFIG_TLS), internal)
    523 ifndef CONFIG_CRYPTO
    524 CONFIG_CRYPTO=internal
    525 endif
    526 ifdef TLS_FUNCS
    527 OBJS += ../src/crypto/crypto_internal-rsa.o
    528 OBJS += ../src/crypto/tls_internal.o
    529 OBJS += ../src/tls/tlsv1_common.o
    530 OBJS += ../src/tls/tlsv1_record.o
    531 OBJS += ../src/tls/tlsv1_cred.o
    532 OBJS += ../src/tls/tlsv1_server.o
    533 OBJS += ../src/tls/tlsv1_server_write.o
    534 OBJS += ../src/tls/tlsv1_server_read.o
    535 OBJS += ../src/tls/asn1.o
    536 OBJS += ../src/tls/rsa.o
    537 OBJS += ../src/tls/x509v3.o
    538 OBJS += ../src/tls/pkcs1.o
    539 OBJS += ../src/tls/pkcs5.o
    540 OBJS += ../src/tls/pkcs8.o
    541 NEED_SHA256=y
    542 NEED_BASE64=y
    543 NEED_TLS_PRF=y
    544 ifdef CONFIG_TLSV12
    545 NEED_TLS_PRF_SHA256=y
    546 endif
    547 NEED_MODEXP=y
    548 NEED_CIPHER=y
    549 CFLAGS += -DCONFIG_TLS_INTERNAL
    550 CFLAGS += -DCONFIG_TLS_INTERNAL_SERVER
    551 endif
    552 ifdef NEED_CIPHER
    553 NEED_DES=y
    554 OBJS += ../src/crypto/crypto_internal-cipher.o
    555 endif
    556 ifdef NEED_MODEXP
    557 OBJS += ../src/crypto/crypto_internal-modexp.o
    558 OBJS += ../src/tls/bignum.o
    559 endif
    560 ifeq ($(CONFIG_CRYPTO), libtomcrypt)
    561 OBJS += ../src/crypto/crypto_libtomcrypt.o
    562 LIBS += -ltomcrypt -ltfm
    563 LIBS_h += -ltomcrypt -ltfm
    564 CONFIG_INTERNAL_SHA256=y
    565 CONFIG_INTERNAL_RC4=y
    566 CONFIG_INTERNAL_DH_GROUP5=y
    567 endif
    568 ifeq ($(CONFIG_CRYPTO), internal)
    569 OBJS += ../src/crypto/crypto_internal.o
    570 NEED_AES_DEC=y
    571 CFLAGS += -DCONFIG_CRYPTO_INTERNAL
    572 ifdef CONFIG_INTERNAL_LIBTOMMATH
    573 CFLAGS += -DCONFIG_INTERNAL_LIBTOMMATH
    574 ifdef CONFIG_INTERNAL_LIBTOMMATH_FAST
    575 CFLAGS += -DLTM_FAST
    576 endif
    577 else
    578 LIBS += -ltommath
    579 LIBS_h += -ltommath
    580 endif
    581 CONFIG_INTERNAL_AES=y
    582 CONFIG_INTERNAL_DES=y
    583 CONFIG_INTERNAL_SHA1=y
    584 CONFIG_INTERNAL_MD4=y
    585 CONFIG_INTERNAL_MD5=y
    586 CONFIG_INTERNAL_SHA256=y
    587 CONFIG_INTERNAL_RC4=y
    588 CONFIG_INTERNAL_DH_GROUP5=y
    589 endif
    590 ifeq ($(CONFIG_CRYPTO), cryptoapi)
    591 OBJS += ../src/crypto/crypto_cryptoapi.o
    592 OBJS_p += ../src/crypto/crypto_cryptoapi.o
    593 CFLAGS += -DCONFIG_CRYPTO_CRYPTOAPI
    594 CONFIG_INTERNAL_SHA256=y
    595 CONFIG_INTERNAL_RC4=y
    596 endif
    597 endif
    598 
    599 ifeq ($(CONFIG_TLS), none)
    600 ifdef TLS_FUNCS
    601 OBJS += ../src/crypto/tls_none.o
    602 CFLAGS += -DEAP_TLS_NONE
    603 CONFIG_INTERNAL_AES=y
    604 CONFIG_INTERNAL_SHA1=y
    605 CONFIG_INTERNAL_MD5=y
    606 endif
    607 OBJS += ../src/crypto/crypto_none.o
    608 OBJS_p += ../src/crypto/crypto_none.o
    609 CONFIG_INTERNAL_SHA256=y
    610 CONFIG_INTERNAL_RC4=y
    611 endif
    612 
    613 ifndef TLS_FUNCS
    614 OBJS += ../src/crypto/tls_none.o
    615 ifeq ($(CONFIG_TLS), internal)
    616 CONFIG_INTERNAL_AES=y
    617 CONFIG_INTERNAL_SHA1=y
    618 CONFIG_INTERNAL_MD5=y
    619 CONFIG_INTERNAL_RC4=y
    620 endif
    621 endif
    622 
    623 AESOBJS = # none so far
    624 ifdef CONFIG_INTERNAL_AES
    625 AESOBJS += ../src/crypto/aes-internal.o ../src/crypto/aes-internal-enc.o
    626 endif
    627 
    628 AESOBJS += ../src/crypto/aes-wrap.o
    629 ifdef NEED_AES_EAX
    630 AESOBJS += ../src/crypto/aes-eax.o
    631 NEED_AES_CTR=y
    632 endif
    633 ifdef NEED_AES_CTR
    634 AESOBJS += ../src/crypto/aes-ctr.o
    635 endif
    636 ifdef NEED_AES_ENCBLOCK
    637 AESOBJS += ../src/crypto/aes-encblock.o
    638 endif
    639 ifdef NEED_AES_OMAC1
    640 AESOBJS += ../src/crypto/aes-omac1.o
    641 endif
    642 ifdef NEED_AES_UNWRAP
    643 NEED_AES_DEC=y
    644 AESOBJS += ../src/crypto/aes-unwrap.o
    645 endif
    646 ifdef NEED_AES_CBC
    647 NEED_AES_DEC=y
    648 AESOBJS += ../src/crypto/aes-cbc.o
    649 endif
    650 ifdef NEED_AES_DEC
    651 ifdef CONFIG_INTERNAL_AES
    652 AESOBJS += ../src/crypto/aes-internal-dec.o
    653 endif
    654 endif
    655 ifdef NEED_AES
    656 OBJS += $(AESOBJS)
    657 endif
    658 
    659 ifdef NEED_SHA1
    660 ifneq ($(CONFIG_TLS), openssl)
    661 SHA1OBJS += ../src/crypto/sha1.o
    662 endif
    663 SHA1OBJS += ../src/crypto/sha1-prf.o
    664 ifdef CONFIG_INTERNAL_SHA1
    665 SHA1OBJS += ../src/crypto/sha1-internal.o
    666 ifdef NEED_FIPS186_2_PRF
    667 SHA1OBJS += ../src/crypto/fips_prf_internal.o
    668 endif
    669 endif
    670 ifneq ($(CONFIG_TLS), openssl)
    671 SHA1OBJS += ../src/crypto/sha1-pbkdf2.o
    672 endif
    673 ifdef NEED_T_PRF
    674 SHA1OBJS += ../src/crypto/sha1-tprf.o
    675 endif
    676 ifdef NEED_TLS_PRF
    677 SHA1OBJS += ../src/crypto/sha1-tlsprf.o
    678 endif
    679 endif
    680 
    681 ifdef NEED_SHA1
    682 OBJS += $(SHA1OBJS)
    683 endif
    684 
    685 ifdef NEED_MD5
    686 ifdef CONFIG_INTERNAL_MD5
    687 OBJS += ../src/crypto/md5-internal.o
    688 HOBJS += ../src/crypto/md5-internal.o
    689 endif
    690 endif
    691 
    692 ifdef NEED_MD4
    693 ifdef CONFIG_INTERNAL_MD4
    694 OBJS += ../src/crypto/md4-internal.o
    695 endif
    696 endif
    697 
    698 ifdef NEED_DES
    699 ifdef CONFIG_INTERNAL_DES
    700 OBJS += ../src/crypto/des-internal.o
    701 endif
    702 endif
    703 
    704 ifdef NEED_RC4
    705 ifdef CONFIG_INTERNAL_RC4
    706 OBJS += ../src/crypto/rc4.o
    707 endif
    708 endif
    709 
    710 ifdef NEED_SHA256
    711 CFLAGS += -DCONFIG_SHA256
    712 ifneq ($(CONFIG_TLS), openssl)
    713 OBJS += ../src/crypto/sha256.o
    714 endif
    715 OBJS += ../src/crypto/sha256-prf.o
    716 ifdef CONFIG_INTERNAL_SHA256
    717 OBJS += ../src/crypto/sha256-internal.o
    718 endif
    719 ifdef NEED_TLS_PRF_SHA256
    720 OBJS += ../src/crypto/sha256-tlsprf.o
    721 endif
    722 endif
    723 
    724 ifdef NEED_DH_GROUPS
    725 OBJS += ../src/crypto/dh_groups.o
    726 endif
    727 ifdef NEED_DH_GROUPS_ALL
    728 CFLAGS += -DALL_DH_GROUPS
    729 endif
    730 ifdef CONFIG_INTERNAL_DH_GROUP5
    731 ifdef NEED_DH_GROUPS
    732 OBJS += ../src/crypto/dh_group5.o
    733 endif
    734 endif
    735 
    736 ifdef NEED_ECC
    737 CFLAGS += -DCONFIG_ECC
    738 endif
    739 
    740 ifdef CONFIG_NO_RANDOM_POOL
    741 CFLAGS += -DCONFIG_NO_RANDOM_POOL
    742 else
    743 OBJS += ../src/crypto/random.o
    744 HOBJS += ../src/crypto/random.o
    745 HOBJS += ../src/utils/eloop.o
    746 HOBJS += $(SHA1OBJS)
    747 HOBJS += ../src/crypto/md5.o
    748 endif
    749 
    750 ifdef CONFIG_RADIUS_SERVER
    751 CFLAGS += -DRADIUS_SERVER
    752 OBJS += ../src/radius/radius_server.o
    753 endif
    754 
    755 ifdef CONFIG_IPV6
    756 CFLAGS += -DCONFIG_IPV6
    757 endif
    758 
    759 ifdef CONFIG_DRIVER_RADIUS_ACL
    760 CFLAGS += -DCONFIG_DRIVER_RADIUS_ACL
    761 endif
    762 
    763 ifdef CONFIG_FULL_DYNAMIC_VLAN
    764 # define CONFIG_FULL_DYNAMIC_VLAN to have hostapd manipulate bridges
    765 # and vlan interfaces for the vlan feature.
    766 CFLAGS += -DCONFIG_FULL_DYNAMIC_VLAN
    767 endif
    768 
    769 ifdef NEED_BASE64
    770 OBJS += ../src/utils/base64.o
    771 endif
    772 
    773 ifdef NEED_AP_MLME
    774 OBJS += ../src/ap/wmm.o
    775 OBJS += ../src/ap/ap_list.o
    776 OBJS += ../src/ap/ieee802_11.o
    777 OBJS += ../src/ap/hw_features.o
    778 CFLAGS += -DNEED_AP_MLME
    779 endif
    780 ifdef CONFIG_IEEE80211N
    781 OBJS += ../src/ap/ieee802_11_ht.o
    782 endif
    783 
    784 ifdef CONFIG_IEEE80211AC
    785 OBJS += ../src/ap/ieee802_11_vht.o
    786 endif
    787 
    788 ifdef CONFIG_P2P_MANAGER
    789 CFLAGS += -DCONFIG_P2P_MANAGER
    790 OBJS += ../src/ap/p2p_hostapd.o
    791 endif
    792 
    793 ifdef CONFIG_HS20
    794 CFLAGS += -DCONFIG_HS20
    795 OBJS += ../src/ap/hs20.o
    796 CONFIG_INTERWORKING=y
    797 endif
    798 
    799 ifdef CONFIG_INTERWORKING
    800 CFLAGS += -DCONFIG_INTERWORKING
    801 OBJS += ../src/common/gas.o
    802 OBJS += ../src/ap/gas_serv.o
    803 endif
    804 
    805 OBJS += ../src/drivers/driver_common.o
    806 
    807 ifdef CONFIG_WPA_CLI_EDIT
    808 OBJS_c += ../src/utils/edit.o
    809 else
    810 OBJS_c += ../src/utils/edit_simple.o
    811 endif
    812 
    813 ifdef CONFIG_NO_STDOUT_DEBUG
    814 CFLAGS += -DCONFIG_NO_STDOUT_DEBUG
    815 endif
    816 
    817 ifdef CONFIG_DEBUG_FILE
    818 CFLAGS += -DCONFIG_DEBUG_FILE
    819 endif
    820 
    821 ifdef CONFIG_SQLITE
    822 CFLAGS += -DCONFIG_SQLITE
    823 LIBS += -lsqlite3
    824 LIBS_h += -lsqlite3
    825 endif
    826 
    827 ALL=hostapd hostapd_cli
    828 
    829 all: verify_config $(ALL)
    830 
    831 Q=@
    832 E=echo
    833 ifeq ($(V), 1)
    834 Q=
    835 E=true
    836 endif
    837 
    838 %.o: %.c
    839 	$(Q)$(CC) -c -o $@ $(CFLAGS) $<
    840 	@$(E) "  CC " $<
    841 
    842 verify_config:
    843 	@if [ ! -r .config ]; then \
    844 		echo 'Building hostapd requires a configuration file'; \
    845 		echo '(.config). See README for more instructions. You can'; \
    846 		echo 'run "cp defconfig .config" to create an example'; \
    847 		echo 'configuration.'; \
    848 		exit 1; \
    849 	fi
    850 
    851 install: all
    852 	mkdir -p $(DESTDIR)/usr/local/bin
    853 	for i in $(ALL); do cp -f $$i $(DESTDIR)/usr/local/bin/$$i; done
    854 
    855 ../src/drivers/build.hostapd:
    856 	@if [ -f ../src/drivers/build.wpa_supplicant ]; then \
    857 		$(MAKE) -C ../src/drivers clean; \
    858 	fi
    859 	@touch ../src/drivers/build.hostapd
    860 
    861 BCHECK=../src/drivers/build.hostapd
    862 
    863 hostapd: $(BCHECK) $(OBJS)
    864 	$(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS)
    865 	@$(E) "  LD " $@
    866 
    867 ifdef CONFIG_WPA_TRACE
    868 OBJS_c += ../src/utils/trace.o
    869 endif
    870 hostapd_cli: $(OBJS_c)
    871 	$(Q)$(CC) $(LDFLAGS) -o hostapd_cli $(OBJS_c) $(LIBS_c)
    872 	@$(E) "  LD " $@
    873 
    874 NOBJS = nt_password_hash.o ../src/crypto/ms_funcs.o $(SHA1OBJS) ../src/crypto/md5.o
    875 ifdef NEED_RC4
    876 ifdef CONFIG_INTERNAL_RC4
    877 NOBJS += ../src/crypto/rc4.o
    878 endif
    879 endif
    880 ifdef CONFIG_INTERNAL_MD5
    881 NOBJS += ../src/crypto/md5-internal.o
    882 endif
    883 NOBJS += ../src/crypto/crypto_openssl.o ../src/utils/os_$(CONFIG_OS).o
    884 NOBJS += ../src/utils/wpa_debug.o
    885 NOBJS += ../src/utils/wpabuf.o
    886 ifdef CONFIG_WPA_TRACE
    887 NOBJS += ../src/utils/trace.o
    888 LIBS_n += -lbfd
    889 endif
    890 ifdef TLS_FUNCS
    891 LIBS_n += -lcrypto
    892 endif
    893 
    894 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
    895 HOBJS += ../src/crypto/aes-encblock.o
    896 ifdef CONFIG_INTERNAL_AES
    897 HOBJS += ../src/crypto/aes-internal.o
    898 HOBJS += ../src/crypto/aes-internal-enc.o
    899 endif
    900 
    901 nt_password_hash: $(NOBJS)
    902 	$(Q)$(CC) $(LDFLAGS) -o nt_password_hash $(NOBJS) $(LIBS_n)
    903 	@$(E) "  LD " $@
    904 
    905 hlr_auc_gw: $(HOBJS)
    906 	$(Q)$(CC) $(LDFLAGS) -o hlr_auc_gw $(HOBJS) $(LIBS_h)
    907 	@$(E) "  LD " $@
    908 
    909 clean:
    910 	$(MAKE) -C ../src clean
    911 	rm -f core *~ *.o hostapd hostapd_cli nt_password_hash hlr_auc_gw
    912 	rm -f *.d
    913 
    914 -include $(OBJS:%.o=%.d)
    915