Advertisement
Guest User

Alternate GNUmakefile for Crypto++

a guest
Jan 4th, 2015
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 5.40 KB | None | 0 0
  1. riemann::cryptopp$ svn diff GNUmakefile
  2. Index: GNUmakefile
  3. ===================================================================
  4. --- GNUmakefile (revision 541)
  5. +++ GNUmakefile (working copy)
  6. @@ -1,22 +1,43 @@
  7. -CXXFLAGS = -DNDEBUG -g -O2
  8. +# CXXFLAGS += -DDEBUG -g3 -O0 -fPIC
  9. +CXXFLAGS = -DNDEBUG -g2 -Os -fPIC
  10. +
  11.  # -O3 fails to link on Cygwin GCC version 4.5.3
  12.  # -fPIC is supported. Please report any breakage of -fPIC as a bug.
  13.  # CXXFLAGS += -fPIC
  14.  # the following options reduce code size, but breaks link or makes link very slow on some systems
  15.  # CXXFLAGS += -ffunction-sections -fdata-sections
  16.  # LDFLAGS += -Wl,--gc-sections
  17. +CXXFLAGS += -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable
  18.  ARFLAGS = -cr  # ar needs the dash on OpenBSD
  19. -RANLIB = ranlib
  20. +RANLIB ?= ranlib
  21.  CP = cp
  22.  MKDIR = mkdir
  23.  EGREP = egrep
  24. +CHMOD = chmod
  25.  UNAME = $(shell uname)
  26.  ISX86 = $(shell uname -m | $(EGREP) -c "i.86|x86|i86|amd64")
  27.  IS_SUN_CC = $(shell $(CXX) -V 2>&1 | $(EGREP) -c "CC: Sun")
  28.  IS_LINUX = $(shell $(CXX) -dumpmachine 2>&1 | $(EGREP) -c "linux")
  29. +IS_DARWIN = $(shell uname -s | $(EGREP) -i -c "Darwin")
  30.  IS_MINGW = $(shell $(CXX) -dumpmachine 2>&1 | $(EGREP) -c "mingw")
  31. -CLANG_COMPILER = $(shell $(CXX) --version 2>&1 | $(EGREP) -i -c "clang version")
  32. +CLANG_COMPILER = $(shell $(CXX) --version 2>&1 | $(EGREP) -i -c "clang")
  33.  
  34. +# Set in the environment
  35. +ifeq ($(IS_CROSS_COMPILE),1)
  36. +  ISX86=0
  37. +  IS_LINUX=0
  38. +  IS_MINGW=0
  39. +  IS_DARWIN=0
  40. +  UNAME=CrossCompile
  41. +endif
  42. +
  43. +# Try to fix MinGW with a missing MSYS
  44. +ifeq ($(IS_MINGW),1)
  45. +  ifeq ($(UNAME),)
  46. +    UNAME=mingw
  47. +  endif
  48. +endif
  49. +
  50.  # Default prefix for make install
  51.  ifeq ($(PREFIX),)
  52.  PREFIX = /usr
  53. @@ -36,11 +57,11 @@
  54.  GAS219_OR_LATER = $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(EGREP) -c "GNU assembler version (2\.19|2\.[2-9]|[3-9])")
  55.  
  56.  ifneq ($(GCC42_OR_LATER),0)
  57. -ifeq ($(UNAME),Darwin)
  58. -CXXFLAGS += -arch x86_64 -arch i386
  59. -else
  60.  CXXFLAGS += -march=native
  61.  endif
  62. +
  63. +ifeq ($(IS_DARWIN),1)
  64. +CXXFLAGS += -arch x86_64 -arch i386
  65.  endif
  66.  
  67.  ifneq ($(INTEL_COMPILER),0)
  68. @@ -86,25 +107,61 @@
  69.  endif
  70.  endif
  71.  
  72. -ifeq ($(UNAME),Darwin)
  73. -AR = libtool
  74. -ARFLAGS = -static -o
  75. -CXX = c++
  76. -IS_GCC2 = $(shell $(CXX) -v 2>&1 | $(EGREP) -c gcc-932)
  77. -ifeq ($(IS_GCC2),1)
  78. -CXXFLAGS += -fno-coalesce-templates -fno-coalesce-static-vtables
  79. -LDLIBS += -lstdc++
  80. -LDFLAGS += -flat_namespace -undefined suppress -m
  81. +ifeq ($(IS_DARWIN),1)
  82. +  AR = libtool
  83. +  ARFLAGS = -static -o
  84. +  CXX = /usr/local/bin/clang++
  85. +#  CXXFLAGS += -stdlib=libc++
  86. +  IS_GCC2 = $(shell $(CXX) -v 2>&1 | $(EGREP) -c gcc-932)
  87. +  ifeq ($(IS_GCC2),1)
  88. +    CXXFLAGS += -fno-coalesce-templates -fno-coalesce-static-vtables
  89. +    LDFLAGS += -flat_namespace -undefined suppress -m
  90. +  endif
  91.  endif
  92. +
  93. +# Begin iOS cross-compile configuration.
  94. +# See http://www.cryptopp.com/wiki/iOS_(Command_Line).
  95. +ifeq ($(IS_IOS),1)
  96. +  CXX = clang++
  97. +
  98. +  CXXFLAGS = -DNDEBUG -g2 -Os -pipe -fPIC
  99. +  CXXFLAGS += -DCRYPTOPP_DISABLE_ASM  $(IOS_FLAGS)
  100. +  CXXFLAGS += -arch $(IOS_ARCH) -isysroot $(IOS_SYSROOT)
  101. +  CXXFLAGS += -stdlib=libc++
  102. +
  103. +  AR = libtool
  104. +  ARFLAGS = -static -o
  105. +  LDFLAGS += -flat_namespace
  106.  endif
  107.  
  108. +# Begin Android cross-compile configuration.
  109. +# See http://www.cryptopp.com/wiki/Android_(Command_Line).
  110. +ifeq ($(IS_ANDROID),1)
  111. +  # CPP, CXX, AR, etc are set in 'setenv-android.sh'
  112. +  CXXFLAGS = -DNDEBUG -g2 -Os -pipe -fPIC
  113. +  CXXFLAGS += -DCRYPTOPP_DISABLE_ASM $(ANDROID_FLAGS)
  114. +  CXXFLAGS += --sysroot=$(ANDROID_SYSROOT) -I$(ANDROID_STL_INC)
  115. +  LDLIBS += $(ANDROID_STL_LIB)
  116. +endif
  117. +
  118. +# Begin ARM embedded cross-compile configuration using Terry Guo's gear.
  119. +# See http://www.cryptopp.com/wiki/ARM_Embedded_(Command_Line)
  120. +#   and http://www.cryptopp.com/wiki/ARM_Embedded_(Bare Metal).
  121. +ifeq ($(IS_ARM_EMBEDDED),1)
  122. +  # CXX += -v
  123. +  # CPP, CXX, AR, etc are set in 'setenv-embedded.sh'
  124. +  CXXFLAGS = -DNDEBUG -g2 -Os -pipe -fPIC
  125. +  CXXFLAGS += -DCRYPTOPP_DISABLE_ASM $(ARM_EMBEDDED_FLAGS)
  126. +  CXXFLAGS += --sysroot=$(ARM_EMBEDDED_SYSROOT)
  127. +endif
  128. +
  129.  ifeq ($(UNAME),SunOS)
  130.  LDLIBS += -lnsl -lsocket
  131.  M32OR64 = -m$(shell isainfo -b)
  132.  endif
  133.  
  134.  ifneq ($(CLANG_COMPILER),0)
  135. -CXXFLAGS += -Wno-tautological-compare
  136. +CXXFLAGS += -Wno-tautological-compare -Wno-unused-value
  137.  endif
  138.  
  139.  ifneq ($(IS_SUN_CC),0) # override flags for CC Sun C++ compiler
  140. @@ -146,13 +203,20 @@
  141.  
  142.  clean:
  143.     -$(RM) cryptest.exe libcryptopp.a libcryptopp.so $(LIBOBJS) $(TESTOBJS) cryptopp.dll libcryptopp.dll.a libcryptopp.import.a cryptest.import.exe dlltest.exe $(DLLOBJS) $(LIBIMPORTOBJS) $(TESTI MPORTOBJS) $(DLLTESTOBJS)
  144. -
  145. +   -$(RM) -r *.dSYM
  146.  install:
  147.     $(MKDIR) -p $(PREFIX)/include/cryptopp $(PREFIX)/lib $(PREFIX)/bin
  148.     -$(CP) *.h $(PREFIX)/include/cryptopp
  149.     -$(CP) *.a $(PREFIX)/lib
  150.     -$(CP) *.so $(PREFIX)/lib
  151.     -$(CP) *.exe $(PREFIX)/bin
  152. +   -$(CHMOD) 0755 $(PREFIX)/include
  153. +   -$(CHMOD) 0755 $(PREFIX)/include/cryptopp
  154. +   -$(CHMOD) 0755 $(PREFIX)/lib
  155. +   -$(CHMOD) 0755 $(PREFIX)/bin
  156. +   -$(CHMOD) 0644 $(PREFIX)/include/cryptopp/*
  157. +   -$(CHMOD) 0755 $(PREFIX)/lib/*
  158. +   -$(CHMOD) 0755 $(PREFIX)/bin/*
  159.  
  160.  remove:
  161.     -$(RM) -rf $(PREFIX)/include/cryptopp
  162. @@ -165,7 +229,7 @@
  163.     $(RANLIB) $@
  164.  
  165.  libcryptopp.so: $(LIBOBJS)
  166. -   $(CXX) -shared -o $@ $(LIBOBJS)
  167. +   $(CXX) $(CXXFLAGS) -shared -o $@ $(LIBOBJS) $(LDFLAGS) $(LDLIBS)
  168.  
  169.  cryptest.exe: libcryptopp.a $(TESTOBJS)
  170.     $(CXX) -o $@ $(CXXFLAGS) $(TESTOBJS) ./libcryptopp.a $(LDFLAGS) $(LDLIBS)
  171. riemann::cryptopp$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement