From 0786554de652699b915dde766ae505de197eacaf Mon Sep 17 00:00:00 2001 From: Karol Gugala Date: Mon, 20 Jan 2020 18:21:54 +0100 Subject: [PATCH] Makefile: enable linking with static libreadline Signed-off-by: Karol Gugala --- Makefile | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6e7681cf39a..282bcef7b83 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,9 @@ ENABLE_LIBYOSYS := 0 ENABLE_PROTOBUF := 0 ENABLE_ZLIB := 1 +# valid only if ENABLE_READLINE == 1 +ENABLE_STATIC_READLINE ?= 0 + # python wrappers ENABLE_PYOSYS := 0 @@ -61,6 +64,7 @@ GENFILES = EXTRA_OBJS = EXTRA_TARGETS = TARGETS = yosys$(EXE) yosys-config +STATIC_LIBS = PRETTY = 1 SMALL = 0 @@ -354,7 +358,15 @@ CXXFLAGS += -DYOSYS_ENABLE_READLINE ifeq ($(OS), FreeBSD) CXXFLAGS += -I/usr/local/include endif +ifeq ($(ENABLE_STATIC_READLINE), 1) +LDLIBS += -ltinfo +ifeq ($(READLINE_STATIC),) +$(error Static readline selected, path to libreadline.a is not provided!) +endif +STATIC_LIBS += $(READLINE_STATIC) +else LDLIBS += -lreadline +endif ifeq ($(LINK_CURSES),1) LDLIBS += -lcurses ABCMKARGS += "ABC_READLINE_LIBRARIES=-lcurses -lreadline" @@ -603,7 +615,7 @@ yosys.js: $(filter-out yosysjs-$(YOSYS_VER).zip,$(EXTRA_TARGETS)) endif yosys$(EXE): $(OBJS) - $(P) $(LD) -o yosys$(EXE) $(LDFLAGS) $(OBJS) $(LDLIBS) + $(P) $(LD) -o yosys$(EXE) $(LDFLAGS) $(OBJS) $(LDLIBS) $(STATIC_LIBS) libyosys.so: $(filter-out kernel/driver.o,$(OBJS)) ifeq ($(OS), Darwin)