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