Makefile 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. #
  2. # Copyright (c) 2007, Cameron Rich
  3. #
  4. # All rights reserved.
  5. #
  6. # Redistribution and use in source and binary forms, with or without
  7. # modification, are permitted provided that the following conditions are met:
  8. #
  9. # * Redistributions of source code must retain the above copyright notice,
  10. # this list of conditions and the following disclaimer.
  11. # * Redistributions in binary form must reproduce the above copyright
  12. # notice, this list of conditions and the following disclaimer in the
  13. # documentation and/or other materials provided with the distribution.
  14. # * Neither the name of the axTLS project nor the names of its
  15. # contributors may be used to endorse or promote products derived
  16. # from this software without specific prior written permission.
  17. #
  18. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  19. # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  20. # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  21. # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  22. # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  23. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
  24. # TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  25. # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  26. # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  27. # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  28. # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. #
  30. AXTLS_HOME=..
  31. include $(AXTLS_HOME)/config/.config
  32. include $(AXTLS_HOME)/config/makefile.conf
  33. all: libs
  34. ifdef CONFIG_PERFORMANCE_TESTING
  35. $(MAKE) -C test
  36. else
  37. ifdef CONFIG_SSL_TEST
  38. $(MAKE) -C test
  39. endif
  40. endif
  41. ifndef CONFIG_PLATFORM_WIN32
  42. TARGET1=$(AXTLS_HOME)/$(STAGE)/libaxtls.a
  43. BASETARGET=libaxtls.so
  44. CRYPTO_PATH=$(AXTLS_HOME)/crypto/
  45. ifdef CONFIG_PLATFORM_CYGWIN
  46. TARGET2=$(AXTLS_HOME)/$(STAGE)/libaxtls.dll.a
  47. else
  48. TARGET2=$(AXTLS_HOME)/$(STAGE)/$(LIBMINOR)
  49. endif
  50. # shared library major/minor numbers
  51. LIBMAJOR=$(BASETARGET).1
  52. LIBMINOR=$(BASETARGET).1.2
  53. else
  54. TARGET1=$(AXTLS_HOME)/$(STAGE)/axtls.lib
  55. TARGET2=$(AXTLS_HOME)/$(STAGE)/axtls.dll
  56. STATIC_LIB=$(AXTLS_HOME)/$(STAGE)/axtls.static.lib
  57. CRYPTO_PATH=$(AXTLS_HOME)\\crypto\\
  58. endif
  59. libs: $(TARGET1) $(TARGET2)
  60. CRYPTO_OBJ=\
  61. $(CRYPTO_PATH)aes.o \
  62. $(CRYPTO_PATH)bigint.o \
  63. $(CRYPTO_PATH)crypto_misc.o \
  64. $(CRYPTO_PATH)hmac.o \
  65. $(CRYPTO_PATH)md2.o \
  66. $(CRYPTO_PATH)md5.o \
  67. $(CRYPTO_PATH)rc4.o \
  68. $(CRYPTO_PATH)rsa.o \
  69. $(CRYPTO_PATH)sha1.o
  70. OBJ=\
  71. asn1.o \
  72. gen_cert.o \
  73. loader.o \
  74. openssl.o \
  75. os_port.o \
  76. p12.o \
  77. tls1.o \
  78. tls1_svr.o \
  79. tls1_clnt.o \
  80. x509.o
  81. include $(AXTLS_HOME)/config/makefile.post
  82. ifndef CONFIG_PLATFORM_WIN32 # Linux/Unix/Cygwin
  83. $(TARGET1) : $(OBJ)
  84. $(AR) -r $@ $(CRYPTO_OBJ) $(OBJ)
  85. $(TARGET2) : $(OBJ)
  86. ifndef CONFIG_PLATFORM_CYGWIN
  87. $(LD) $(LDFLAGS) $(LDSHARED) -o $(AXTLS_HOME)/$(STAGE)/$(LIBMINOR) $(CRYPTO_OBJ) $(OBJ)
  88. cd $(AXTLS_HOME)/$(STAGE); ln -sf $(LIBMINOR) $(LIBMAJOR); ln -sf $(LIBMAJOR) $(BASETARGET); cd -
  89. else
  90. $(LD) $(LDFLAGS) $(LDSHARED) -o $(AXTLS_HOME)/$(STAGE)/cygaxtls.dll \
  91. -Wl,--out-implib=$(AXTLS_HOME)/$(STAGE)/libaxtls.dll.a \
  92. -Wl,--export-all-symbols \
  93. -Wl,--enable-auto-import $(CRYPTO_OBJ) $(OBJ)
  94. endif
  95. else # Win32
  96. CRYPTO_OBJ:=$(CRYPTO_OBJ:.o=.obj)
  97. $(TARGET1) : $(OBJ)
  98. $(AR) /out:$@ $(CRYPTO_OBJ) $(OBJ)
  99. $(TARGET2) : $(OBJ)
  100. cp $(TARGET1) $(STATIC_LIB)
  101. $(LD) $(LDFLAGS) $(LDSHARED) /out:$@ $(CRYPTO_OBJ) $(OBJ)
  102. endif
  103. clean::
  104. $(MAKE) -C test clean
  105. -@rm -f $(AXTLS_HOME)/$(STAGE)/* *.a $(TARGET1) $(TARGET2)