Makefile 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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. -include config/.config
  31. ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
  32. all: menuconfig
  33. else
  34. all: target
  35. endif
  36. include config/makefile.conf
  37. target : $(STAGE) $(TARGET)
  38. # VERSION has to come from the command line
  39. RELEASE=axTLS-$(VERSION)
  40. # standard version
  41. target:
  42. $(MAKE) -C crypto
  43. $(MAKE) -C ssl
  44. ifdef CONFIG_AXHTTPD
  45. $(MAKE) -C httpd
  46. endif
  47. ifdef CONFIG_BINDINGS
  48. $(MAKE) -C bindings
  49. endif
  50. ifdef CONFIG_SAMPLES
  51. $(MAKE) -C samples
  52. endif
  53. $(STAGE) : ssl/version.h
  54. @mkdir -p $(STAGE)
  55. # create a version file with something in it.
  56. ssl/version.h:
  57. @echo "#define AXTLS_VERSION \"(no version)\"" > ssl/version.h
  58. $(PREFIX) :
  59. @mkdir -p $(PREFIX)/lib
  60. @mkdir -p $(PREFIX)/bin
  61. release:
  62. $(MAKE) -C config/scripts/config clean
  63. -$(MAKE) clean
  64. -@rm config/*.msi config/*.back.aip config/config.h config/.config*
  65. -@rm www/index.20*
  66. -@rm -fr $(STAGE)
  67. @echo "#define AXTLS_VERSION \"$(VERSION)\"" > ssl/version.h
  68. cd ../; tar cvfz $(RELEASE).tar.gz --wildcards-match-slash --exclude .svn axTLS; cd -;
  69. docs:
  70. $(MAKE) -C docsrc doco
  71. # build the Win32 demo release version
  72. win32_demo:
  73. @echo "#define AXTLS_VERSION \"$(VERSION)\"" > ssl/version.h
  74. $(MAKE) win32releaseconf
  75. install: $(PREFIX) all
  76. cp --no-dereference $(STAGE)/libax* $(PREFIX)/lib
  77. chmod 755 $(PREFIX)/lib/libax*
  78. ifdef CONFIG_SAMPLES
  79. install -m 755 $(STAGE)/ax* $(PREFIX)/bin
  80. endif
  81. ifdef CONFIG_HTTP_HAS_AUTHORIZATION
  82. install -m 755 $(STAGE)/htpasswd $(PREFIX)/bin
  83. endif
  84. ifdef CONFIG_PLATFORM_CYGWIN
  85. install -m 755 $(STAGE)/cygaxtls.dll $(PREFIX)/bin
  86. endif
  87. ifdef CONFIG_PERL_BINDINGS
  88. install -m 755 $(STAGE)/axtlsp.pm `perl -e 'use Config; print $$Config{installarchlib};'`
  89. endif
  90. @mkdir -p -m 755 $(PREFIX)/include/axTLS
  91. install -m 644 crypto/*.h $(PREFIX)/include/axTLS
  92. install -m 644 ssl/*.h $(PREFIX)/include/axTLS
  93. -rm $(PREFIX)/include/axTLS/cert.h
  94. -rm $(PREFIX)/include/axTLS/private_key.h
  95. install -m 644 config/config.h $(PREFIX)/include/axTLS
  96. installclean:
  97. -@rm $(PREFIX)/lib/libax* > /dev/null 2>&1
  98. -@rm $(PREFIX)/bin/ax* > /dev/null 2>&1
  99. -@rm $(PREFIX)/bin/axhttpd* > /dev/null 2>&1
  100. -@rm `perl -e 'use Config; print $$Config{installarchlib};'`/axtlsp.pm > /dev/null 2>&1
  101. test:
  102. cd $(STAGE); ssltest; ../ssl/test/test_axssl.sh; cd -;
  103. # tidy up things
  104. clean::
  105. @cd crypto; $(MAKE) clean
  106. @cd ssl; $(MAKE) clean
  107. @cd httpd; $(MAKE) clean
  108. @cd samples; $(MAKE) clean
  109. @cd docsrc; $(MAKE) clean
  110. @cd bindings; $(MAKE) clean
  111. # ---------------------------------------------------------------------------
  112. # mconf stuff
  113. # ---------------------------------------------------------------------------
  114. CONFIG_CONFIG_IN = config/Config.in
  115. CONFIG_DEFCONFIG = config/defconfig
  116. config/scripts/config/conf: config/scripts/config/Makefile
  117. $(MAKE) -C config/scripts/config conf
  118. -@if [ ! -f config/.config ] ; then \
  119. cp $(CONFIG_DEFCONFIG) config/.config; \
  120. fi
  121. config/scripts/config/mconf: config/scripts/config/Makefile
  122. $(MAKE) -C config/scripts/config ncurses conf mconf
  123. -@if [ ! -f config/.config ] ; then \
  124. cp $(CONFIG_DEFCONFIG) .config; \
  125. fi
  126. cleanconf:
  127. $(MAKE) -C config/scripts/config clean
  128. @rm -f config/.config
  129. menuconfig: config/scripts/config/mconf
  130. @./config/scripts/config/mconf $(CONFIG_CONFIG_IN)
  131. config: config/scripts/config/conf
  132. @./config/scripts/config/conf $(CONFIG_CONFIG_IN)
  133. oldconfig: config/scripts/config/conf
  134. @./config/scripts/config/conf -o $(CONFIG_CONFIG_IN)
  135. default: config/scripts/config/conf
  136. @./config/scripts/config/conf -d $(CONFIG_CONFIG_IN) > /dev/null
  137. $(MAKE)
  138. randconfig: config/scripts/config/conf
  139. @./config/scripts/config/conf -r $(CONFIG_CONFIG_IN)
  140. allnoconfig: config/scripts/config/conf
  141. @./config/scripts/config/conf -n $(CONFIG_CONFIG_IN)
  142. allyesconfig: config/scripts/config/conf
  143. @./config/scripts/config/conf -y $(CONFIG_CONFIG_IN)
  144. # The special win32 release configuration
  145. win32releaseconf: config/scripts/config/conf
  146. @./config/scripts/config/conf -D config/win32config $(CONFIG_CONFIG_IN) > /dev/null
  147. $(MAKE)
  148. # The special linux release configuration
  149. linuxconf: config/scripts/config/conf
  150. @./config/scripts/config/conf -D config/linuxconfig $(CONFIG_CONFIG_IN) > /dev/null
  151. $(MAKE)