makefile.include 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. #
  2. # Include makefile for libtomcrypt
  3. #
  4. # The version
  5. VERSION=1.17
  6. # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
  7. VERSION_LT=0:117
  8. PLATFORM := $(shell uname | sed -e 's/_.*//')
  9. # Compiler and Linker Names
  10. ifndef PREFIX
  11. PREFIX:=
  12. endif
  13. ifeq ($(CC),cc)
  14. CC := $(PREFIX)gcc
  15. endif
  16. LD:=$(PREFIX)ld
  17. AR:=$(PREFIX)ar
  18. # Archiver [makes .a files]
  19. #AR=ar
  20. ARFLAGS:=r
  21. ifndef MAKE
  22. MAKE:=make
  23. endif
  24. # Compilation flags. Note the += does not write over the user's CFLAGS!
  25. CFLAGS += -I./src/headers/ -Wall -Wsign-compare -Wshadow -DLTC_SOURCE
  26. ifdef OLD_GCC
  27. CFLAGS += -W
  28. # older GCCs can't handle the "rotate with immediate" ROLc/RORc/etc macros
  29. # define this to help
  30. CFLAGS += -DLTC_NO_ROLC
  31. else
  32. CFLAGS += -Wextra
  33. # additional warnings
  34. CFLAGS += -Wsystem-headers -Wbad-function-cast -Wcast-align
  35. CFLAGS += -Wstrict-prototypes -Wpointer-arith
  36. CFLAGS += -Wdeclaration-after-statement
  37. endif
  38. CFLAGS += -Wno-type-limits
  39. ifdef LTC_DEBUG
  40. # compile for DEBUGGING (required for ccmalloc checking!!!)
  41. ifneq (,$(strip $(LTC_DEBUG)))
  42. CFLAGS += -g3 -DLTC_NO_ASM -DLTC_TEST_DBG=$(LTC_DEBUG)
  43. else
  44. CFLAGS += -g3 -DLTC_NO_ASM -DLTC_TEST_DBG
  45. endif
  46. else
  47. ifdef LTC_SMALL
  48. # optimize for SIZE
  49. CFLAGS += -Os -DLTC_SMALL_CODE
  50. else
  51. ifndef IGNORE_SPEED
  52. # optimize for SPEED
  53. CFLAGS += -O3 -funroll-loops
  54. # add -fomit-frame-pointer. hinders debugging!
  55. CFLAGS += -fomit-frame-pointer
  56. endif
  57. endif # COMPILE_SMALL
  58. endif # COMPILE_DEBUG
  59. ifneq ($(findstring clang,$(CC)),)
  60. CFLAGS += -Wno-typedef-redefinition -Wno-tautological-compare
  61. endif
  62. GIT_VERSION := $(shell [ -e .git ] && { echo -n git- ; git describe --tags --always --dirty ; } || echo $(VERSION))
  63. ifneq ($(GIT_VERSION),)
  64. CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
  65. endif
  66. #List of demo objects
  67. DSOURCES = $(wildcard demos/*.c)
  68. DOBJECTS = $(DSOURCES:.c=.o)
  69. #List of testprof headers
  70. THEADERS = $(wildcard testprof/*.h)
  71. TIMING=timing
  72. TEST=test
  73. USEFUL_DEMOS=hashsum
  74. DEMOS=$(USEFUL_DEMOS) ltcrypt small tv_gen sizes constants
  75. TIMINGS=demos/timing.o
  76. TESTS=demos/test.o
  77. #LIBPATH The directory for libtomcrypt to be installed to.
  78. #INCPATH The directory to install the header files for libtomcrypt.
  79. #DATAPATH The directory to install the pdf docs.
  80. #BINPATH The directory to install the binaries provided.
  81. DESTDIR ?= /usr/local
  82. LIBPATH ?= $(DESTDIR)/lib
  83. INCPATH ?= $(DESTDIR)/include
  84. DATAPATH ?= $(DESTDIR)/share/doc/libtomcrypt/pdf
  85. BINPATH ?= $(DESTDIR)/bin
  86. #Who do we install as?
  87. ifdef INSTALL_USER
  88. USER=$(INSTALL_USER)
  89. else
  90. USER=root
  91. endif
  92. ifdef INSTALL_GROUP
  93. GROUP=$(INSTALL_GROUP)
  94. else
  95. GROUP=wheel
  96. endif