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