123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288 |
- # To compile on SunOS: add "-lsocket -lnsl" to LDFLAGS
- # To compile with PKCS11: add "-lpkcs11-helper" to LDFLAGS
- CFLAGS ?= -O2
- WARNING_CFLAGS ?= -Wall -W -Wdeclaration-after-statement
- LDFLAGS ?=
- LOCAL_CFLAGS = $(WARNING_CFLAGS) -I../include -D_FILE_OFFSET_BITS=64
- LOCAL_LDFLAGS = -L../library \
- -lmbedtls$(SHARED_SUFFIX) \
- -lmbedx509$(SHARED_SUFFIX) \
- -lmbedcrypto$(SHARED_SUFFIX)
- ifndef SHARED
- DEP=../library/libmbedcrypto.a ../library/libmbedx509.a ../library/libmbedtls.a
- else
- DEP=../library/libmbedcrypto.$(DLEXT) ../library/libmbedx509.$(DLEXT) ../library/libmbedtls.$(DLEXT)
- endif
- ifdef DEBUG
- LOCAL_CFLAGS += -g3
- endif
- # if we're running on Windows, build for Windows
- ifdef WINDOWS
- WINDOWS_BUILD=1
- endif
- ifdef WINDOWS_BUILD
- DLEXT=dll
- EXEXT=.exe
- LOCAL_LDFLAGS += -lws2_32
- ifdef SHARED
- SHARED_SUFFIX=.$(DLEXT)
- endif
- else
- DLEXT=so
- EXEXT=
- SHARED_SUFFIX=
- endif
- # Zlib shared library extensions:
- ifdef ZLIB
- LOCAL_LDFLAGS += -lz
- endif
- APPS = aes/aescrypt2$(EXEXT) aes/crypt_and_hash$(EXEXT) \
- hash/hello$(EXEXT) hash/generic_sum$(EXEXT) \
- pkey/dh_client$(EXEXT) \
- pkey/dh_genprime$(EXEXT) pkey/dh_server$(EXEXT) \
- pkey/ecdh_curve25519$(EXEXT) \
- pkey/ecdsa$(EXEXT) pkey/gen_key$(EXEXT) \
- pkey/key_app$(EXEXT) pkey/key_app_writer$(EXEXT) \
- pkey/mpi_demo$(EXEXT) pkey/pk_decrypt$(EXEXT) \
- pkey/pk_encrypt$(EXEXT) pkey/pk_sign$(EXEXT) \
- pkey/pk_verify$(EXEXT) pkey/rsa_genkey$(EXEXT) \
- pkey/rsa_decrypt$(EXEXT) pkey/rsa_encrypt$(EXEXT) \
- pkey/rsa_sign$(EXEXT) pkey/rsa_verify$(EXEXT) \
- pkey/rsa_sign_pss$(EXEXT) pkey/rsa_verify_pss$(EXEXT) \
- ssl/dtls_client$(EXEXT) ssl/dtls_server$(EXEXT) \
- ssl/ssl_client1$(EXEXT) ssl/ssl_client2$(EXEXT) \
- ssl/ssl_server$(EXEXT) ssl/ssl_server2$(EXEXT) \
- ssl/ssl_fork_server$(EXEXT) ssl/mini_client$(EXEXT) \
- ssl/ssl_mail_client$(EXEXT) random/gen_entropy$(EXEXT) \
- random/gen_random_havege$(EXEXT) \
- random/gen_random_ctr_drbg$(EXEXT) \
- test/ssl_cert_test$(EXEXT) test/benchmark$(EXEXT) \
- test/selftest$(EXEXT) test/udp_proxy$(EXEXT) \
- util/pem2der$(EXEXT) util/strerror$(EXEXT) \
- x509/cert_app$(EXEXT) x509/crl_app$(EXEXT) \
- x509/cert_req$(EXEXT) x509/cert_write$(EXEXT) \
- x509/req_app$(EXEXT)
- ifdef PTHREAD
- APPS += ssl/ssl_pthread_server$(EXEXT)
- endif
- .SILENT:
- .PHONY: all clean list
- all: $(APPS)
- $(DEP):
- $(MAKE) -C ../library
- aes/aescrypt2$(EXEXT): aes/aescrypt2.c $(DEP)
- echo " CC aes/aescrypt2.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) aes/aescrypt2.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- aes/crypt_and_hash$(EXEXT): aes/crypt_and_hash.c $(DEP)
- echo " CC aes/crypt_and_hash.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) aes/crypt_and_hash.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- hash/hello$(EXEXT): hash/hello.c $(DEP)
- echo " CC hash/hello.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) hash/hello.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- hash/generic_sum$(EXEXT): hash/generic_sum.c $(DEP)
- echo " CC hash/generic_sum.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) hash/generic_sum.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- pkey/dh_client$(EXEXT): pkey/dh_client.c $(DEP)
- echo " CC pkey/dh_client.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/dh_client.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- pkey/dh_genprime$(EXEXT): pkey/dh_genprime.c $(DEP)
- echo " CC pkey/dh_genprime.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/dh_genprime.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- pkey/dh_server$(EXEXT): pkey/dh_server.c $(DEP)
- echo " CC pkey/dh_server.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/dh_server.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- pkey/ecdh_curve25519$(EXEXT): pkey/ecdh_curve25519.c $(DEP)
- echo " CC pkey/ecdh_curve25519.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/ecdh_curve25519.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- pkey/ecdsa$(EXEXT): pkey/ecdsa.c $(DEP)
- echo " CC pkey/ecdsa.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/ecdsa.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- pkey/gen_key$(EXEXT): pkey/gen_key.c $(DEP)
- echo " CC pkey/gen_key.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/gen_key.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- pkey/key_app$(EXEXT): pkey/key_app.c $(DEP)
- echo " CC pkey/key_app.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/key_app.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- pkey/key_app_writer$(EXEXT): pkey/key_app_writer.c $(DEP)
- echo " CC pkey/key_app_writer.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/key_app_writer.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- pkey/mpi_demo$(EXEXT): pkey/mpi_demo.c $(DEP)
- echo " CC pkey/mpi_demo.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/mpi_demo.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- pkey/pk_decrypt$(EXEXT): pkey/pk_decrypt.c $(DEP)
- echo " CC pkey/pk_decrypt.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/pk_decrypt.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- pkey/pk_encrypt$(EXEXT): pkey/pk_encrypt.c $(DEP)
- echo " CC pkey/pk_encrypt.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/pk_encrypt.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- pkey/pk_sign$(EXEXT): pkey/pk_sign.c $(DEP)
- echo " CC pkey/pk_sign.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/pk_sign.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- pkey/pk_verify$(EXEXT): pkey/pk_verify.c $(DEP)
- echo " CC pkey/pk_verify.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/pk_verify.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- pkey/rsa_genkey$(EXEXT): pkey/rsa_genkey.c $(DEP)
- echo " CC pkey/rsa_genkey.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/rsa_genkey.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- pkey/rsa_sign$(EXEXT): pkey/rsa_sign.c $(DEP)
- echo " CC pkey/rsa_sign.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/rsa_sign.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- pkey/rsa_verify$(EXEXT): pkey/rsa_verify.c $(DEP)
- echo " CC pkey/rsa_verify.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/rsa_verify.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- pkey/rsa_sign_pss$(EXEXT): pkey/rsa_sign_pss.c $(DEP)
- echo " CC pkey/rsa_sign_pss.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/rsa_sign_pss.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- pkey/rsa_verify_pss$(EXEXT): pkey/rsa_verify_pss.c $(DEP)
- echo " CC pkey/rsa_verify_pss.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/rsa_verify_pss.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- pkey/rsa_decrypt$(EXEXT): pkey/rsa_decrypt.c $(DEP)
- echo " CC pkey/rsa_decrypt.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/rsa_decrypt.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- pkey/rsa_encrypt$(EXEXT): pkey/rsa_encrypt.c $(DEP)
- echo " CC pkey/rsa_encrypt.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/rsa_encrypt.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- random/gen_entropy$(EXEXT): random/gen_entropy.c $(DEP)
- echo " CC random/gen_entropy.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) random/gen_entropy.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- random/gen_random_havege$(EXEXT): random/gen_random_havege.c $(DEP)
- echo " CC random/gen_random_havege.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) random/gen_random_havege.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- random/gen_random_ctr_drbg$(EXEXT): random/gen_random_ctr_drbg.c $(DEP)
- echo " CC random/gen_random_ctr_drbg.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) random/gen_random_ctr_drbg.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- ssl/dtls_client$(EXEXT): ssl/dtls_client.c $(DEP)
- echo " CC ssl/dtls_client.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/dtls_client.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- ssl/dtls_server$(EXEXT): ssl/dtls_server.c $(DEP)
- echo " CC ssl/dtls_server.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/dtls_server.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- ssl/ssl_client1$(EXEXT): ssl/ssl_client1.c $(DEP)
- echo " CC ssl/ssl_client1.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_client1.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- ssl/ssl_client2$(EXEXT): ssl/ssl_client2.c $(DEP)
- echo " CC ssl/ssl_client2.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_client2.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- ssl/ssl_server$(EXEXT): ssl/ssl_server.c $(DEP)
- echo " CC ssl/ssl_server.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_server.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- ssl/ssl_server2$(EXEXT): ssl/ssl_server2.c $(DEP)
- echo " CC ssl/ssl_server2.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_server2.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- ssl/ssl_fork_server$(EXEXT): ssl/ssl_fork_server.c $(DEP)
- echo " CC ssl/ssl_fork_server.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_fork_server.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- ssl/ssl_pthread_server$(EXEXT): ssl/ssl_pthread_server.c $(DEP)
- echo " CC ssl/ssl_pthread_server.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_pthread_server.c $(LOCAL_LDFLAGS) -lpthread $(LDFLAGS) -o $@
- ssl/ssl_mail_client$(EXEXT): ssl/ssl_mail_client.c $(DEP)
- echo " CC ssl/ssl_mail_client.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_mail_client.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- ssl/mini_client$(EXEXT): ssl/mini_client.c $(DEP)
- echo " CC ssl/mini_client.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/mini_client.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- test/ssl_cert_test$(EXEXT): test/ssl_cert_test.c $(DEP)
- echo " CC test/ssl_cert_test.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/ssl_cert_test.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- test/benchmark$(EXEXT): test/benchmark.c $(DEP)
- echo " CC test/benchmark.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/benchmark.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- test/selftest$(EXEXT): test/selftest.c $(DEP)
- echo " CC test/selftest.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/selftest.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- test/udp_proxy$(EXEXT): test/udp_proxy.c $(DEP)
- echo " CC test/udp_proxy.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/udp_proxy.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- util/pem2der$(EXEXT): util/pem2der.c $(DEP)
- echo " CC util/pem2der.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) util/pem2der.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- util/strerror$(EXEXT): util/strerror.c $(DEP)
- echo " CC util/strerror.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) util/strerror.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- x509/cert_app$(EXEXT): x509/cert_app.c $(DEP)
- echo " CC x509/cert_app.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) x509/cert_app.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- x509/cert_write$(EXEXT): x509/cert_write.c $(DEP)
- echo " CC x509/cert_write.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) x509/cert_write.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- x509/crl_app$(EXEXT): x509/crl_app.c $(DEP)
- echo " CC x509/crl_app.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) x509/crl_app.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- x509/cert_req$(EXEXT): x509/cert_req.c $(DEP)
- echo " CC x509/cert_req.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) x509/cert_req.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- x509/req_app$(EXEXT): x509/req_app.c $(DEP)
- echo " CC x509/req_app.c"
- $(CC) $(LOCAL_CFLAGS) $(CFLAGS) x509/req_app.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
- clean:
- ifndef WINDOWS
- rm -f $(APPS)
- else
- del /S /Q /F *.o *.exe
- endif
- list:
- echo $(APPS)
|