makefiles: improve a bit
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
diff --git a/makefile b/makefile
index 21aa5e7..4e0366d 100644
--- a/makefile
+++ b/makefile
@@ -7,22 +7,6 @@ VERSION=0.42.0
include makefile.include
-# Compiler and Linker Names
-ifndef PREFIX
- PREFIX=
-endif
-
-ifeq ($(CC),cc)
- CC = $(PREFIX)gcc
-endif
-LD=$(PREFIX)ld
-AR=$(PREFIX)ar
-RANLIB=$(PREFIX)ranlib
-
-ifndef MAKE
- MAKE=make
-endif
-
#install as this user
ifndef INSTALL_GROUP
GROUP=wheel
@@ -114,8 +98,6 @@ install: $(LIBNAME)
test: $(LIBNAME) demo/demo.o
$(CC) $(CFLAGS) demo/demo.o $(LIBNAME) -o test
-test_standalone: CFLAGS+=-DLTM_DEMO_TEST_VS_MTEST=0
-
test_standalone: $(LIBNAME) demo/demo.o
$(CC) $(CFLAGS) demo/demo.o $(LIBNAME) -o test
diff --git a/makefile.include b/makefile.include
index d879e64..edb39c5 100644
--- a/makefile.include
+++ b/makefile.include
@@ -2,6 +2,22 @@
# Include makefile for libtommath
#
+# Compiler and Linker Names
+ifndef PREFIX
+ PREFIX=
+endif
+
+ifeq ($(CC),cc)
+ CC = $(PREFIX)gcc
+endif
+LD=$(PREFIX)ld
+AR=$(PREFIX)ar
+RANLIB=$(PREFIX)ranlib
+
+ifndef MAKE
+ MAKE=make
+endif
+
CFLAGS += -I./ -Wall -Wsign-compare -Wextra -Wshadow
ifndef NO_ADDTL_WARNINGS
@@ -30,5 +46,6 @@ endif
HEADERS=tommath.h tommath_class.h tommath_superclass.h
+test_standalone: CFLAGS+=-DLTM_DEMO_TEST_VS_MTEST=0
diff --git a/makefile.shared b/makefile.shared
index 646ac8a..a19dd06 100644
--- a/makefile.shared
+++ b/makefile.shared
@@ -82,7 +82,11 @@ install: $(LIBNAME)
test: $(LIBNAME) demo/demo.o
$(CC) $(CFLAGS) -c demo/demo.c -o demo/demo.o
- $(LT) --mode=link $(CC) $(LDFLAGS) -o test demo/demo.o $(LIBNAME_S)
+ $(LT) --mode=link $(CC) $(LDFLAGS) -o test demo/demo.o $(LIBNAME)
+
+test_standalone: $(LIBNAME) demo/demo.o
+ $(CC) $(CFLAGS) -c demo/demo.c -o demo/demo.o
+ $(LT) --mode=link $(CC) $(LDFLAGS) -o test demo/demo.o $(LIBNAME)
mtest:
cd mtest ; $(CC) $(CFLAGS) $(LDFLAGS) mtest.c -o mtest