diff --git a/makefile b/makefile index 81fb310..ed97a15 100644 --- a/makefile +++ b/makefile @@ -3,68 +3,24 @@ # Tom St Denis # Modified by Clay Culver +include makefile.include + +CFLAGS += -c + # The version VERSION=1.17 PLATFORM := $(shell uname | sed -e 's/_.*//') -# 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 -#ARFLAGS=r - -ifndef MAKE - MAKE=make -endif - # ranlib tools ifndef RANLIB ifeq ($(PLATFORM), Darwin) -RANLIB=$(PREFIX)ranlib -c +RANLIB:=$(PREFIX)ranlib -c else -RANLIB=$(PREFIX)ranlib +RANLIB:=$(PREFIX)ranlib endif endif -# Compilation flags. Note the += does not write over the user's CFLAGS! -CFLAGS += -c -I./testprof/ -I./src/headers/ -Wall -Wsign-compare -W -Wshadow -DLTC_SOURCE - -# additional warnings (newer GCC 3.4 and higher) -ifdef GCC_34 -CFLAGS += -Wsystem-headers -Wdeclaration-after-statement -Wbad-function-cast -Wcast-align -Wstrict-prototypes -Wmissing-prototypes \ - -Wmissing-declarations -Wpointer-arith -endif - -ifndef IGNORE_SPEED - -# optimize for SPEED -CFLAGS += -O3 -funroll-loops - -# add -fomit-frame-pointer. hinders debugging! -CFLAGS += -fomit-frame-pointer - -# optimize for SIZE -#CFLAGS += -Os -DLTC_SMALL_CODE - -endif - -# older GCCs can't handle the "rotate with immediate" ROLc/RORc/etc macros -# define this to help -#CFLAGS += -DLTC_NO_ROLC - -# compile for DEBUGING (required for ccmalloc checking!!!) -#CFLAGS += -g3 -DLTC_NO_ASM - #Output filenames for various targets. ifndef LIBNAME LIBNAME=libtomcrypt.a @@ -74,46 +30,6 @@ ifndef LIBTEST endif LIBTEST_S=$(LIBTEST) -HASH=hashsum -CRYPT=encrypt -SMALL=small -TV=tv_gen -MULTI=multi -TIMING=timing -TEST=test -SIZES=sizes -CONSTANTS=constants - -#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. -ifndef DESTDIR - DESTDIR= -endif - -ifndef LIBPATH - LIBPATH=/usr/lib -endif -ifndef INCPATH - INCPATH=/usr/include -endif -ifndef DATAPATH - DATAPATH=/usr/share/doc/libtomcrypt/pdf -endif - -#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 - #List of objects to compile. #START_INS OBJECTS=src/ciphers/aes/aes_enc.o src/ciphers/aes/aes.o src/ciphers/anubis.o src/ciphers/blowfish.o \ diff --git a/makefile.include b/makefile.include new file mode 100644 index 0000000..4daafab --- /dev/null +++ b/makefile.include @@ -0,0 +1,103 @@ +# +# Include makefile for libtomcrypt +# + +# 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 +#ARFLAGS=r + +ifndef MAKE + MAKE:=make +endif + + +# Compilation flags. Note the += does not write over the user's CFLAGS! +CFLAGS += -I./testprof/ -I./src/headers/ -Wall -Wsign-compare -Wshadow -DLTC_SOURCE + +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 +#CFLAGS += -Wdeclaration-after-statement +endif + +CFLAGS += -Wno-type-limits + +ifdef LTC_DEBUG +# compile for DEBUGING (required for ccmalloc checking!!!) +CFLAGS += -g3 -DLTC_NO_ASM +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 + + +HASH=hashsum +CRYPT=encrypt +SMALL=small +TV=tv_gen +MULTI=multi +TIMING=timing +TEST=test +SIZES=sizes +CONSTANTS=constants + +#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. +ifndef DESTDIR + DESTDIR= +endif + +ifndef LIBPATH + LIBPATH=/usr/lib +endif +ifndef INCPATH + INCPATH=/usr/include +endif +ifndef DATAPATH + DATAPATH=/usr/share/doc/libtomcrypt/pdf +endif + +#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 diff --git a/makefile.shared b/makefile.shared index 8ebbfad..2aa205a 100644 --- a/makefile.shared +++ b/makefile.shared @@ -5,48 +5,18 @@ # Thanks to Zed Shaw for helping debug this on BSD/OSX. # Tom St Denis +include makefile.include + # The version # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html VERSION=0:117 # http://www.gnu.org/software/libtool/manual/html_node/Release-numbers.html RELEASE=1.17 -# Compiler and Linker Names -ifeq ($(CC),cc) - CC = gcc -endif + LT ?= libtool LTCOMPILE = $(LT) --mode=compile --tag=CC $(CC) -# Compilation flags. Note the += does not write over the user's CFLAGS! -CFLAGS += -I./testprof/ -I./src/headers/ -Wall -Wsign-compare -W -Wshadow -Wno-unused-parameter -DLTC_SOURCE - -# additional warnings (newer GCC 3.4 and higher) -ifdef GCC_34 -CFLAGS += -Wsystem-headers -Wdeclaration-after-statement -Wbad-function-cast -Wcast-align -Wstrict-prototypes -Wmissing-prototypes \ - -Wmissing-declarations -Wpointer-arith -endif - - -ifndef IGNORE_SPEED - -# optimize for SPEED -CFLAGS += -O3 -funroll-loops - -# add -fomit-frame-pointer. hinders debugging! -CFLAGS += -fomit-frame-pointer - -# optimize for SIZE -#CFLAGS += -Os -DLTC_SMALL_CODE - -endif - -# compile for DEBUGING (required for ccmalloc checking!!!) -#CFLAGS += -g3 - -# older GCCs can't handle the "rotate with immediate" ROLc/RORc/etc macros -# define this to help -#CFLAGS += -DLTC_NO_ROLC #Output filenames for various targets. ifndef LIBTEST_S @@ -62,43 +32,6 @@ ifndef LIBNAME_S LIBNAME_S=libtomcrypt.a endif -HASH=hashsum -CRYPT=encrypt -SMALL=small -PROF=x86_prof -TV=tv_gen -TEST=test -TIMING=timing - -#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. -ifndef DESTDIR - DESTDIR= -endif -ifndef LIBPATH - LIBPATH=/usr/lib -endif -ifndef INCPATH - INCPATH=/usr/include -endif -ifndef DATAPATH - DATAPATH=/usr/share/doc/libtomcrypt/pdf -endif - -#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 - #List of objects to compile. #START_INS OBJECTS=src/ciphers/aes/aes_enc.o src/ciphers/aes/aes.o src/ciphers/anubis.o src/ciphers/blowfish.o \