blob: 5312f8187d38aaaad9eeafd3b261b53780f0ffb2 (
plain)
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
|
REALDIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
GMPDIR=$(REALDIR)/../gmp-6.3.0
# In OTHER_FLAGS:
# -DDAVINCI enables the davinci interface
# -DTRACE=traceOn enables tracing accoring to library function debugTrace()
# -DTRACE=0 disable tracing completely (or simply omit -DTRACE)
# -DSTACK_SIZE is the number of K words in the stack
# I don't know what causes Wstringop-overflows, but they seem to cause no problems.
# Lots of the Wunused-but-set-variables are assignments for effect, e.g. POP
# There is one Wunused-varable: it defines a static symbol that I presume gets linked to.
# Lots of the Wunused-paramters are used to occupy pointers that usually do something.
# The Wsign-compares are internal to gmp-impl.h
# For all of these, I have gone through all the warnings with them enabled,
# and verified that the warning is actually essential.
CFLAGS = \
$(INCLUDE) \
-std=c11 \
-Wall \
-Wextra \
-Wpedantic \
-Wno-stringop-overflow \
-Wno-unused-but-set-variable \
-Wno-unused-variable \
-Wno-unused-parameter \
-Wno-sign-compare \
-DPACK_DIGITS \
-DDEFAULT_FORCE_COUNT=1 \
-DSTACK_SIZE=20 \
-DFORCE_DEC_UPPER_BOUND=10000 \
-DREALDIR=\\\"$(REALDIR)\\\" \
-O3
DEBUGFLAGS = \
$(INCLUDE) \
-ggdb \
-gdwarf-4 \
-std=c11 \
-Wall \
-Wextra \
-Wpedantic \
-DPACK_DIGITS \
-DDEFAULT_FORCE_COUNT=1 \
-DSTACK_SIZE=20 \
-DFORCE_DEC_UPPER_BOUND=10000 \
-DREALDIR=\\\"$(REALDIR)\\\" \
-O0
# The following flags are not used. They are here for convenience; they can
# be cut and pasted easily into the list above
OTHER_FLAGS = \
-pg \
-lgmp \
-DTRACE=traceOn \
-DTRACE=1 \
-DDEFAULT_FORCE_COUNT=1 \
END
LIB=$(GMPDIR)/libgmp.la
INCLUDE = \
-I.. \
-I$(GMPDIR) \
-I$(GMPDIR)/mpn/
CC = gcc
FLAGS_TO_PASS = \
"CC=$(CC)" \
"CFLAGS=$(CFLAGS)" \
"REALDIR=$(REALDIR)"
"GMPDIR=$(GMPDIR)"
real.a : force
cd base; $(MAKE) $(FLAGS_TO_PASS)
cd math-lib; $(MAKE) $(FLAGS_TO_PASS)
ar rc libreal.a math-lib/*.o base/*.o
clean:
cd base; $(MAKE) clean
cd math-lib; $(MAKE) clean
cd tests; $(MAKE) clean
rm -f libreal.a
force:
.PHONY: force
|