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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
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: