Home | History | Annotate | Download | only in wpa_supplicant
      1 ifndef CC
      2 CC=gcc
      3 endif
      4 
      5 ifndef CFLAGS
      6 CFLAGS = -MMD -O2 -Wall -g
      7 endif
      8 
      9 # Include directories for CVS version
     10 CFLAGS += -I. -I../utils -I../hostapd
     11 
     12 ALL=wpa_supplicant wpa_passphrase wpa_cli
     13 
     14 all: verify_config $(ALL) dynamic_eap_methods
     15 
     16 verify_config:
     17 	@if [ ! -r .config ]; then \
     18 		echo 'Building wpa_supplicant requires a configuration file'; \
     19 		echo '(.config). See README for more instructions. You can'; \
     20 		echo 'run "cp defconfig .config" to create an example'; \
     21 		echo 'configuration.'; \
     22 		exit 1; \
     23 	fi
     24 
     25 mkconfig:
     26 	@if [ -e .config ]; then \
     27 		echo '.config exists - did not replace it'; \
     28 		exit 1; \
     29 	fi
     30 	echo CONFIG_DRIVER_HOSTAP=y >> .config
     31 	echo CONFIG_DRIVER_WEXT=y >> .config
     32 	echo CONFIG_WIRELESS_EXTENSION=y >> .config
     33 
     34 install: all
     35 	mkdir -p $(DESTDIR)/usr/local/sbin/
     36 	for i in $(ALL); do cp $$i $(DESTDIR)/usr/local/sbin/$$i; done
     37 
     38 OBJS = config.o \
     39 	common.o md5.o md4.o \
     40 	rc4.o sha1.o des.o
     41 OBJS_p = wpa_passphrase.o sha1.o md5.o md4.o \
     42 	common.o des.o
     43 OBJS_c = wpa_cli.o wpa_ctrl.o
     44 
     45 -include .config
     46 
     47 ifndef CONFIG_OS
     48 ifdef CONFIG_NATIVE_WINDOWS
     49 CONFIG_OS=win32
     50 else
     51 CONFIG_OS=unix
     52 endif
     53 endif
     54 
     55 ifeq ($(CONFIG_OS), internal)
     56 CFLAGS += -DOS_NO_C_LIB_DEFINES
     57 endif
     58 
     59 OBJS += os_$(CONFIG_OS).o
     60 OBJS_p += os_$(CONFIG_OS).o
     61 OBJS_c += os_$(CONFIG_OS).o
     62 
     63 ifndef CONFIG_ELOOP
     64 CONFIG_ELOOP=eloop
     65 endif
     66 OBJS += $(CONFIG_ELOOP).o
     67 
     68 
     69 ifdef CONFIG_EAPOL_TEST
     70 CFLAGS += -Werror -DEAPOL_TEST
     71 endif
     72 
     73 ifndef CONFIG_BACKEND
     74 CONFIG_BACKEND=file
     75 endif
     76 
     77 ifeq ($(CONFIG_BACKEND), file)
     78 OBJS += config_file.o base64.o
     79 CFLAGS += -DCONFIG_BACKEND_FILE
     80 endif
     81 
     82 ifeq ($(CONFIG_BACKEND), winreg)
     83 OBJS += config_winreg.o
     84 endif
     85 
     86 ifeq ($(CONFIG_BACKEND), none)
     87 OBJS += config_none.o
     88 endif
     89 
     90 ifdef CONFIG_DRIVER_HOSTAP
     91 CFLAGS += -DCONFIG_DRIVER_HOSTAP
     92 OBJS_d += driver_hostap.o
     93 CONFIG_WIRELESS_EXTENSION=y
     94 endif
     95 
     96 ifdef CONFIG_DRIVER_WEXT
     97 CFLAGS += -DCONFIG_DRIVER_WEXT
     98 CONFIG_WIRELESS_EXTENSION=y
     99 endif
    100 
    101 ifdef CONFIG_DRIVER_PRISM54
    102 CFLAGS += -DCONFIG_DRIVER_PRISM54
    103 OBJS_d += driver_prism54.o
    104 CONFIG_WIRELESS_EXTENSION=y
    105 endif
    106 
    107 ifdef CONFIG_DRIVER_HERMES
    108 CFLAGS += -DCONFIG_DRIVER_HERMES
    109 OBJS_d += driver_hermes.o
    110 CONFIG_WIRELESS_EXTENSION=y
    111 endif
    112 
    113 ifdef CONFIG_DRIVER_MADWIFI
    114 CFLAGS += -DCONFIG_DRIVER_MADWIFI
    115 OBJS_d += driver_madwifi.o
    116 CONFIG_WIRELESS_EXTENSION=y
    117 endif
    118 
    119 ifdef CONFIG_DRIVER_ATMEL
    120 CFLAGS += -DCONFIG_DRIVER_ATMEL
    121 OBJS_d += driver_atmel.o
    122 CONFIG_WIRELESS_EXTENSION=y
    123 endif
    124 
    125 ifdef CONFIG_DRIVER_NDISWRAPPER
    126 CFLAGS += -DCONFIG_DRIVER_NDISWRAPPER
    127 OBJS_d += driver_ndiswrapper.o
    128 CONFIG_WIRELESS_EXTENSION=y
    129 endif
    130 
    131 ifdef CONFIG_DRIVER_BROADCOM
    132 CFLAGS += -DCONFIG_DRIVER_BROADCOM
    133 OBJS_d += driver_broadcom.o
    134 endif
    135 
    136 ifdef CONFIG_DRIVER_IPW
    137 CFLAGS += -DCONFIG_DRIVER_IPW
    138 OBJS_d += driver_ipw.o
    139 CONFIG_WIRELESS_EXTENSION=y
    140 endif
    141 
    142 ifdef CONFIG_DRIVER_BSD
    143 CFLAGS += -DCONFIG_DRIVER_BSD
    144 OBJS_d += driver_bsd.o
    145 ifndef CONFIG_L2_PACKET
    146 CONFIG_L2_PACKET=freebsd
    147 endif
    148 endif
    149 
    150 ifdef CONFIG_DRIVER_NDIS
    151 CFLAGS += -DCONFIG_DRIVER_NDIS
    152 OBJS_d += driver_ndis.o
    153 ifdef CONFIG_NDIS_EVENTS_INTEGRATED
    154 OBJS_d += driver_ndis_.o
    155 endif
    156 ifndef CONFIG_L2_PACKET
    157 CONFIG_L2_PACKET=pcap
    158 endif
    159 CONFIG_WINPCAP=y
    160 ifdef CONFIG_USE_NDISUIO
    161 CFLAGS += -DCONFIG_USE_NDISUIO
    162 endif
    163 endif
    164 
    165 ifdef CONFIG_DRIVER_WIRED
    166 CFLAGS += -DCONFIG_DRIVER_WIRED
    167 OBJS_d += driver_wired.o
    168 endif
    169 
    170 ifdef CONFIG_DRIVER_TEST
    171 CFLAGS += -DCONFIG_DRIVER_TEST
    172 OBJS_d += driver_test.o
    173 endif
    174 
    175 ifndef CONFIG_L2_PACKET
    176 CONFIG_L2_PACKET=linux
    177 endif
    178 
    179 OBJS += l2_packet_$(CONFIG_L2_PACKET).o
    180 
    181 ifeq ($(CONFIG_L2_PACKET), pcap)
    182 ifdef CONFIG_WINPCAP
    183 CFLAGS += -DCONFIG_WINPCAP
    184 LIBS += -lwpcap -lpacket
    185 LIBS_w += -lwpcap
    186 else
    187 LIBS += -ldnet -lpcap
    188 endif
    189 endif
    190 
    191 ifeq ($(CONFIG_L2_PACKET), winpcap)
    192 LIBS += -lwpcap -lpacket
    193 LIBS_w += -lwpcap
    194 endif
    195 
    196 ifeq ($(CONFIG_L2_PACKET), freebsd)
    197 LIBS += -lpcap
    198 endif
    199 
    200 ifdef CONFIG_EAP_TLS
    201 # EAP-TLS
    202 ifeq ($(CONFIG_EAP_TLS), dyn)
    203 CFLAGS += -DEAP_TLS_DYNAMIC
    204 EAPDYN += eap_tls.so
    205 else
    206 CFLAGS += -DEAP_TLS
    207 OBJS += eap_tls.o
    208 endif
    209 TLS_FUNCS=y
    210 CONFIG_IEEE8021X_EAPOL=y
    211 endif
    212 
    213 ifdef CONFIG_EAP_PEAP
    214 # EAP-PEAP
    215 ifeq ($(CONFIG_EAP_PEAP), dyn)
    216 CFLAGS += -DEAP_PEAP_DYNAMIC
    217 EAPDYN += eap_peap.so
    218 else
    219 CFLAGS += -DEAP_PEAP
    220 OBJS += eap_peap.o
    221 endif
    222 TLS_FUNCS=y
    223 CONFIG_IEEE8021X_EAPOL=y
    224 CONFIG_EAP_TLV=y
    225 endif
    226 
    227 ifdef CONFIG_EAP_TTLS
    228 # EAP-TTLS
    229 ifeq ($(CONFIG_EAP_TTLS), dyn)
    230 CFLAGS += -DEAP_TTLS_DYNAMIC
    231 EAPDYN += eap_ttls.so
    232 else
    233 CFLAGS += -DEAP_TTLS
    234 OBJS += eap_ttls.o
    235 endif
    236 MS_FUNCS=y
    237 TLS_FUNCS=y
    238 CONFIG_IEEE8021X_EAPOL=y
    239 endif
    240 
    241 ifdef CONFIG_EAP_MD5
    242 # EAP-MD5
    243 ifeq ($(CONFIG_EAP_MD5), dyn)
    244 CFLAGS += -DEAP_MD5_DYNAMIC
    245 EAPDYN += eap_md5.so
    246 else
    247 CFLAGS += -DEAP_MD5
    248 OBJS += eap_md5.o
    249 endif
    250 CONFIG_IEEE8021X_EAPOL=y
    251 endif
    252 
    253 # backwards compatibility for old spelling
    254 ifdef CONFIG_MSCHAPV2
    255 ifndef CONFIG_EAP_MSCHAPV2
    256 CONFIG_EAP_MSCHAPV2=y
    257 endif
    258 endif
    259 
    260 ifdef CONFIG_EAP_MSCHAPV2
    261 # EAP-MSCHAPv2
    262 ifeq ($(CONFIG_EAP_MSCHAPV2), dyn)
    263 CFLAGS += -DEAP_MSCHAPv2_DYNAMIC
    264 EAPDYN += eap_mschapv2.so
    265 else
    266 CFLAGS += -DEAP_MSCHAPv2
    267 OBJS += eap_mschapv2.o
    268 endif
    269 MS_FUNCS=y
    270 CONFIG_IEEE8021X_EAPOL=y
    271 endif
    272 
    273 ifdef CONFIG_EAP_GTC
    274 # EAP-GTC
    275 ifeq ($(CONFIG_EAP_GTC), dyn)
    276 CFLAGS += -DEAP_GTC_DYNAMIC
    277 EAPDYN += eap_gtc.so
    278 else
    279 CFLAGS += -DEAP_GTC
    280 OBJS += eap_gtc.o
    281 endif
    282 CONFIG_IEEE8021X_EAPOL=y
    283 endif
    284 
    285 ifdef CONFIG_EAP_OTP
    286 # EAP-OTP
    287 ifeq ($(CONFIG_EAP_OTP), dyn)
    288 CFLAGS += -DEAP_OTP_DYNAMIC
    289 EAPDYN += eap_otp.so
    290 else
    291 CFLAGS += -DEAP_OTP
    292 OBJS += eap_otp.o
    293 endif
    294 CONFIG_IEEE8021X_EAPOL=y
    295 endif
    296 
    297 ifdef CONFIG_EAP_SIM
    298 # EAP-SIM
    299 ifeq ($(CONFIG_EAP_SIM), dyn)
    300 CFLAGS += -DEAP_SIM_DYNAMIC
    301 EAPDYN += eap_sim.so
    302 else
    303 CFLAGS += -DEAP_SIM
    304 OBJS += eap_sim.o
    305 endif
    306 CONFIG_IEEE8021X_EAPOL=y
    307 CONFIG_EAP_SIM_COMMON=y
    308 endif
    309 
    310 ifdef CONFIG_EAP_LEAP
    311 # EAP-LEAP
    312 ifeq ($(CONFIG_EAP_LEAP), dyn)
    313 CFLAGS += -DEAP_LEAP_DYNAMIC
    314 EAPDYN += eap_leap.so
    315 else
    316 CFLAGS += -DEAP_LEAP
    317 OBJS += eap_leap.o
    318 endif
    319 MS_FUNCS=y
    320 CONFIG_IEEE8021X_EAPOL=y
    321 endif
    322 
    323 ifdef CONFIG_EAP_PSK
    324 # EAP-PSK
    325 ifeq ($(CONFIG_EAP_PSK), dyn)
    326 CFLAGS += -DEAP_PSK_DYNAMIC
    327 EAPDYN += eap_psk.so
    328 else
    329 CFLAGS += -DEAP_PSK
    330 OBJS += eap_psk.o eap_psk_common.o
    331 endif
    332 CONFIG_IEEE8021X_EAPOL=y
    333 NEED_AES=y
    334 endif
    335 
    336 ifdef CONFIG_EAP_AKA
    337 # EAP-AKA
    338 ifeq ($(CONFIG_EAP_AKA), dyn)
    339 CFLAGS += -DEAP_AKA_DYNAMIC
    340 EAPDYN += eap_aka.so
    341 else
    342 CFLAGS += -DEAP_AKA
    343 OBJS += eap_aka.o
    344 endif
    345 CONFIG_IEEE8021X_EAPOL=y
    346 CONFIG_EAP_SIM_COMMON=y
    347 endif
    348 
    349 ifdef CONFIG_EAP_SIM_COMMON
    350 OBJS += eap_sim_common.o
    351 NEED_AES=y
    352 endif
    353 
    354 ifdef CONFIG_EAP_TLV
    355 # EAP-TLV
    356 CFLAGS += -DEAP_TLV
    357 OBJS += eap_tlv.o
    358 endif
    359 
    360 ifdef CONFIG_EAP_FAST
    361 # EAP-FAST
    362 ifeq ($(CONFIG_EAP_FAST), dyn)
    363 CFLAGS += -DEAP_FAST_DYNAMIC
    364 EAPDYN += eap_fast.so
    365 else
    366 CFLAGS += -DEAP_FAST
    367 OBJS += eap_fast.o
    368 endif
    369 TLS_FUNCS=y
    370 endif
    371 
    372 ifdef CONFIG_EAP_PAX
    373 # EAP-PAX
    374 ifeq ($(CONFIG_EAP_PAX), dyn)
    375 CFLAGS += -DEAP_PAX_DYNAMIC
    376 EAPDYN += eap_pax.so
    377 else
    378 CFLAGS += -DEAP_PAX
    379 OBJS += eap_pax.o eap_pax_common.o
    380 endif
    381 CONFIG_IEEE8021X_EAPOL=y
    382 endif
    383 
    384 ifdef CONFIG_EAP_SAKE
    385 # EAP-SAKE
    386 ifeq ($(CONFIG_EAP_SAKE), dyn)
    387 CFLAGS += -DEAP_SAKE_DYNAMIC
    388 EAPDYN += eap_sake.so
    389 else
    390 CFLAGS += -DEAP_SAKE
    391 OBJS += eap_sake.o eap_sake_common.o
    392 endif
    393 CONFIG_IEEE8021X_EAPOL=y
    394 endif
    395 
    396 ifdef CONFIG_EAP_GPSK
    397 # EAP-GPSK
    398 ifeq ($(CONFIG_EAP_GPSK), dyn)
    399 CFLAGS += -DEAP_GPSK_DYNAMIC
    400 EAPDYN += eap_gpsk.so
    401 else
    402 CFLAGS += -DEAP_GPSK
    403 OBJS += eap_gpsk.o eap_gpsk_common.o
    404 endif
    405 CONFIG_IEEE8021X_EAPOL=y
    406 ifdef CONFIG_EAP_GPSK_SHA256
    407 CFLAGS += -DEAP_GPSK_SHA256
    408 NEED_SHA256=y
    409 endif
    410 endif
    411 
    412 ifdef CONFIG_EAP_VENDOR_TEST
    413 ifeq ($(CONFIG_EAP_VENDOR_TEST), dyn)
    414 CFLAGS += -DEAP_VENDOR_TEST_DYNAMIC
    415 EAPDYN += eap_vendor_test.so
    416 else
    417 CFLAGS += -DEAP_VENDOR_TEST
    418 OBJS += eap_vendor_test.o
    419 endif
    420 CONFIG_IEEE8021X_EAPOL=y
    421 endif
    422 
    423 ifdef CONFIG_IEEE8021X_EAPOL
    424 # IEEE 802.1X/EAPOL state machines (e.g., for RADIUS authentication)
    425 CFLAGS += -DIEEE8021X_EAPOL
    426 OBJS += eapol_sm.o eap.o eap_methods.o
    427 ifdef CONFIG_DYNAMIC_EAP_METHODS
    428 CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS
    429 LIBS += -ldl -rdynamic
    430 endif
    431 endif
    432 
    433 ifdef CONFIG_PCSC
    434 # PC/SC interface for smartcards (USIM, GSM SIM)
    435 CFLAGS += -DPCSC_FUNCS -I/usr/include/PCSC
    436 OBJS += pcsc_funcs.o
    437 # -lpthread may not be needed depending on how pcsc-lite was configured
    438 ifdef CONFIG_NATIVE_WINDOWS
    439 #Once MinGW gets support for WinScard, -lwinscard could be used instead of the
    440 #dynamic symbol loading that is now used in pcsc_funcs.c
    441 #LIBS += -lwinscard
    442 else
    443 LIBS += -lpcsclite -lpthread
    444 endif
    445 endif
    446 
    447 ifndef CONFIG_TLS
    448 CONFIG_TLS=openssl
    449 endif
    450 
    451 ifeq ($(CONFIG_TLS), internal)
    452 ifndef CONFIG_CRYPTO
    453 CONFIG_CRYPTO=internal
    454 endif
    455 endif
    456 ifeq ($(CONFIG_CRYPTO), libtomcrypt)
    457 CFLAGS += -DCONFIG_INTERNAL_X509
    458 endif
    459 ifeq ($(CONFIG_CRYPTO), internal)
    460 CFLAGS += -DCONFIG_INTERNAL_X509
    461 endif
    462 
    463 
    464 ifdef TLS_FUNCS
    465 # Shared TLS functions (needed for EAP_TLS, EAP_PEAP, EAP_TTLS, and EAP_FAST)
    466 CFLAGS += -DEAP_TLS_FUNCS
    467 OBJS += eap_tls_common.o
    468 ifeq ($(CONFIG_TLS), openssl)
    469 CFLAGS += -DEAP_TLS_OPENSSL
    470 OBJS += tls_openssl.o
    471 LIBS += -lssl -lcrypto
    472 LIBS_p += -lcrypto
    473 endif
    474 ifeq ($(CONFIG_TLS), gnutls)
    475 OBJS += tls_gnutls.o
    476 LIBS += -lgnutls -lgcrypt -lgpg-error
    477 LIBS_p += -lgcrypt
    478 ifdef CONFIG_GNUTLS_EXTRA
    479 CFLAGS += -DCONFIG_GNUTLS_EXTRA
    480 LIBS += -lgnutls-extra
    481 endif
    482 endif
    483 ifeq ($(CONFIG_TLS), schannel)
    484 OBJS += tls_schannel.o
    485 endif
    486 ifeq ($(CONFIG_TLS), internal)
    487 OBJS += tls_internal.o tlsv1_common.o tlsv1_client.o asn1.o x509v3.o
    488 OBJS_p += asn1.o rc4.o aes_wrap.o
    489 ifneq ($(CONFIG_BACKEND), file)
    490 OBJS += base64.o
    491 endif
    492 CFLAGS += -DCONFIG_TLS_INTERNAL
    493 ifeq ($(CONFIG_CRYPTO), internal)
    494 ifdef CONFIG_INTERNAL_LIBTOMMATH
    495 CFLAGS += -DCONFIG_INTERNAL_LIBTOMMATH
    496 else
    497 LIBS += -ltommath
    498 LIBS_p += -ltommath
    499 endif
    500 endif
    501 ifeq ($(CONFIG_CRYPTO), libtomcrypt)
    502 LIBS += -ltomcrypt -ltfm
    503 LIBS_p += -ltomcrypt -ltfm
    504 endif
    505 endif
    506 ifeq ($(CONFIG_TLS), none)
    507 OBJS += tls_none.o
    508 CFLAGS += -DEAP_TLS_NONE
    509 CONFIG_INTERNAL_AES=y
    510 CONFIG_INTERNAL_SHA1=y
    511 CONFIG_INTERNAL_MD5=y
    512 CONFIG_INTERNAL_SHA256=y
    513 endif
    514 ifdef CONFIG_SMARTCARD
    515 ifndef CONFIG_NATIVE_WINDOWS
    516 ifneq ($(CONFIG_L2_PACKET), freebsd)
    517 LIBS += -ldl
    518 endif
    519 endif
    520 endif
    521 NEED_CRYPTO=y
    522 else
    523 OBJS += tls_none.o
    524 endif
    525 
    526 ifdef CONFIG_PKCS12
    527 CFLAGS += -DPKCS12_FUNCS
    528 endif
    529 
    530 ifdef CONFIG_SMARTCARD
    531 CFLAGS += -DCONFIG_SMARTCARD
    532 endif
    533 
    534 ifdef MS_FUNCS
    535 OBJS += ms_funcs.o
    536 NEED_CRYPTO=y
    537 endif
    538 
    539 ifdef NEED_CRYPTO
    540 ifndef TLS_FUNCS
    541 ifeq ($(CONFIG_TLS), openssl)
    542 LIBS += -lcrypto
    543 LIBS_p += -lcrypto
    544 endif
    545 ifeq ($(CONFIG_TLS), gnutls)
    546 LIBS += -lgcrypt
    547 LIBS_p += -lgcrypt
    548 endif
    549 ifeq ($(CONFIG_TLS), schannel)
    550 endif
    551 ifeq ($(CONFIG_TLS), internal)
    552 ifeq ($(CONFIG_CRYPTO), libtomcrypt)
    553 LIBS += -ltomcrypt -ltfm
    554 LIBS_p += -ltomcrypt -ltfm
    555 endif
    556 endif
    557 endif
    558 ifeq ($(CONFIG_TLS), openssl)
    559 OBJS += crypto.o
    560 OBJS_p += crypto.o
    561 CONFIG_INTERNAL_SHA256=y
    562 endif
    563 ifeq ($(CONFIG_TLS), gnutls)
    564 OBJS += crypto_gnutls.o
    565 OBJS_p += crypto_gnutls.o
    566 CONFIG_INTERNAL_SHA256=y
    567 endif
    568 ifeq ($(CONFIG_TLS), schannel)
    569 OBJS += crypto_cryptoapi.o
    570 OBJS_p += crypto_cryptoapi.o
    571 CONFIG_INTERNAL_SHA256=y
    572 endif
    573 ifeq ($(CONFIG_TLS), internal)
    574 ifeq ($(CONFIG_CRYPTO), libtomcrypt)
    575 OBJS += crypto_libtomcrypt.o
    576 OBJS_p += crypto_libtomcrypt.o
    577 CONFIG_INTERNAL_SHA256=y
    578 endif
    579 ifeq ($(CONFIG_CRYPTO), internal)
    580 OBJS += crypto_internal.o rsa.o bignum.o
    581 OBJS_p += crypto_internal.o rsa.o bignum.o
    582 CFLAGS += -DCONFIG_CRYPTO_INTERNAL
    583 CONFIG_INTERNAL_AES=y
    584 CONFIG_INTERNAL_DES=y
    585 CONFIG_INTERNAL_SHA1=y
    586 CONFIG_INTERNAL_MD4=y
    587 CONFIG_INTERNAL_MD5=y
    588 CONFIG_INTERNAL_SHA256=y
    589 endif
    590 ifeq ($(CONFIG_CRYPTO), cryptoapi)
    591 OBJS += crypto_cryptoapi.o
    592 OBJS_p += crypto_cryptoapi.o
    593 CFLAGS += -DCONFIG_CRYPTO_CRYPTOAPI
    594 CONFIG_INTERNAL_SHA256=y
    595 endif
    596 endif
    597 ifeq ($(CONFIG_TLS), none)
    598 OBJS += crypto_none.o
    599 OBJS_p += crypto_none.o
    600 CONFIG_INTERNAL_SHA256=y
    601 endif
    602 else
    603 CONFIG_INTERNAL_AES=y
    604 CONFIG_INTERNAL_SHA1=y
    605 CONFIG_INTERNAL_MD5=y
    606 endif
    607 
    608 ifdef CONFIG_INTERNAL_AES
    609 CFLAGS += -DINTERNAL_AES
    610 endif
    611 ifdef CONFIG_INTERNAL_SHA1
    612 CFLAGS += -DINTERNAL_SHA1
    613 endif
    614 ifdef CONFIG_INTERNAL_SHA256
    615 CFLAGS += -DINTERNAL_SHA256
    616 endif
    617 ifdef CONFIG_INTERNAL_MD5
    618 CFLAGS += -DINTERNAL_MD5
    619 endif
    620 ifdef CONFIG_INTERNAL_MD4
    621 CFLAGS += -DINTERNAL_MD4
    622 endif
    623 ifdef CONFIG_INTERNAL_DES
    624 CFLAGS += -DINTERNAL_DES
    625 endif
    626 
    627 ifdef NEED_SHA256
    628 OBJS += sha256.o
    629 endif
    630 
    631 ifdef CONFIG_WIRELESS_EXTENSION
    632 CFLAGS += -DCONFIG_WIRELESS_EXTENSION
    633 OBJS_d += driver_wext.o
    634 endif
    635 
    636 ifdef CONFIG_CTRL_IFACE
    637 ifeq ($(CONFIG_CTRL_IFACE), y)
    638 ifdef CONFIG_NATIVE_WINDOWS
    639 CONFIG_CTRL_IFACE=named_pipe
    640 else
    641 CONFIG_CTRL_IFACE=unix
    642 endif
    643 endif
    644 CFLAGS += -DCONFIG_CTRL_IFACE
    645 ifeq ($(CONFIG_CTRL_IFACE), unix)
    646 CFLAGS += -DCONFIG_CTRL_IFACE_UNIX
    647 endif
    648 ifeq ($(CONFIG_CTRL_IFACE), udp)
    649 CFLAGS += -DCONFIG_CTRL_IFACE_UDP
    650 endif
    651 ifeq ($(CONFIG_CTRL_IFACE), named_pipe)
    652 CFLAGS += -DCONFIG_CTRL_IFACE_NAMED_PIPE
    653 endif
    654 OBJS += ctrl_iface.o ctrl_iface_$(CONFIG_CTRL_IFACE).o
    655 endif
    656 
    657 ifdef CONFIG_CTRL_IFACE_DBUS
    658 CFLAGS += -DCONFIG_CTRL_IFACE_DBUS -DDBUS_API_SUBJECT_TO_CHANGE
    659 OBJS += ctrl_iface_dbus.o ctrl_iface_dbus_handlers.o dbus_dict_helpers.o
    660 ifndef DBUS_LIBS
    661 DBUS_LIBS := $(shell pkg-config --libs dbus-1)
    662 endif
    663 LIBS += $(DBUS_LIBS)
    664 ifndef DBUS_INCLUDE
    665 DBUS_INCLUDE := $(shell pkg-config --cflags dbus-1)
    666 endif
    667 dbus_version=$(subst ., ,$(shell pkg-config --modversion dbus-1))
    668 DBUS_VERSION_MAJOR=$(word 1,$(dbus_version))
    669 DBUS_VERSION_MINOR=$(word 2,$(dbus_version))
    670 ifeq ($(DBUS_VERSION_MAJOR),)
    671 DBUS_VERSION_MAJOR=0
    672 endif
    673 ifeq ($(DBUS_VERSION_MINOR),)
    674 DBUS_VERSION_MINOR=0
    675 endif
    676 DBUS_INCLUDE += -DDBUS_VERSION_MAJOR=$(DBUS_VERSION_MAJOR)
    677 DBUS_INCLUDE += -DDBUS_VERSION_MINOR=$(DBUS_VERSION_MINOR)
    678 CFLAGS += $(DBUS_INCLUDE)
    679 endif
    680 
    681 ifdef CONFIG_READLINE
    682 CFLAGS += -DCONFIG_READLINE
    683 LIBS_c += -lncurses -lreadline
    684 endif
    685 
    686 ifdef CONFIG_NATIVE_WINDOWS
    687 CFLAGS += -DCONFIG_NATIVE_WINDOWS
    688 LIBS += -lws2_32 -lgdi32 -lcrypt32
    689 LIBS_c += -lws2_32
    690 LIBS_p += -lws2_32
    691 ifeq ($(CONFIG_CRYPTO), cryptoapi)
    692 LIBS_p += -lcrypt32
    693 endif
    694 endif
    695 
    696 ifdef CONFIG_NO_STDOUT_DEBUG
    697 CFLAGS += -DCONFIG_NO_STDOUT_DEBUG
    698 ifndef CONFIG_CTRL_IFACE
    699 CFLAGS += -DCONFIG_NO_WPA_MSG
    700 endif
    701 endif
    702 
    703 ifdef CONFIG_IPV6
    704 # for eapol_test only
    705 CFLAGS += -DCONFIG_IPV6
    706 endif
    707 
    708 ifdef CONFIG_PEERKEY
    709 CFLAGS += -DCONFIG_PEERKEY
    710 endif
    711 
    712 ifdef CONFIG_IEEE80211W
    713 CFLAGS += -DCONFIG_IEEE80211W
    714 NEED_SHA256=y
    715 endif
    716 
    717 ifndef CONFIG_NO_WPA
    718 OBJS += wpa.o preauth.o pmksa_cache.o
    719 NEED_AES=y
    720 else
    721 CFLAGS += -DCONFIG_NO_WPA -DCONFIG_NO_WPA2
    722 endif
    723 
    724 ifdef CONFIG_NO_WPA2
    725 CFLAGS += -DCONFIG_NO_WPA2
    726 endif
    727 
    728 ifdef CONFIG_NO_AES_EXTRAS
    729 CFLAGS += -DCONFIG_NO_AES_WRAP
    730 CFLAGS += -DCONFIG_NO_AES_CTR -DCONFIG_NO_AES_OMAC1
    731 CFLAGS += -DCONFIG_NO_AES_EAX -DCONFIG_NO_AES_CBC
    732 endif
    733 
    734 ifdef NEED_AES
    735 OBJS += aes_wrap.o
    736 endif
    737 
    738 ifdef CONFIG_CLIENT_MLME
    739 OBJS += mlme.o
    740 CFLAGS += -DCONFIG_CLIENT_MLME
    741 endif
    742 
    743 ifndef CONFIG_MAIN
    744 CONFIG_MAIN=main
    745 endif
    746 
    747 ifdef CONFIG_DEBUG_FILE
    748 CFLAGS += -DCONFIG_DEBUG_FILE
    749 endif
    750 
    751 OBJS += wpa_supplicant.o events.o
    752 OBJS_t := $(OBJS) eapol_test.o radius.o radius_client.o
    753 OBJS_t2 := $(OBJS) preauth_test.o
    754 OBJS += $(CONFIG_MAIN).o drivers.o $(OBJS_d)
    755 
    756 ifdef CONFIG_NDIS_EVENTS_INTEGRATED
    757 CFLAGS += -DCONFIG_NDIS_EVENTS_INTEGRATED
    758 OBJS += ndis_events.o
    759 EXTRALIBS += -loleaut32 -lole32 -luuid
    760 ifdef PLATFORMSDKLIB
    761 EXTRALIBS += $(PLATFORMSDKLIB)/WbemUuid.Lib
    762 else
    763 EXTRALIBS += WbemUuid.Lib
    764 endif
    765 endif
    766 
    767 ifndef LDO
    768 LDO=$(CC)
    769 endif
    770 
    771 dynamic_eap_methods: $(EAPDYN)
    772 
    773 wpa_supplicant: .config $(OBJS)
    774 	$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS)
    775 
    776 eapol_test: .config $(OBJS_t)
    777 	$(LDO) $(LDFLAGS) -o eapol_test $(OBJS_t) $(LIBS)
    778 
    779 preauth_test: .config $(OBJS_t2) 
    780 	$(LDO) $(LDFLAGS) -o preauth_test $(OBJS_t2) $(LIBS)
    781 
    782 wpa_passphrase: $(OBJS_p)
    783 	$(LDO) $(LDFLAGS) -o wpa_passphrase $(OBJS_p) $(LIBS_p)
    784 
    785 wpa_cli: $(OBJS_c)
    786 	$(LDO) $(LDFLAGS) -o wpa_cli $(OBJS_c) $(LIBS_c)
    787 
    788 OBJSa=asn1_test.o asn1.o x509v3.o common.o os_unix.o \
    789 	crypto_$(CONFIG_CRYPTO).o md5.o sha1.o \
    790 	rc4.o des.o aes_wrap.o \
    791 	bignum.o rsa.o
    792 asn1_test: $(OBJSa)
    793 	$(LDO) $(LDFLAGS) -o asn1_test $(OBJSa)
    794 
    795 OBJSx=tests/test_x509v3.o asn1.o x509v3.o \
    796 	common.o os_unix.o \
    797 	crypto_$(CONFIG_CRYPTO).o \
    798 	md5.o sha1.o \
    799 	rc4.o des.o aes_wrap.o \
    800 	bignum.o rsa.o
    801 test_x509v3: $(OBJSx)
    802 	$(LDO) $(LDFLAGS) -o test_x509v3 $(OBJSx)
    803 
    804 win_if_list: win_if_list.c
    805 	$(LDO) $(LDFLAGS) -o $@ win_if_list.c $(CFLAGS) $(LIBS_w)
    806 
    807 eap_psk.so: eap_psk.c eap_psk_common.c
    808 	$(CC) -o $@ $(CFLAGS) -shared -rdynamic -fPIC $^ \
    809 		-Deap_peer_psk_register=eap_peer_method_dynamic_init
    810 
    811 eap_pax.so: eap_pax.c eap_pax_common.c
    812 	$(CC) -o $@ $(CFLAGS) -shared -rdynamic -fPIC $^ \
    813 		-Deap_peer_pax_register=eap_peer_method_dynamic_init
    814 
    815 eap_sake.so: eap_sake.c eap_sake_common.c
    816 	$(CC) -o $@ $(CFLAGS) -shared -rdynamic -fPIC $^ \
    817 		-Deap_peer_sake_register=eap_peer_method_dynamic_init
    818 
    819 %.so: %.c
    820 	$(CC) -o $@ $(CFLAGS) -shared -rdynamic -fPIC $< \
    821 		-D$(*:eap_%=eap_peer_%)_register=eap_peer_method_dynamic_init
    822 
    823 
    824 wpa_supplicant.exe: wpa_supplicant
    825 	mv -f $< $@
    826 wpa_cli.exe: wpa_cli
    827 	mv -f $< $@
    828 wpa_passphrase.exe: wpa_passphrase
    829 	mv -f $< $@
    830 win_if_list.exe: win_if_list
    831 	mv -f $< $@
    832 eapol_test.exe: eapol_test
    833 	mv -f $< $@
    834 
    835 WINALL=wpa_supplicant.exe wpa_cli.exe wpa_passphrase.exe win_if_list.exe
    836 
    837 windows-bin: $(WINALL)
    838 	$(STRIP) $(WINALL)
    839 
    840 wpa_gui/Makefile:
    841 	qmake -o wpa_gui/Makefile wpa_gui/wpa_gui.pro 
    842 
    843 wpa_gui: wpa_gui/Makefile
    844 	$(MAKE) -C wpa_gui
    845 
    846 TEST_MS_FUNCS_OBJS = crypto.o sha1.o md5.o \
    847 	os_unix.o rc4.o tests/test_ms_funcs.o
    848 test-ms_funcs: $(TEST_MS_FUNCS_OBJS)
    849 	$(LDO) $(LDFLAGS) -o $@ $(TEST_MS_FUNCS_OBJS) $(LIBS) -lcrypto
    850 	./test-ms_funcs
    851 	rm test-ms_funcs
    852 
    853 TEST_SHA1_OBJS = sha1.o md5.o tests/test_sha1.o #crypto.o
    854 test-sha1: $(TEST_SHA1_OBJS)
    855 	$(LDO) $(LDFLAGS) -o $@ $(TEST_SHA1_OBJS) $(LIBS)
    856 	./test-sha1
    857 	rm test-sha1
    858 
    859 TEST_SHA256_OBJS = sha256.o md5.o tests/test_sha256.o crypto.o
    860 test-sha256: $(TEST_SHA256_OBJS)
    861 	$(LDO) $(LDFLAGS) -o $@ $(TEST_SHA256_OBJS) $(LIBS)
    862 	./test-sha256
    863 	rm test-sha256
    864 
    865 TEST_AES_OBJS = aes_wrap.o tests/test_aes.o # crypto.o
    866 test-aes: $(TEST_AES_OBJS)
    867 	$(LDO) $(LDFLAGS) -o $@ $(TEST_AES_OBJS) $(LIBS)
    868 	./test-aes
    869 	rm test-aes
    870 
    871 TEST_EAP_SIM_COMMON_OBJS = sha1.o md5.o \
    872 	aes_wrap.o common.o os_unix.o \
    873 	tests/test_eap_sim_common.o
    874 test-eap_sim_common: $(TEST_EAP_SIM_COMMON_OBJS)
    875 	$(LDO) $(LDFLAGS) -o $@ $(TEST_AES_OBJS) $(LIBS)
    876 	./test-eap_sim_common
    877 	rm test-eap_sim_common
    878 
    879 TEST_MD4_OBJS = md4.o tests/test_md4.o #crypto.o
    880 test-md4: $(TEST_MD4_OBJS)
    881 	$(LDO) $(LDFLAGS) -o $@ $(TEST_MD4_OBJS) $(LIBS)
    882 	./test-md4
    883 	rm test-md4
    884 
    885 TEST_MD5_OBJS = md5.o tests/test_md5.o #crypto.o
    886 test-md5: $(TEST_MD5_OBJS)
    887 	$(LDO) $(LDFLAGS) -o $@ $(TEST_MD5_OBJS) $(LIBS)
    888 	./test-md5
    889 	rm test-md5
    890 
    891 tests: test-ms_funcs test-sha1 test-aes test-eap_sim_common test-md4 test-md5
    892 
    893 clean:
    894 	rm -f core *~ *.o *.d eap_*.so $(ALL) $(WINALL)
    895 
    896 %.eps: %.fig
    897 	fig2dev -L eps $*.fig $*.eps
    898 
    899 %.png: %.fig
    900 	fig2dev -L png -m 3 $*.fig | pngtopnm | pnmscale 0.4 | pnmtopng \
    901 		> $*.png
    902 
    903 docs-pics: doc/wpa_supplicant.png doc/wpa_supplicant.eps
    904 
    905 docs: docs-pics
    906 	doxygen doc/doxygen.full
    907 	$(MAKE) -C doc/latex
    908 	cp doc/latex/refman.pdf wpa_supplicant-devel.pdf
    909 
    910 docs-fast: docs-pics
    911 	doxygen doc/doxygen.fast
    912 
    913 clean-docs:
    914 	rm -rf doc/latex doc/html
    915 	rm -f doc/wpa_supplicant.{eps,png} wpa_supplicant-devel.pdf
    916 
    917 -include $(OBJS:%.o=%.d)
    918