| 
									
										
										
										
											2015-01-13 22:41:27 +01:00
										 |  |  | # | 
					
						
							|  |  |  | # Include makefile for libtomcrypt | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-02 10:33:39 +02:00
										 |  |  | # The version | 
					
						
							|  |  |  | VERSION=1.17 | 
					
						
							|  |  |  | # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html | 
					
						
							|  |  |  | VERSION_LT=0:117 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | PLATFORM := $(shell uname | sed -e 's/_.*//') | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-13 22:41:27 +01:00
										 |  |  | # Compiler and Linker Names | 
					
						
							|  |  |  | ifndef PREFIX | 
					
						
							|  |  |  |   PREFIX:= | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ifeq ($(CC),cc) | 
					
						
							|  |  |  |   CC := $(PREFIX)gcc | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | LD:=$(PREFIX)ld | 
					
						
							|  |  |  | AR:=$(PREFIX)ar | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Archiver [makes .a files] | 
					
						
							|  |  |  | #AR=ar | 
					
						
							| 
									
										
										
										
											2016-01-19 00:38:05 +01:00
										 |  |  | ARFLAGS:=r | 
					
						
							| 
									
										
										
										
											2015-01-13 22:41:27 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | ifndef MAKE | 
					
						
							|  |  |  |   MAKE:=make | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Compilation flags. Note the += does not write over the user's CFLAGS! | 
					
						
							| 
									
										
										
										
											2017-05-05 15:24:50 +02:00
										 |  |  | CFLAGS += -I./src/headers/ -Wall -Wsign-compare -Wshadow -DLTC_SOURCE | 
					
						
							| 
									
										
										
										
											2015-01-13 22:41:27 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | ifdef OLD_GCC | 
					
						
							|  |  |  | CFLAGS += -W | 
					
						
							|  |  |  | # older GCCs can't handle the "rotate with immediate" ROLc/RORc/etc macros | 
					
						
							|  |  |  | # define this to help | 
					
						
							|  |  |  | CFLAGS += -DLTC_NO_ROLC | 
					
						
							|  |  |  | else | 
					
						
							|  |  |  | CFLAGS += -Wextra | 
					
						
							|  |  |  | # additional warnings | 
					
						
							|  |  |  | CFLAGS += -Wsystem-headers -Wbad-function-cast -Wcast-align | 
					
						
							|  |  |  | CFLAGS += -Wstrict-prototypes -Wpointer-arith | 
					
						
							| 
									
										
										
										
											2017-03-26 19:30:18 +02:00
										 |  |  | CFLAGS += -Wdeclaration-after-statement | 
					
						
							| 
									
										
										
										
											2015-01-13 22:41:27 +01:00
										 |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | CFLAGS += -Wno-type-limits | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ifdef LTC_DEBUG | 
					
						
							| 
									
										
										
										
											2015-08-23 19:45:26 +02:00
										 |  |  | # compile for DEBUGGING (required for ccmalloc checking!!!) | 
					
						
							|  |  |  | ifneq (,$(strip $(LTC_DEBUG))) | 
					
						
							|  |  |  | CFLAGS += -g3 -DLTC_NO_ASM -DLTC_TEST_DBG=$(LTC_DEBUG) | 
					
						
							|  |  |  | else | 
					
						
							|  |  |  | CFLAGS += -g3 -DLTC_NO_ASM -DLTC_TEST_DBG | 
					
						
							|  |  |  | endif | 
					
						
							| 
									
										
										
										
											2015-01-13 22:41:27 +01:00
										 |  |  | else | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ifdef LTC_SMALL | 
					
						
							|  |  |  | # optimize for SIZE | 
					
						
							|  |  |  | CFLAGS += -Os -DLTC_SMALL_CODE | 
					
						
							|  |  |  | else | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ifndef IGNORE_SPEED | 
					
						
							|  |  |  | # optimize for SPEED | 
					
						
							|  |  |  | CFLAGS += -O3 -funroll-loops | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # add -fomit-frame-pointer.  hinders debugging! | 
					
						
							|  |  |  | CFLAGS += -fomit-frame-pointer | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | endif # COMPILE_SMALL | 
					
						
							|  |  |  | endif # COMPILE_DEBUG | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-18 14:39:32 +01:00
										 |  |  | ifneq ($(findstring clang,$(CC)),) | 
					
						
							|  |  |  | CFLAGS += -Wno-typedef-redefinition -Wno-tautological-compare | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-02 10:35:00 +02:00
										 |  |  | GIT_VERSION := $(shell [ -e .git ] && { echo -n git- ; git describe --tags --always --dirty ; } || echo $(VERSION)) | 
					
						
							|  |  |  | ifneq ($(GIT_VERSION),) | 
					
						
							|  |  |  | CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\" | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-05 15:24:50 +02:00
										 |  |  | #List of demo objects | 
					
						
							|  |  |  | DSOURCES != ls demos/*.c | 
					
						
							|  |  |  | DOBJECTS = ${DSOURCES:.c=.o} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #List of testprof headers | 
					
						
							|  |  |  | THEADERS != ls testprof/*.h | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-13 22:41:27 +01:00
										 |  |  | TIMING=timing | 
					
						
							|  |  |  | TEST=test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-01 11:17:23 +02:00
										 |  |  | USEFUL_DEMOS=hashsum | 
					
						
							|  |  |  | DEMOS=$(USEFUL_DEMOS) ltcrypt small tv_gen sizes constants | 
					
						
							| 
									
										
										
										
											2017-03-23 01:13:43 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | TIMINGS=demos/timing.o | 
					
						
							|  |  |  | TESTS=demos/test.o | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-02 20:47:00 +02:00
										 |  |  | #LIBPATH  The directory for libtomcrypt to be installed to. | 
					
						
							|  |  |  | #INCPATH  The directory to install the header files for libtomcrypt. | 
					
						
							|  |  |  | #DATAPATH The directory to install the pdf docs. | 
					
						
							| 
									
										
										
										
											2017-05-03 18:36:35 +02:00
										 |  |  | #BINPATH  The directory to install the binaries provided. | 
					
						
							| 
									
										
										
										
											2017-05-02 20:47:00 +02:00
										 |  |  | DESTDIR  ?= /usr/local | 
					
						
							|  |  |  | LIBPATH  ?= $(DESTDIR)/lib | 
					
						
							|  |  |  | INCPATH  ?= $(DESTDIR)/include | 
					
						
							|  |  |  | DATAPATH ?= $(DESTDIR)/share/doc/libtomcrypt/pdf | 
					
						
							| 
									
										
										
										
											2017-05-03 18:36:35 +02:00
										 |  |  | BINPATH  ?= $(DESTDIR)/bin | 
					
						
							| 
									
										
										
										
											2015-01-13 22:41:27 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #Who do we install as? | 
					
						
							|  |  |  | ifdef INSTALL_USER | 
					
						
							|  |  |  | USER=$(INSTALL_USER) | 
					
						
							|  |  |  | else | 
					
						
							|  |  |  | USER=root | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ifdef INSTALL_GROUP | 
					
						
							|  |  |  | GROUP=$(INSTALL_GROUP) | 
					
						
							|  |  |  | else | 
					
						
							|  |  |  | GROUP=wheel | 
					
						
							|  |  |  | endif |