Commit ffb172f403262855839c7a43dfaeddc29bb64f35

Steffen Jaeckel 2014-12-14T19:43:50

makefiles: add makefile.include to be used in makefile and makefile.shared use -Wextra instead of deprecated -W add additional warnings also used in libtomcrypt can be disabled by defining NO_ADDTL_WARNINGS add possibility to define COMPILE_SIZE or COMPILE_DEBUG

diff --git a/makefile b/makefile
index c2d0728..3cff973 100644
--- a/makefile
+++ b/makefile
@@ -5,7 +5,7 @@
 #version of library
 VERSION=0.42.0
 
-CFLAGS  +=  -I./ -Wall -W -Wshadow -Wsign-compare
+include makefile.include
 
 # Compiler and Linker Names
 ifndef PREFIX
@@ -23,22 +23,6 @@ ifndef MAKE
    MAKE=make
 endif
 
-ifndef IGNORE_SPEED
-
-#for speed
-CFLAGS += -O3 -funroll-loops
-
-#for size
-#CFLAGS += -Os
-
-#x86 optimizations [should be valid for any GCC install though]
-CFLAGS  += -fomit-frame-pointer
-
-#debug
-#CFLAGS += -g3
-
-endif
-
 #install as this user
 ifndef INSTALL_GROUP
    GROUP=wheel
@@ -59,8 +43,6 @@ endif
 
 default: ${LIBNAME}
 
-HEADERS=tommath.h tommath_class.h tommath_superclass.h
-
 #LIBPATH-The directory for libtommath to be installed to.
 #INCPATH-The directory to install the header files for libtommath.
 #DATAPATH-The directory to install the pdf docs.
diff --git a/makefile.include b/makefile.include
new file mode 100644
index 0000000..d879e64
--- /dev/null
+++ b/makefile.include
@@ -0,0 +1,34 @@
+#
+# Include makefile for libtommath
+#
+
+CFLAGS += -I./ -Wall -Wsign-compare -Wextra -Wshadow
+
+ifndef NO_ADDTL_WARNINGS
+# additional warnings
+CFLAGS += -Wsystem-headers -Wdeclaration-after-statement -Wbad-function-cast -Wcast-align
+CFLAGS += -Wstrict-prototypes -Wpointer-arith
+endif
+
+ifndef IGNORE_SPEED
+#for speed
+CFLAGS += -O3 -funroll-loops
+
+#x86 optimizations [should be valid for any GCC install though]
+CFLAGS  += -fomit-frame-pointer
+endif
+
+ifdef COMPILE_SIZE
+#for size
+CFLAGS += -Os
+endif
+
+ifdef COMPILE_DEBUG
+#debug
+CFLAGS += -g3
+endif
+
+HEADERS=tommath.h tommath_class.h tommath_superclass.h
+
+
+
diff --git a/makefile.shared b/makefile.shared
index 4f6a0d3..646ac8a 100644
--- a/makefile.shared
+++ b/makefile.shared
@@ -3,24 +3,11 @@
 #Tom St Denis
 VERSION=0:42
 
+include makefile.include
+
 LT	?= libtool
 LTCOMPILE = $(LT) --mode=compile --tag=CC $(CC)
 
-CFLAGS  +=  -I./ -Wall -W -Wshadow -Wsign-compare
-
-ifndef IGNORE_SPEED
-
-#for speed
-CFLAGS += -O3 -funroll-loops
-
-#for size
-#CFLAGS += -Os
-
-#x86 optimizations [should be valid for any GCC install though]
-CFLAGS  += -fomit-frame-pointer
-
-endif
-
 #install as this user
 ifndef INSTALL_GROUP
    GROUP=wheel
@@ -79,8 +66,6 @@ bn_s_mp_add.o bn_s_mp_exptmod.o bn_s_mp_mul_digs.o bn_s_mp_mul_high_digs.o bn_s_
 
 #END_INS
 
-HEADERS=tommath.h tommath_class.h tommath_superclass.h
-
 objs: $(OBJECTS)
 
 .c.o: