diff --git a/library/Makefile b/library/Makefile index b155c720e..60e9cbcc4 100644 --- a/library/Makefile +++ b/library/Makefile @@ -35,16 +35,26 @@ SOEXT_TLS=so.10 SOEXT_X509=so.0 SOEXT_CRYPTO=so.2 -# Set DLEXT=dylib to compile as a shared library for Mac OS X DLEXT ?= so # Set AR_DASH= (empty string) to use an ar implentation that does not accept # the - prefix for command line options (e.g. llvm-ar) AR_DASH ?= - -# Windows shared library extension: +ifdef APPLE_BUILD +ARFLAGS = $(AR_DASH)Src +RLFLAGS = -no_warning_for_no_symbols -c +RL ?= ranlib +else +ARFLAGS = $(AR_DASH)src +endif + ifdef WINDOWS_BUILD -DLEXT=dll +# Windows shared library extension: +DLEXT = dll +else ifdef APPLE_BUILD +# Mac OS X shared library extension: +DLEXT = dylib endif OBJS_CRYPTO= aes.o aesni.o arc4.o \ @@ -95,9 +105,11 @@ shared: libmbedcrypto.$(DLEXT) libmbedx509.$(DLEXT) libmbedtls.$(DLEXT) # tls libmbedtls.a: $(OBJS_TLS) echo " AR $@" - $(AR) $(AR_DASH)rc $@ $(OBJS_TLS) + $(AR) $(ARFLAGS) $@ $(OBJS_TLS) +ifdef APPLE_BUILD echo " RL $@" - $(AR) $(AR_DASH)s $@ + $(RL) $(RLFLAGS) $@ +endif libmbedtls.$(SOEXT_TLS): $(OBJS_TLS) libmbedx509.so echo " LD $@" @@ -118,9 +130,11 @@ libmbedtls.dll: $(OBJS_TLS) libmbedx509.dll # x509 libmbedx509.a: $(OBJS_X509) echo " AR $@" - $(AR) $(AR_DASH)rc $@ $(OBJS_X509) + $(AR) $(ARFLAGS) $@ $(OBJS_X509) +ifdef APPLE_BUILD echo " RL $@" - $(AR) $(AR_DASH)s $@ + $(RL) $(RLFLAGS) $@ +endif libmbedx509.$(SOEXT_X509): $(OBJS_X509) libmbedcrypto.so echo " LD $@" @@ -141,9 +155,11 @@ libmbedx509.dll: $(OBJS_X509) libmbedcrypto.dll # crypto libmbedcrypto.a: $(OBJS_CRYPTO) echo " AR $@" - $(AR) $(AR_DASH)rc $@ $(OBJS_CRYPTO) + $(AR) $(ARFLAGS) $@ $(OBJS_CRYPTO) +ifdef APPLE_BUILD echo " RL $@" - $(AR) $(AR_DASH)s $@ + $(RL) $(RLFLAGS) $@ +endif libmbedcrypto.$(SOEXT_CRYPTO): $(OBJS_CRYPTO) echo " LD $@"