From eb53fffc011fc398cbb306dcdc0fe0cea3e89757 Mon Sep 17 00:00:00 2001 From: Alon Bar-Lev Date: Wed, 18 Feb 2015 17:23:17 +0200 Subject: [PATCH 1/7] build: Makefile: remove bashism Signed-off-by: Alon Bar-Lev --- tests/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Makefile b/tests/Makefile index f83d18689..e33fe52f7 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -433,7 +433,7 @@ ifndef WINDOWS RESULT=`$(CHECK_PRELOAD) ./$${i} | grep -v 'PASS$$' | grep -v -- '----' | grep -v '^$$'`; \ PASSED=`echo $$RESULT |grep PASSED`; \ echo " $$RESULT"; \ - if [ "$$PASSED" == "" ]; \ + if [ "$$PASSED" = "" ]; \ then \ echo "**** Failed ***************"; \ RETURN=1; \ From 06f0d26240f907e2395a45f5194750ca343c5b19 Mon Sep 17 00:00:00 2001 From: Alon Bar-Lev Date: Wed, 18 Feb 2015 17:18:28 +0200 Subject: [PATCH 2/7] build: Makefile: simplify root Makefile 1. Use $(MAKE) -C 2. Use target dependencies instead of dups. Signed-off-by: Alon Bar-Lev --- Makefile | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 808290da1..f9a4ce24c 100644 --- a/Makefile +++ b/Makefile @@ -5,17 +5,18 @@ OLDPREFIX=polarssl_ .SILENT: -all: - cd library && $(MAKE) all && cd .. - cd programs && $(MAKE) all && cd .. - cd tests && $(MAKE) all && cd .. +all: programs tests -no_test: - cd library && $(MAKE) all && cd .. - cd programs && $(MAKE) all && cd .. +no_test: programs + +programs: lib + $(MAKE) -C programs lib: - cd library && $(MAKE) all && cd .. + $(MAKE) -C library + +tests: lib + $(MAKE) -C tests install: mkdir -p $(DESTDIR)/include/polarssl @@ -51,13 +52,13 @@ uninstall: done clean: - cd library && $(MAKE) clean && cd .. - cd programs && $(MAKE) clean && cd .. - cd tests && $(MAKE) clean && cd .. + $(MAKE) -C library clean + $(MAKE) -C programs clean + $(MAKE) -C tests clean find . \( -name \*.gcno -o -name \*.gcda -o -name *.info \) -exec rm {} + -check: lib - ( cd tests && $(MAKE) && $(MAKE) check ) +check: tests + $(MAKE) -C tests check test-ref-configs: tests/scripts/test-ref-configs.pl From ada4105ba2f31be65489526f2900045f611e7bfb Mon Sep 17 00:00:00 2001 From: Alon Bar-Lev Date: Wed, 18 Feb 2015 17:47:52 +0200 Subject: [PATCH 3/7] build: Makefile: cleanup LDFLAGS LDFLAGS are reserved for external interaction via make variable, the following should work: $ make LDFLAGS="-L/xxx" $ LDFLAGS="-L/xxx" make 1. Move internal flags to LOCAL_LDFLAGS 2. Respect external LDFLAGS 3. LDFLAGS should be last linkage flags. Signed-off-by: Alon Bar-Lev --- library/Makefile | 14 +++--- programs/Makefile | 102 +++++++++++++++++++------------------- tests/Makefile | 122 +++++++++++++++++++++++----------------------- 3 files changed, 118 insertions(+), 120 deletions(-) diff --git a/library/Makefile b/library/Makefile index de00f7536..d28c1b2a8 100644 --- a/library/Makefile +++ b/library/Makefile @@ -1,11 +1,10 @@ # Also see "include/polarssl/config.h" -# To compile on MinGW: add "-lws2_32" to LDFLAGS or define WINDOWS in your -# environment -# CFLAGS += -I../include -D_FILE_OFFSET_BITS=64 -Wall -W -Wdeclaration-after-statement OFLAGS = -O2 +LDFLAGS ?= +LOCAL_LDFLAGS = ifdef DEBUG CFLAGS += -g3 @@ -26,7 +25,7 @@ endif ifdef SHARED # all code is position-indep with mingw, avoid warning about useless flag ifndef WINDOWS_BUILD -CFLAGS += -fPIC +LOCAL_CFLAGS += -fPIC endif endif @@ -39,7 +38,6 @@ DLEXT=so # Windows shared library extension: ifdef WINDOWS_BUILD DLEXT=dll -LDFLAGS += -lws2_32 endif OBJS= aes.o aesni.o arc4.o \ @@ -114,7 +112,7 @@ endif libmbedtls.$(SOEXT): $(OBJS) echo " LD $@" - $(CC) ${LDFLAGS} -shared -Wl,-soname,$@ -o $@ $(OBJS) + $(CC) -shared -Wl,-soname,$@ $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(OBJS) libmbedtls.so: libmbedtls.$(SOEXT) echo " LN $@ -> libmbedtls.$(SOEXT)" @@ -122,11 +120,11 @@ libmbedtls.so: libmbedtls.$(SOEXT) libmbedtls.dylib: $(OBJS) echo " LD $@" - $(CC) ${LDFLAGS} -dynamiclib -o $@ $(OBJS) + $(CC) -dynamiclib $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(OBJS) libmbedtls.dll: $(OBJS) echo " LD $@" - $(CC) -shared -Wl,-soname,$@ -Wl,--out-implib,$@.a -o $@ $(OBJS) -lws2_32 -lwinmm -lgdi32 + $(CC) -shared -Wl,-soname,$@ -Wl,--out-implib,$@.a -o $@ $(OBJS) -lws2_32 -lwinmm -lgdi32 $(LOCAL_LDFLAGS) $(LDFLAGS) .c.o: echo " CC $<" diff --git a/programs/Makefile b/programs/Makefile index c7aec12bc..8a326ea7c 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -1,11 +1,11 @@ # To compile on SunOS: add "-lsocket -lnsl" to LDFLAGS -# To compile on MinGW: add "-lws2_32" to LDFLAGS or define WINDOWS in your env # To compile with PKCS11: add "-lpkcs11-helper" to LDFLAGS CFLAGS += -I../include -D_FILE_OFFSET_BITS=64 -Wall -W -Wdeclaration-after-statement OFLAGS = -O2 -LDFLAGS += -L../library -lmbedtls$(SHARED_SUFFIX) $(SYS_LDFLAGS) +LDFLAGS ?= +LOCAL_LDFLAGS = -L../library -lmbedtls$(SHARED_SUFFIX) ifdef DEBUG CFLAGS += -g3 @@ -22,7 +22,7 @@ endif ifdef WINDOWS_BUILD DLEXT=dll EXEXT=.exe -LDFLAGS += -lws2_32 +LOCAL_LDFLAGS += -lws2_32 ifdef SHARED SHARED_SUFFIX=.$(DLEXT) endif @@ -30,7 +30,7 @@ endif # Zlib shared library extensions: ifdef ZLIB -LDFLAGS += -lz +LOCAL_LDFLAGS += -lz endif APPS = aes/aescrypt2$(EXEXT) aes/crypt_and_hash$(EXEXT) \ @@ -72,191 +72,191 @@ all: $(APPS) aes/aescrypt2$(EXEXT): aes/aescrypt2.c ../library/libmbedtls.a echo " CC aes/aescrypt2.c" - $(CC) $(CFLAGS) $(OFLAGS) aes/aescrypt2.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) aes/aescrypt2.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ aes/crypt_and_hash$(EXEXT): aes/crypt_and_hash.c ../library/libmbedtls.a echo " CC aes/crypt_and_hash.c" - $(CC) $(CFLAGS) $(OFLAGS) aes/crypt_and_hash.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) aes/crypt_and_hash.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ hash/hello$(EXEXT): hash/hello.c ../library/libmbedtls.a echo " CC hash/hello.c" - $(CC) $(CFLAGS) $(OFLAGS) hash/hello.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) hash/hello.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ hash/generic_sum$(EXEXT): hash/generic_sum.c ../library/libmbedtls.a echo " CC hash/generic_sum.c" - $(CC) $(CFLAGS) $(OFLAGS) hash/generic_sum.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) hash/generic_sum.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ hash/md5sum$(EXEXT): hash/md5sum.c ../library/libmbedtls.a echo " CC hash/md5sum.c" - $(CC) $(CFLAGS) $(OFLAGS) hash/md5sum.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) hash/md5sum.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ hash/sha1sum$(EXEXT): hash/sha1sum.c ../library/libmbedtls.a echo " CC hash/sha1sum.c" - $(CC) $(CFLAGS) $(OFLAGS) hash/sha1sum.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) hash/sha1sum.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ hash/sha2sum$(EXEXT): hash/sha2sum.c ../library/libmbedtls.a echo " CC hash/sha2sum.c" - $(CC) $(CFLAGS) $(OFLAGS) hash/sha2sum.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) hash/sha2sum.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/dh_client$(EXEXT): pkey/dh_client.c ../library/libmbedtls.a echo " CC pkey/dh_client.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/dh_client.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) pkey/dh_client.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/dh_genprime$(EXEXT): pkey/dh_genprime.c ../library/libmbedtls.a echo " CC pkey/dh_genprime.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/dh_genprime.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) pkey/dh_genprime.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/dh_server$(EXEXT): pkey/dh_server.c ../library/libmbedtls.a echo " CC pkey/dh_server.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/dh_server.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) pkey/dh_server.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/ecdsa$(EXEXT): pkey/ecdsa.c ../library/libmbedtls.a echo " CC pkey/ecdsa.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/ecdsa.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) pkey/ecdsa.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/gen_key$(EXEXT): pkey/gen_key.c ../library/libmbedtls.a echo " CC pkey/gen_key.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/gen_key.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) pkey/gen_key.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/key_app$(EXEXT): pkey/key_app.c ../library/libmbedtls.a echo " CC pkey/key_app.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/key_app.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) pkey/key_app.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/key_app_writer$(EXEXT): pkey/key_app_writer.c ../library/libmbedtls.a echo " CC pkey/key_app_writer.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/key_app_writer.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) pkey/key_app_writer.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/mpi_demo$(EXEXT): pkey/mpi_demo.c ../library/libmbedtls.a echo " CC pkey/mpi_demo.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/mpi_demo.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) pkey/mpi_demo.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/pk_decrypt$(EXEXT): pkey/pk_decrypt.c ../library/libmbedtls.a echo " CC pkey/pk_decrypt.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/pk_decrypt.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) pkey/pk_decrypt.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/pk_encrypt$(EXEXT): pkey/pk_encrypt.c ../library/libmbedtls.a echo " CC pkey/pk_encrypt.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/pk_encrypt.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) pkey/pk_encrypt.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/pk_sign$(EXEXT): pkey/pk_sign.c ../library/libmbedtls.a echo " CC pkey/pk_sign.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/pk_sign.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) pkey/pk_sign.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/pk_verify$(EXEXT): pkey/pk_verify.c ../library/libmbedtls.a echo " CC pkey/pk_verify.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/pk_verify.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) pkey/pk_verify.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/rsa_genkey$(EXEXT): pkey/rsa_genkey.c ../library/libmbedtls.a echo " CC pkey/rsa_genkey.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/rsa_genkey.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) pkey/rsa_genkey.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/rsa_sign$(EXEXT): pkey/rsa_sign.c ../library/libmbedtls.a echo " CC pkey/rsa_sign.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/rsa_sign.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) pkey/rsa_sign.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/rsa_verify$(EXEXT): pkey/rsa_verify.c ../library/libmbedtls.a echo " CC pkey/rsa_verify.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/rsa_verify.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) pkey/rsa_verify.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/rsa_sign_pss$(EXEXT): pkey/rsa_sign_pss.c ../library/libmbedtls.a echo " CC pkey/rsa_sign_pss.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/rsa_sign_pss.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) pkey/rsa_sign_pss.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/rsa_verify_pss$(EXEXT): pkey/rsa_verify_pss.c ../library/libmbedtls.a echo " CC pkey/rsa_verify_pss.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/rsa_verify_pss.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) pkey/rsa_verify_pss.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/rsa_decrypt$(EXEXT): pkey/rsa_decrypt.c ../library/libmbedtls.a echo " CC pkey/rsa_decrypt.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/rsa_decrypt.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) pkey/rsa_decrypt.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/rsa_encrypt$(EXEXT): pkey/rsa_encrypt.c ../library/libmbedtls.a echo " CC pkey/rsa_encrypt.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/rsa_encrypt.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) pkey/rsa_encrypt.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ random/gen_entropy$(EXEXT): random/gen_entropy.c ../library/libmbedtls.a echo " CC random/gen_entropy.c" - $(CC) $(CFLAGS) $(OFLAGS) random/gen_entropy.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) random/gen_entropy.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ random/gen_random_havege$(EXEXT): random/gen_random_havege.c ../library/libmbedtls.a echo " CC random/gen_random_havege.c" - $(CC) $(CFLAGS) $(OFLAGS) random/gen_random_havege.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) random/gen_random_havege.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ random/gen_random_ctr_drbg$(EXEXT): random/gen_random_ctr_drbg.c ../library/libmbedtls.a echo " CC random/gen_random_ctr_drbg.c" - $(CC) $(CFLAGS) $(OFLAGS) random/gen_random_ctr_drbg.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) random/gen_random_ctr_drbg.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ ssl/ssl_client1$(EXEXT): ssl/ssl_client1.c ../library/libmbedtls.a echo " CC ssl/ssl_client1.c" - $(CC) $(CFLAGS) $(OFLAGS) ssl/ssl_client1.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) ssl/ssl_client1.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ ssl/ssl_client2$(EXEXT): ssl/ssl_client2.c ../library/libmbedtls.a echo " CC ssl/ssl_client2.c" - $(CC) $(CFLAGS) $(OFLAGS) ssl/ssl_client2.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) ssl/ssl_client2.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ ssl/ssl_server$(EXEXT): ssl/ssl_server.c ../library/libmbedtls.a echo " CC ssl/ssl_server.c" - $(CC) $(CFLAGS) $(OFLAGS) ssl/ssl_server.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) ssl/ssl_server.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ ssl/ssl_server2$(EXEXT): ssl/ssl_server2.c ../library/libmbedtls.a echo " CC ssl/ssl_server2.c" - $(CC) $(CFLAGS) $(OFLAGS) ssl/ssl_server2.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) ssl/ssl_server2.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ ssl/ssl_fork_server$(EXEXT): ssl/ssl_fork_server.c ../library/libmbedtls.a echo " CC ssl/ssl_fork_server.c" - $(CC) $(CFLAGS) $(OFLAGS) ssl/ssl_fork_server.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) ssl/ssl_fork_server.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ ssl/ssl_pthread_server$(EXEXT): ssl/ssl_pthread_server.c ../library/libmbedtls.a echo " CC ssl/ssl_pthread_server.c" - $(CC) $(CFLAGS) $(OFLAGS) ssl/ssl_pthread_server.c $(LDFLAGS) -o $@ -lpthread + $(CC) $(CFLAGS) $(OFLAGS) ssl/ssl_pthread_server.c $(LOCAL_LDFLAGS) -lpthread $(LDFLAGS) -o $@ ssl/ssl_mail_client$(EXEXT): ssl/ssl_mail_client.c ../library/libmbedtls.a echo " CC ssl/ssl_mail_client.c" - $(CC) $(CFLAGS) $(OFLAGS) ssl/ssl_mail_client.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) ssl/ssl_mail_client.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ ssl/mini_client$(EXEXT): ssl/mini_client.c ../library/libmbedtls.a echo " CC ssl/mini_client.c" - $(CC) $(CFLAGS) $(OFLAGS) ssl/mini_client.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) ssl/mini_client.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test/ssl_cert_test$(EXEXT): test/ssl_cert_test.c ../library/libmbedtls.a echo " CC test/ssl_cert_test.c" - $(CC) $(CFLAGS) $(OFLAGS) test/ssl_cert_test.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) test/ssl_cert_test.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test/benchmark$(EXEXT): test/benchmark.c ../library/libmbedtls.a echo " CC test/benchmark.c" - $(CC) $(CFLAGS) $(OFLAGS) test/benchmark.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) test/benchmark.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test/selftest$(EXEXT): test/selftest.c ../library/libmbedtls.a echo " CC test/selftest.c" - $(CC) $(CFLAGS) $(OFLAGS) test/selftest.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) test/selftest.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test/ssl_test$(EXEXT): test/ssl_test.c ../library/libmbedtls.a echo " CC test/ssl_test.c" - $(CC) $(CFLAGS) $(OFLAGS) test/ssl_test.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) test/ssl_test.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test/o_p_test$(EXEXT): test/o_p_test.c ../library/libmbedtls.a echo " CC test/o_p_test.c" - $(CC) $(CFLAGS) $(OFLAGS) test/o_p_test.c $(LDFLAGS) -o $@ -lssl -lcrypto + $(CC) $(CFLAGS) $(OFLAGS) test/o_p_test.c $(LOCAL_LDFLAGS) -lssl -lcrypto $(LDFLAGS) -o $@ util/pem2der$(EXEXT): util/pem2der.c ../library/libmbedtls.a echo " CC util/pem2der.c" - $(CC) $(CFLAGS) $(OFLAGS) util/pem2der.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) util/pem2der.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ util/strerror$(EXEXT): util/strerror.c ../library/libmbedtls.a echo " CC util/strerror.c" - $(CC) $(CFLAGS) $(OFLAGS) util/strerror.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) util/strerror.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ x509/cert_app$(EXEXT): x509/cert_app.c ../library/libmbedtls.a echo " CC x509/cert_app.c" - $(CC) $(CFLAGS) $(OFLAGS) x509/cert_app.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) x509/cert_app.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ x509/crl_app$(EXEXT): x509/crl_app.c ../library/libmbedtls.a echo " CC x509/crl_app.c" - $(CC) $(CFLAGS) $(OFLAGS) x509/crl_app.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) x509/crl_app.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ x509/cert_req$(EXEXT): x509/cert_req.c ../library/libmbedtls.a echo " CC x509/cert_req.c" - $(CC) $(CFLAGS) $(OFLAGS) x509/cert_req.c $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) x509/cert_req.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ clean: ifndef WINDOWS diff --git a/tests/Makefile b/tests/Makefile index e33fe52f7..6de570965 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,13 +1,13 @@ # To compile on SunOS: add "-lsocket -lnsl" to LDFLAGS -# To compile on MinGW: add "-lws2_32" to LDFLAGS or define WINDOWS in your env # To compile with PKCS11: add "-lpkcs11-helper" to LDFLAGS CFLAGS += -I../include -D_FILE_OFFSET_BITS=64 -Wall -W -Wdeclaration-after-statement \ -Wno-unused-function -Wno-unused-value OFLAGS = -O2 -LDFLAGS += -L../library -lmbedtls$(SHARED_SUFFIX) $(SYS_LDFLAGS) +LDFLAGS ?= +LOCAL_LDFLAGS = -L../library -lmbedtls$(SHARED_SUFFIX) DLEXT=so ifndef SHARED @@ -33,7 +33,7 @@ endif ifdef WINDOWS_BUILD DLEXT=dll EXEXT=.exe -LDFLAGS += -lws2_32 +LOCAL_LDFLAGS += -lws2_32 ifdef SHARED SHARED_SUFFIX=.$(DLEXT) endif @@ -41,7 +41,7 @@ endif # Zlib shared library extensions: ifdef ZLIB -LDFLAGS += -lz +LOCAL_LDFLAGS += -lz endif APPS = test_suite_aes.ecb$(EXEXT) test_suite_aes.cbc$(EXEXT) \ @@ -189,231 +189,231 @@ test_suite_hmac_drbg.pr.c : suites/test_suite_hmac_drbg.function suites/test_sui test_suite_aes.ecb$(EXEXT): test_suite_aes.ecb.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_aes.cbc$(EXEXT): test_suite_aes.cbc.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_aes.cfb$(EXEXT): test_suite_aes.cfb.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_aes.rest$(EXEXT): test_suite_aes.rest.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_arc4$(EXEXT): test_suite_arc4.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_asn1write$(EXEXT): test_suite_asn1write.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_base64$(EXEXT): test_suite_base64.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_blowfish$(EXEXT): test_suite_blowfish.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_camellia$(EXEXT): test_suite_camellia.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_ccm$(EXEXT): test_suite_ccm.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_cipher.aes$(EXEXT): test_suite_cipher.aes.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_cipher.arc4$(EXEXT): test_suite_cipher.arc4.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_cipher.ccm$(EXEXT): test_suite_cipher.ccm.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_cipher.gcm$(EXEXT): test_suite_cipher.gcm.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_cipher.blowfish$(EXEXT): test_suite_cipher.blowfish.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_cipher.camellia$(EXEXT): test_suite_cipher.camellia.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_cipher.des$(EXEXT): test_suite_cipher.des.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_cipher.null$(EXEXT): test_suite_cipher.null.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_cipher.padding$(EXEXT): test_suite_cipher.padding.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_ctr_drbg$(EXEXT): test_suite_ctr_drbg.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_des$(EXEXT): test_suite_des.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_dhm$(EXEXT): test_suite_dhm.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_ecdh$(EXEXT): test_suite_ecdh.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_ecdsa$(EXEXT): test_suite_ecdsa.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_ecp$(EXEXT): test_suite_ecp.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_entropy$(EXEXT): test_suite_entropy.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_error$(EXEXT): test_suite_error.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_gcm.aes128_de$(EXEXT): test_suite_gcm.aes128_de.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_gcm.aes192_de$(EXEXT): test_suite_gcm.aes192_de.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_gcm.aes256_de$(EXEXT): test_suite_gcm.aes256_de.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_gcm.aes128_en$(EXEXT): test_suite_gcm.aes128_en.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_gcm.aes192_en$(EXEXT): test_suite_gcm.aes192_en.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_gcm.aes256_en$(EXEXT): test_suite_gcm.aes256_en.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_gcm.camellia$(EXEXT): test_suite_gcm.camellia.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_hmac_drbg.misc$(EXEXT): test_suite_hmac_drbg.misc.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_hmac_drbg.no_reseed$(EXEXT): test_suite_hmac_drbg.no_reseed.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_hmac_drbg.nopr$(EXEXT): test_suite_hmac_drbg.nopr.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_hmac_drbg.pr$(EXEXT): test_suite_hmac_drbg.pr.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_hmac_shax$(EXEXT): test_suite_hmac_shax.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_md$(EXEXT): test_suite_md.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_mdx$(EXEXT): test_suite_mdx.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_memory_buffer_alloc$(EXEXT): test_suite_memory_buffer_alloc.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_mpi$(EXEXT): test_suite_mpi.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_pbkdf2$(EXEXT): test_suite_pbkdf2.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_pem$(EXEXT): test_suite_pem.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_pkcs1_v21$(EXEXT): test_suite_pkcs1_v21.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_pkcs5$(EXEXT): test_suite_pkcs5.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_pkparse$(EXEXT): test_suite_pkparse.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_pkwrite$(EXEXT): test_suite_pkwrite.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_pk$(EXEXT): test_suite_pk.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_rsa$(EXEXT): test_suite_rsa.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_shax$(EXEXT): test_suite_shax.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_x509parse$(EXEXT): test_suite_x509parse.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_x509write$(EXEXT): test_suite_x509write.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_xtea$(EXEXT): test_suite_xtea.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_debug$(EXEXT): test_suite_debug.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_version$(EXEXT): test_suite_version.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ clean: ifndef WINDOWS From f7a9f303484a9ffeb59e80f5534b78d370218a65 Mon Sep 17 00:00:00 2001 From: Alon Bar-Lev Date: Wed, 18 Feb 2015 17:55:05 +0200 Subject: [PATCH 4/7] build: Makefile: cleanup CFLAGS CFLAGS are reserved for external interaction via make variable, the following should work: $ make CFLAGS="-O3" $ CFLAGS="-O3" make 1. Move internal flags to LOCAL_CFLAGS 2. Respect external CFLAGS 3. CFLAGS should be last compiler flags. 4. Default CFLAGS is -O optimization, remove OFLAGS. 5. Add WARNING_CFLAGS to control warning setting and enable to remove if compiler does not support flags. Signed-off-by: Alon Bar-Lev --- library/Makefile | 12 +++-- programs/Makefile | 102 +++++++++++++++++++------------------- tests/Makefile | 124 +++++++++++++++++++++++----------------------- 3 files changed, 121 insertions(+), 117 deletions(-) diff --git a/library/Makefile b/library/Makefile index d28c1b2a8..d099471d2 100644 --- a/library/Makefile +++ b/library/Makefile @@ -1,13 +1,15 @@ # Also see "include/polarssl/config.h" -CFLAGS += -I../include -D_FILE_OFFSET_BITS=64 -Wall -W -Wdeclaration-after-statement -OFLAGS = -O2 +CFLAGS ?= -O2 +WARNING_CFLAGS ?= -Wall -W -Wdeclaration-after-statement LDFLAGS ?= + +LOCAL_CFLAGS = $(WARNING_CFLAGS) -I../include -D_FILE_OFFSET_BITS=64 LOCAL_LDFLAGS = ifdef DEBUG -CFLAGS += -g3 +LOCAL_CFLAGS += -g3 endif # MicroBlaze specific options: @@ -25,7 +27,7 @@ endif ifdef SHARED # all code is position-indep with mingw, avoid warning about useless flag ifndef WINDOWS_BUILD -LOCAL_CFLAGS += -fPIC +LOCAL_CFLAGS += -fPIC -fpic endif endif @@ -128,7 +130,7 @@ libmbedtls.dll: $(OBJS) .c.o: echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) -c $< + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) -c $< clean: ifndef WINDOWS diff --git a/programs/Makefile b/programs/Makefile index 8a326ea7c..3f6a9330d 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -2,13 +2,15 @@ # To compile on SunOS: add "-lsocket -lnsl" to LDFLAGS # To compile with PKCS11: add "-lpkcs11-helper" to LDFLAGS -CFLAGS += -I../include -D_FILE_OFFSET_BITS=64 -Wall -W -Wdeclaration-after-statement -OFLAGS = -O2 +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) ifdef DEBUG -CFLAGS += -g3 +LOCAL_CFLAGS += -g3 endif # @@ -72,191 +74,191 @@ all: $(APPS) aes/aescrypt2$(EXEXT): aes/aescrypt2.c ../library/libmbedtls.a echo " CC aes/aescrypt2.c" - $(CC) $(CFLAGS) $(OFLAGS) aes/aescrypt2.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) aes/aescrypt2.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ aes/crypt_and_hash$(EXEXT): aes/crypt_and_hash.c ../library/libmbedtls.a echo " CC aes/crypt_and_hash.c" - $(CC) $(CFLAGS) $(OFLAGS) aes/crypt_and_hash.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) aes/crypt_and_hash.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ hash/hello$(EXEXT): hash/hello.c ../library/libmbedtls.a echo " CC hash/hello.c" - $(CC) $(CFLAGS) $(OFLAGS) hash/hello.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) hash/hello.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ hash/generic_sum$(EXEXT): hash/generic_sum.c ../library/libmbedtls.a echo " CC hash/generic_sum.c" - $(CC) $(CFLAGS) $(OFLAGS) hash/generic_sum.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) hash/generic_sum.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ hash/md5sum$(EXEXT): hash/md5sum.c ../library/libmbedtls.a echo " CC hash/md5sum.c" - $(CC) $(CFLAGS) $(OFLAGS) hash/md5sum.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) hash/md5sum.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ hash/sha1sum$(EXEXT): hash/sha1sum.c ../library/libmbedtls.a echo " CC hash/sha1sum.c" - $(CC) $(CFLAGS) $(OFLAGS) hash/sha1sum.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) hash/sha1sum.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ hash/sha2sum$(EXEXT): hash/sha2sum.c ../library/libmbedtls.a echo " CC hash/sha2sum.c" - $(CC) $(CFLAGS) $(OFLAGS) hash/sha2sum.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) hash/sha2sum.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/dh_client$(EXEXT): pkey/dh_client.c ../library/libmbedtls.a echo " CC pkey/dh_client.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/dh_client.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/dh_client.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/dh_genprime$(EXEXT): pkey/dh_genprime.c ../library/libmbedtls.a echo " CC pkey/dh_genprime.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/dh_genprime.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/dh_genprime.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/dh_server$(EXEXT): pkey/dh_server.c ../library/libmbedtls.a echo " CC pkey/dh_server.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/dh_server.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/dh_server.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/ecdsa$(EXEXT): pkey/ecdsa.c ../library/libmbedtls.a echo " CC pkey/ecdsa.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/ecdsa.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/ecdsa.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/gen_key$(EXEXT): pkey/gen_key.c ../library/libmbedtls.a echo " CC pkey/gen_key.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/gen_key.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/gen_key.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/key_app$(EXEXT): pkey/key_app.c ../library/libmbedtls.a echo " CC pkey/key_app.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/key_app.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/key_app.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/key_app_writer$(EXEXT): pkey/key_app_writer.c ../library/libmbedtls.a echo " CC pkey/key_app_writer.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/key_app_writer.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/key_app_writer.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/mpi_demo$(EXEXT): pkey/mpi_demo.c ../library/libmbedtls.a echo " CC pkey/mpi_demo.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/mpi_demo.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/mpi_demo.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/pk_decrypt$(EXEXT): pkey/pk_decrypt.c ../library/libmbedtls.a echo " CC pkey/pk_decrypt.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/pk_decrypt.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/pk_decrypt.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/pk_encrypt$(EXEXT): pkey/pk_encrypt.c ../library/libmbedtls.a echo " CC pkey/pk_encrypt.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/pk_encrypt.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/pk_encrypt.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/pk_sign$(EXEXT): pkey/pk_sign.c ../library/libmbedtls.a echo " CC pkey/pk_sign.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/pk_sign.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/pk_sign.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/pk_verify$(EXEXT): pkey/pk_verify.c ../library/libmbedtls.a echo " CC pkey/pk_verify.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/pk_verify.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/pk_verify.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/rsa_genkey$(EXEXT): pkey/rsa_genkey.c ../library/libmbedtls.a echo " CC pkey/rsa_genkey.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/rsa_genkey.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/rsa_genkey.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/rsa_sign$(EXEXT): pkey/rsa_sign.c ../library/libmbedtls.a echo " CC pkey/rsa_sign.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/rsa_sign.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/rsa_sign.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/rsa_verify$(EXEXT): pkey/rsa_verify.c ../library/libmbedtls.a echo " CC pkey/rsa_verify.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/rsa_verify.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/rsa_verify.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/rsa_sign_pss$(EXEXT): pkey/rsa_sign_pss.c ../library/libmbedtls.a echo " CC pkey/rsa_sign_pss.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/rsa_sign_pss.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/rsa_sign_pss.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/rsa_verify_pss$(EXEXT): pkey/rsa_verify_pss.c ../library/libmbedtls.a echo " CC pkey/rsa_verify_pss.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/rsa_verify_pss.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/rsa_verify_pss.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/rsa_decrypt$(EXEXT): pkey/rsa_decrypt.c ../library/libmbedtls.a echo " CC pkey/rsa_decrypt.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/rsa_decrypt.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/rsa_decrypt.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ pkey/rsa_encrypt$(EXEXT): pkey/rsa_encrypt.c ../library/libmbedtls.a echo " CC pkey/rsa_encrypt.c" - $(CC) $(CFLAGS) $(OFLAGS) pkey/rsa_encrypt.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/rsa_encrypt.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ random/gen_entropy$(EXEXT): random/gen_entropy.c ../library/libmbedtls.a echo " CC random/gen_entropy.c" - $(CC) $(CFLAGS) $(OFLAGS) random/gen_entropy.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) random/gen_entropy.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ random/gen_random_havege$(EXEXT): random/gen_random_havege.c ../library/libmbedtls.a echo " CC random/gen_random_havege.c" - $(CC) $(CFLAGS) $(OFLAGS) random/gen_random_havege.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(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 ../library/libmbedtls.a echo " CC random/gen_random_ctr_drbg.c" - $(CC) $(CFLAGS) $(OFLAGS) random/gen_random_ctr_drbg.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) random/gen_random_ctr_drbg.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ ssl/ssl_client1$(EXEXT): ssl/ssl_client1.c ../library/libmbedtls.a echo " CC ssl/ssl_client1.c" - $(CC) $(CFLAGS) $(OFLAGS) ssl/ssl_client1.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_client1.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ ssl/ssl_client2$(EXEXT): ssl/ssl_client2.c ../library/libmbedtls.a echo " CC ssl/ssl_client2.c" - $(CC) $(CFLAGS) $(OFLAGS) ssl/ssl_client2.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_client2.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ ssl/ssl_server$(EXEXT): ssl/ssl_server.c ../library/libmbedtls.a echo " CC ssl/ssl_server.c" - $(CC) $(CFLAGS) $(OFLAGS) ssl/ssl_server.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_server.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ ssl/ssl_server2$(EXEXT): ssl/ssl_server2.c ../library/libmbedtls.a echo " CC ssl/ssl_server2.c" - $(CC) $(CFLAGS) $(OFLAGS) ssl/ssl_server2.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_server2.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ ssl/ssl_fork_server$(EXEXT): ssl/ssl_fork_server.c ../library/libmbedtls.a echo " CC ssl/ssl_fork_server.c" - $(CC) $(CFLAGS) $(OFLAGS) ssl/ssl_fork_server.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_fork_server.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ ssl/ssl_pthread_server$(EXEXT): ssl/ssl_pthread_server.c ../library/libmbedtls.a echo " CC ssl/ssl_pthread_server.c" - $(CC) $(CFLAGS) $(OFLAGS) ssl/ssl_pthread_server.c $(LOCAL_LDFLAGS) -lpthread $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_pthread_server.c $(LOCAL_LDFLAGS) -lpthread $(LDFLAGS) -o $@ ssl/ssl_mail_client$(EXEXT): ssl/ssl_mail_client.c ../library/libmbedtls.a echo " CC ssl/ssl_mail_client.c" - $(CC) $(CFLAGS) $(OFLAGS) ssl/ssl_mail_client.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_mail_client.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ ssl/mini_client$(EXEXT): ssl/mini_client.c ../library/libmbedtls.a echo " CC ssl/mini_client.c" - $(CC) $(CFLAGS) $(OFLAGS) ssl/mini_client.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/mini_client.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test/ssl_cert_test$(EXEXT): test/ssl_cert_test.c ../library/libmbedtls.a echo " CC test/ssl_cert_test.c" - $(CC) $(CFLAGS) $(OFLAGS) test/ssl_cert_test.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/ssl_cert_test.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test/benchmark$(EXEXT): test/benchmark.c ../library/libmbedtls.a echo " CC test/benchmark.c" - $(CC) $(CFLAGS) $(OFLAGS) test/benchmark.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/benchmark.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test/selftest$(EXEXT): test/selftest.c ../library/libmbedtls.a echo " CC test/selftest.c" - $(CC) $(CFLAGS) $(OFLAGS) test/selftest.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/selftest.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test/ssl_test$(EXEXT): test/ssl_test.c ../library/libmbedtls.a echo " CC test/ssl_test.c" - $(CC) $(CFLAGS) $(OFLAGS) test/ssl_test.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/ssl_test.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test/o_p_test$(EXEXT): test/o_p_test.c ../library/libmbedtls.a echo " CC test/o_p_test.c" - $(CC) $(CFLAGS) $(OFLAGS) test/o_p_test.c $(LOCAL_LDFLAGS) -lssl -lcrypto $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/o_p_test.c $(LOCAL_LDFLAGS) -lssl -lcrypto $(LDFLAGS) -o $@ util/pem2der$(EXEXT): util/pem2der.c ../library/libmbedtls.a echo " CC util/pem2der.c" - $(CC) $(CFLAGS) $(OFLAGS) util/pem2der.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) util/pem2der.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ util/strerror$(EXEXT): util/strerror.c ../library/libmbedtls.a echo " CC util/strerror.c" - $(CC) $(CFLAGS) $(OFLAGS) util/strerror.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) util/strerror.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ x509/cert_app$(EXEXT): x509/cert_app.c ../library/libmbedtls.a echo " CC x509/cert_app.c" - $(CC) $(CFLAGS) $(OFLAGS) x509/cert_app.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) x509/cert_app.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ x509/crl_app$(EXEXT): x509/crl_app.c ../library/libmbedtls.a echo " CC x509/crl_app.c" - $(CC) $(CFLAGS) $(OFLAGS) x509/crl_app.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) x509/crl_app.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ x509/cert_req$(EXEXT): x509/cert_req.c ../library/libmbedtls.a echo " CC x509/cert_req.c" - $(CC) $(CFLAGS) $(OFLAGS) x509/cert_req.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) x509/cert_req.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ clean: ifndef WINDOWS diff --git a/tests/Makefile b/tests/Makefile index 6de570965..180da87da 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -2,11 +2,11 @@ # To compile on SunOS: add "-lsocket -lnsl" to LDFLAGS # To compile with PKCS11: add "-lpkcs11-helper" to LDFLAGS -CFLAGS += -I../include -D_FILE_OFFSET_BITS=64 -Wall -W -Wdeclaration-after-statement \ - -Wno-unused-function -Wno-unused-value - -OFLAGS = -O2 +CFLAGS ?= -O2 +WARNING_CFLAGS ?= -Wall -W -Wdeclaration-after-statement -Wno-unused-function -Wno-unused-value LDFLAGS ?= + +LOCAL_CFLAGS = $(WARNING_CFLAGS) -I../include -D_FILE_OFFSET_BITS=64 LOCAL_LDFLAGS = -L../library -lmbedtls$(SHARED_SUFFIX) DLEXT=so @@ -19,7 +19,7 @@ CHECK_PRELOAD= LD_PRELOAD=../library/libmbedtls.$(DLEXT) endif ifdef DEBUG -CFLAGS += -g3 +LOCAL_CFLAGS += -g3 endif # @@ -189,231 +189,231 @@ test_suite_hmac_drbg.pr.c : suites/test_suite_hmac_drbg.function suites/test_sui test_suite_aes.ecb$(EXEXT): test_suite_aes.ecb.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_aes.cbc$(EXEXT): test_suite_aes.cbc.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_aes.cfb$(EXEXT): test_suite_aes.cfb.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_aes.rest$(EXEXT): test_suite_aes.rest.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_arc4$(EXEXT): test_suite_arc4.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_asn1write$(EXEXT): test_suite_asn1write.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_base64$(EXEXT): test_suite_base64.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_blowfish$(EXEXT): test_suite_blowfish.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_camellia$(EXEXT): test_suite_camellia.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_ccm$(EXEXT): test_suite_ccm.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_cipher.aes$(EXEXT): test_suite_cipher.aes.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_cipher.arc4$(EXEXT): test_suite_cipher.arc4.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_cipher.ccm$(EXEXT): test_suite_cipher.ccm.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_cipher.gcm$(EXEXT): test_suite_cipher.gcm.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_cipher.blowfish$(EXEXT): test_suite_cipher.blowfish.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_cipher.camellia$(EXEXT): test_suite_cipher.camellia.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_cipher.des$(EXEXT): test_suite_cipher.des.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_cipher.null$(EXEXT): test_suite_cipher.null.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_cipher.padding$(EXEXT): test_suite_cipher.padding.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_ctr_drbg$(EXEXT): test_suite_ctr_drbg.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_des$(EXEXT): test_suite_des.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_dhm$(EXEXT): test_suite_dhm.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_ecdh$(EXEXT): test_suite_ecdh.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_ecdsa$(EXEXT): test_suite_ecdsa.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_ecp$(EXEXT): test_suite_ecp.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_entropy$(EXEXT): test_suite_entropy.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_error$(EXEXT): test_suite_error.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_gcm.aes128_de$(EXEXT): test_suite_gcm.aes128_de.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_gcm.aes192_de$(EXEXT): test_suite_gcm.aes192_de.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_gcm.aes256_de$(EXEXT): test_suite_gcm.aes256_de.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_gcm.aes128_en$(EXEXT): test_suite_gcm.aes128_en.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_gcm.aes192_en$(EXEXT): test_suite_gcm.aes192_en.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_gcm.aes256_en$(EXEXT): test_suite_gcm.aes256_en.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_gcm.camellia$(EXEXT): test_suite_gcm.camellia.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_hmac_drbg.misc$(EXEXT): test_suite_hmac_drbg.misc.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_hmac_drbg.no_reseed$(EXEXT): test_suite_hmac_drbg.no_reseed.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_hmac_drbg.nopr$(EXEXT): test_suite_hmac_drbg.nopr.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_hmac_drbg.pr$(EXEXT): test_suite_hmac_drbg.pr.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_hmac_shax$(EXEXT): test_suite_hmac_shax.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_md$(EXEXT): test_suite_md.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_mdx$(EXEXT): test_suite_mdx.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_memory_buffer_alloc$(EXEXT): test_suite_memory_buffer_alloc.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_mpi$(EXEXT): test_suite_mpi.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_pbkdf2$(EXEXT): test_suite_pbkdf2.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_pem$(EXEXT): test_suite_pem.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_pkcs1_v21$(EXEXT): test_suite_pkcs1_v21.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_pkcs5$(EXEXT): test_suite_pkcs5.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_pkparse$(EXEXT): test_suite_pkparse.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_pkwrite$(EXEXT): test_suite_pkwrite.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_pk$(EXEXT): test_suite_pk.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_rsa$(EXEXT): test_suite_rsa.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_shax$(EXEXT): test_suite_shax.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_x509parse$(EXEXT): test_suite_x509parse.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_x509write$(EXEXT): test_suite_x509write.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_xtea$(EXEXT): test_suite_xtea.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_debug$(EXEXT): test_suite_debug.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ test_suite_version$(EXEXT): test_suite_version.c $(DEP) echo " CC $<" - $(CC) $(CFLAGS) $(OFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ clean: ifndef WINDOWS From 40f315ac1649d21009dffa2a8d53a923c310d641 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Fri, 13 Mar 2015 13:49:26 +0000 Subject: [PATCH 5/7] Document recent make changes --- ChangeLog | 3 +++ README.rst | 2 ++ 2 files changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index 46ef674a3..c750144da 100644 --- a/ChangeLog +++ b/ChangeLog @@ -31,6 +31,9 @@ Bugfix * Add missing extern "C" guard in aesni.h (reported by amir zamani). Changes + * Adjusting/overriding CFLAGS and LDFLAGS with the make build syste is now + more flexible (warning: OFLAGS is not used any more) (see the README) + (contributed by Alon Bar-Lev). * ssl_set_own_cert() now longers calls pk_check_pair() since the performance impact was bad for some users (this was introduced in 1.3.10). * Move from SHA-1 to SHA-256 in example programs using signatures diff --git a/README.rst b/README.rst index 03aec3156..ae335f88f 100644 --- a/README.rst +++ b/README.rst @@ -37,6 +37,8 @@ In order to run the tests, enter:: In order to build for a Windows platform, you should use WINDOWS_BUILD=1 if the target is Windows but the build environment is Unix-like (eg when cross-compiling, or compiling from an MSYS shell), and WINDOWS=1 if the build environment is a Windows shell. +Setting the variable SHARED in your environment will build a shared library in addition to the static library. Setting DEBUG gives you a debug build. You can override CFLAGS and LDFLAGS by setting them in your environment or on the make command line; if you do so, essential parts such as -I will still be preserved. Warning options may be overridden separately using WARNING_CFLAGS. + Depending on your platform, you might run into some issues. Please check the Makefiles in *library/*, *programs/* and *tests/* for options to manually add or remove for specific platforms. You can also check `the mbed TLS Knowledge Base `_ for articles on your platform or issue. In case you find that you need to do something else as well, please let us know what, so we can add it to the KB. From 61fe8b02909f638a77918af090315e995bec7d10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Fri, 13 Mar 2015 14:33:16 +0000 Subject: [PATCH 6/7] Add more -O level variety in all.sh --- tests/scripts/all.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/scripts/all.sh b/tests/scripts/all.sh index 83e3caf87..14c925d41 100755 --- a/tests/scripts/all.sh +++ b/tests/scripts/all.sh @@ -129,9 +129,9 @@ cleanup cmake -D CMAKE_BUILD_TYPE:String=Debug . tests/scripts/curves.pl -msg "build: Unix make, -O2 (gcc)" # ~ 30s +msg "build: Unix make, -Os (gcc)" # ~ 30s cleanup -CC=gcc CFLAGS=-Werror make +CC=gcc CFLAGS='-Werror -Os' make # this is meant to cath missing #define polarssl_printf etc # disable fsio to catch some more missing #include @@ -144,7 +144,7 @@ scripts/config.pl unset POLARSSL_PLATFORM_MEMORY scripts/config.pl unset POLARSSL_MEMORY_C scripts/config.pl unset POLARSSL_MEMORY_BUFFER_ALLOC_C scripts/config.pl unset POLARSSL_FS_IO -CC=gcc CFLAGS=-Werror make +CC=gcc CFLAGS='-Werror -O0' make if uname -a | grep -F x86_64 >/dev/null; then msg "build: i386, make, gcc" # ~ 30s From 129e41322b7c9bb5d366e052ee5c6df2c9c09824 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Fri, 13 Mar 2015 17:29:18 +0100 Subject: [PATCH 7/7] Actually use armcc for the armcc test ^^' --- tests/scripts/all.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/scripts/all.sh b/tests/scripts/all.sh index 14c925d41..904ea4bb5 100755 --- a/tests/scripts/all.sh +++ b/tests/scripts/all.sh @@ -184,8 +184,11 @@ scripts/config.pl unset POLARSSL_THREADING_PTHREAD scripts/config.pl unset POLARSSL_THREADING_C scripts/config.pl unset POLARSSL_MEMORY_BACKTRACE # execinfo.h scripts/config.pl unset POLARSSL_MEMORY_BUFFER_ALLOC_C # calls exit -CC=arm-none-eabi-gcc CFLAGS=-Werror make lib 2> armcc.stderr -grep -v '^ar: creating' armcc.stderr || exit 1 +CC=armcc WARNING_CFLAGS= make lib 2> armcc.stderr +if [ -s armcc.stderr ]; then + cat armcc.stderr + exit 1; +fi rm armcc.stderr fi # armcc