Makefile 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. #
  2. # hashlib++ - a simple hash library for C++
  3. #
  4. # Copyright (c) 2007-2010 Benjamin Grüdelbach
  5. #
  6. # Redistribution and use in source and binary forms, with or without modification,
  7. # are permitted provided that the following conditions are met:
  8. #
  9. # 1) Redistributions of source code must retain the above copyright
  10. # notice, this list of conditions and the following disclaimer.
  11. #
  12. # 2) Redistributions in binary form must reproduce the above copyright
  13. # notice, this list of conditions and the following disclaimer in
  14. # the documentation and/or other materials provided with the
  15. # distribution.
  16. #
  17. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  18. # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  19. # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  20. # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
  21. # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  22. # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  23. # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  24. # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  26. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. #
  28. #-----------------------------------------------------------------------
  29. #
  30. # This is the hashlib++ makefile. It builds and installs hashlib++ as a
  31. # static library. See the documentation for more information.
  32. #
  33. # Type 'make' to build the lib.
  34. # Type 'make install' to build and install the lib.
  35. # Type 'make clean' to clean the object files
  36. #
  37. # Note for FreeBSD users:
  38. # use gmake from "/usr/ports/devel/gmake"
  39. #
  40. # Benjamin Grüdelbach
  41. # Mi 10 Okt 2007
  42. #
  43. #-----------------------------------------------------------------------
  44. # Edit the following lines to meet your needs
  45. # Path to install the headerfiles
  46. INCLUDE_PATH = /usr/include/hashlib++
  47. # Path to install the library
  48. LIB_PATH = /usr/local/lib/
  49. # Compiler to use
  50. COMPILER = g++
  51. # Global options for the compiler
  52. COPTIONS = -ansi -Wall -Wextra
  53. #-----------------------------------------------------------------------
  54. # DON'T CHANGE ANYTHING BELOW
  55. #-----------------------------------------------------------------------
  56. ifdef DEBUG
  57. COPTIONS += -g
  58. else
  59. COPTIONS += -O3 -fomit-frame-pointer
  60. endif
  61. GCC = $(COMPILER) $(COPTIONS)
  62. #-----------------------------------------------------------------------
  63. #Main-Target
  64. all: MD5 SHA1 SHA256 SHA2EXT CORE LIB
  65. #-----------------------------------------------------------------------
  66. #all header-files
  67. HEADER = hl_hashwrapper.h \
  68. hl_wrapperfactory.h \
  69. hl_exception.h \
  70. hl_md5.h hl_md5wrapper.h \
  71. hl_sha1.h hl_sha1wrapper.h \
  72. hl_sha2mac.h \
  73. hl_sha256.h hl_sha256wrapper.h \
  74. hl_sha2ext.h hl_sha384wrapper.h hl_sha512wrapper.h \
  75. hl_types.h \
  76. hashlibpp.h
  77. #-----------------------------------------------------------------------
  78. CORE = hl_wrapperfactory.o
  79. CORE: hl_wrapperfactory.o
  80. hl_wrapperfactory.o: hl_wrapperfactory.cpp hl_wrapperfactory.h
  81. $(GCC) -c hl_wrapperfactory.cpp
  82. #-----------------------------------------------------------------------
  83. # MD5 Targets
  84. MD5 = hl_md5.o \
  85. hl_md5wrapper.o
  86. MD5: hl_md5.o hl_md5wrapper.o
  87. hl_md5.o: hl_md5.cpp hl_md5.h
  88. $(GCC) -c hl_md5.cpp
  89. hl_md5wrapper.o: hl_md5wrapper.cpp hl_md5wrapper.h
  90. $(GCC) -c hl_md5wrapper.cpp
  91. #-----------------------------------------------------------------------
  92. # SHA1 Targets
  93. SHA1 = hl_sha1.o \
  94. hl_sha1wrapper.o
  95. SHA1: hl_sha1.o hl_sha1wrapper.o
  96. hl_sha1.o: hl_sha1.cpp hl_sha1.h
  97. $(GCC) -c hl_sha1.cpp
  98. hl_sha1wrapper.o: hl_sha1wrapper.cpp hl_sha1wrapper.h
  99. $(GCC) -c hl_sha1wrapper.cpp
  100. #-----------------------------------------------------------------------
  101. # SHA256 Targets
  102. SHA256 = hl_sha256.o \
  103. hl_sha256wrapper.o
  104. SHA256: hl_sha256.o hl_sha256wrapper.o
  105. hl_sha256.o: hl_sha256.cpp hl_sha256.h hl_sha2mac.h
  106. $(GCC) -c hl_sha256.cpp
  107. hl_sha256wrapper.o: hl_sha256wrapper.cpp hl_sha256wrapper.h
  108. $(GCC) -c hl_sha256wrapper.cpp
  109. #-----------------------------------------------------------------------
  110. # SHA2-ext Targets
  111. SHA2EXT = hl_sha2ext.o \
  112. hl_sha384wrapper.o \
  113. hl_sha512wrapper.o
  114. SHA2EXT: hl_sha2ext.o hl_sha384wrapper.o hl_sha512wrapper.o
  115. hl_sha2ext.o: hl_sha2ext.cpp hl_sha2ext.h hl_sha2mac.h
  116. $(GCC) -c hl_sha2ext.cpp
  117. hl_sha384wrapper.o: hl_sha384wrapper.cpp hl_sha384wrapper.h
  118. $(GCC) -c hl_sha384wrapper.cpp
  119. hl_sha512wrapper.o: hl_sha512wrapper.cpp hl_sha512wrapper.h
  120. $(GCC) -c hl_sha512wrapper.cpp
  121. #-----------------------------------------------------------------------
  122. # Creating a static lib using ar
  123. LIB: MD5 SHA1 SHA256
  124. ar rs libhl++.a $(MD5) $(SHA1) $(SHA256) $(SHA2EXT) $(CORE)
  125. #-----------------------------------------------------------------------
  126. #Installing the lib
  127. install: all
  128. mkdir -p $(INCLUDE_PATH); \
  129. mkdir -p $(LIB_PATH); \
  130. cp libhl++.a $(LIB_PATH) && \
  131. cp $(HEADER) $(INCLUDE_PATH)
  132. -@ echo ""
  133. -@ echo ""
  134. -@ echo "------------------------------"
  135. -@ echo ""
  136. -@ echo "hashlib++ has been installed to:"
  137. -@ echo "include files: $(INCLUDE_PATH)"
  138. -@ echo "library files: $(LIB_PATH)"
  139. -@ echo ""
  140. -@ echo "------------------------------"
  141. #-----------------------------------------------------------------------
  142. # Cleaning object-files
  143. clean:
  144. rm *.o
  145. -@ echo "cleaned up "
  146. -@ echo ""
  147. #-----------------------------------------------------------------------
  148. #EOF