ref: db212180bfa53e3dccf36f999a5defcf1676a25e
parent: 57e3f01d5f29c5823be725d96284488edf5f8ae1
author: Tor Andersson <tor.andersson@artifex.com>
date: Tue Apr 4 10:57:27 EDT 2023
Allow disabling readline support in Makefile. make HAVE_READLINE=no
--- a/Makefile
+++ b/Makefile
@@ -31,6 +31,11 @@
HDRS = mujs.h jsi.h regexp.h utf.h astnames.h opnames.h
+ifneq ($(HAVE_READLINE),no)
+ READLINE_CFLAGS = -DHAVE_READLINE
+ READLINE_LIBS = -lreadline
+endif
+
SRCS = \
jsarray.c \
jsboolean.c \
@@ -75,7 +80,7 @@
build/sanitize/mujs: main.c one.c $(SRCS) $(HDRS)
@mkdir -p $(@D)
- $(CC) $(CFLAGS) -g -fsanitize=address -fno-omit-frame-pointer -o $@ main.c one.c -lm -DHAVE_READLINE -lreadline
+ $(CC) $(CFLAGS) -g -fsanitize=address -fno-omit-frame-pointer -o $@ main.c one.c -lm $(READLINE_CFLAGS) $(READLINE_LIBS)
build/debug/libmujs.$(SO): one.c $(SRCS) $(HDRS)
@mkdir -p $(@D)
@@ -86,7 +91,7 @@
build/debug/libmujs.a: build/debug/libmujs.o
$(AR) cr $@ $^
build/debug/mujs: main.c build/debug/libmujs.o
- $(CC) $(CFLAGS) -g -o $@ $^ -lm -DHAVE_READLINE -lreadline
+ $(CC) $(CFLAGS) -g -o $@ $^ -lm $(READLINE_CFLAGS) $(READLINE_LIBS)
build/debug/mujs-pp: pp.c build/debug/libmujs.o
$(CC) $(CFLAGS) -g -o $@ $^ -lm
@@ -99,7 +104,7 @@
build/release/libmujs.a: build/release/libmujs.o
$(AR) cr $@ $^
build/release/mujs: main.c build/release/libmujs.o
- $(CC) $(CFLAGS) $(OPTIM) -o $@ $^ -lm -DHAVE_READLINE -lreadline
+ $(CC) $(CFLAGS) $(OPTIM) -o $@ $^ -lm $(READLINE_CFLAGS) $(READLINE_LIBS)
build/release/mujs-pp: pp.c build/release/libmujs.o
$(CC) $(CFLAGS) $(OPTIM) -o $@ $^ -lm