aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile7
-rw-r--r--src/Makefile10
2 files changed, 16 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 37bbe4d..1d87d87 100644
--- a/Makefile
+++ b/Makefile
@@ -50,6 +50,13 @@ help:
@echo " - clean-all : cleans all"
@echo " - format : run clang-format on source files"
@echo " - help : print this help"
+ @echo
+ @echo "Available variables:"
+ @echo " - CC : The compiler to use"
+ @echo " - DEBUG : Whether to enable DEBUG build = default 0"
+ @echo " - TEST : Whether to enable TEST build(code coverage) = default 0"
+ @echo " - FAST : Whether to enable additional optimization(gcc only) = default 0"
+ @echo " - STATIC : Whether to link PARI statically = default 0"
.PHONY: all clean clean-all docs test unittest help
diff --git a/src/Makefile b/src/Makefile
index 8adbc53..4818f3c 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -11,6 +11,8 @@ CFLAGS = -Wall
DEBUG ?= 0
TEST ?= 0
FAST ?= 0
+STATIC ?= 0
+
ifeq ($(DEBUG), 1)
CFLAGS += -DDEBUG -g -Og -Werror -pedantic
else ifeq ($(TEST), 1)
@@ -24,10 +26,16 @@ else ifeq ($(FAST), 1)
else
CFLAGS += -DNDEBUG -O2
endif
+
LDFLAGS = -L../lib/parson -L../lib/sha1 -L../lib/pari
+ifeq ($(STATIC), 1)
+ LIBS = -lrt -Wl,-Bstatic -lpari -Wl,-Bdynamic -lpthread -lparson -lsha1 -lm -lgmp -ldl
+else
+ LIBS = -lrt -lpari -lpthread -lparson -lsha1
+endif
INCLUDES = -I. -I../lib
-LIBS = -lrt -lpari -lpthread -lparson -lsha1
+
GIT_COMMIT = $(shell git rev-parse --short HEAD)
ifneq ($(GIT_COMMIT),)