summaryrefslogtreecommitdiff
path: root/Examples/Makefile.in
diff options
context:
space:
mode:
authorOlly Betts <olly@survex.com>2022-11-30 16:27:18 +1300
committerOlly Betts <olly@survex.com>2023-04-22 13:33:46 +1200
commit7bb7295a33c78e1739907bbebf151a2a27432a24 (patch)
tree1d1765fd732dd231a490c0ee7e3f2417eece4e4c /Examples/Makefile.in
parentb508598a42b80f9e63f6ebbaf04fdbfee30ea2a2 (diff)
downloadswig-7bb7295a33c78e1739907bbebf151a2a27432a24.tar.gz
[js] Improve default for JSENGINE
Previously the default was always "node", even if nodejs wasn't detected by configure. This leads to a confusing failure from "make check" if you have another support JS engine installed but not node. Now the default it picked based on which engines configure found. If only one was detected, that should be used. If multiple are, you can override the default choice by specifying e.g. ENGINE=jsc on the make command line. Fixes #2453
Diffstat (limited to 'Examples/Makefile.in')
-rw-r--r--Examples/Makefile.in22
1 files changed, 20 insertions, 2 deletions
diff --git a/Examples/Makefile.in b/Examples/Makefile.in
index d69e20ca8..0849597a9 100644
--- a/Examples/Makefile.in
+++ b/Examples/Makefile.in
@@ -687,16 +687,34 @@ JSINCLUDES = @JSCOREINC@ @JSV8INC@
JSDYNAMICLINKING = @JSCOREDYNAMICLINKING@ @JSV8DYNAMICLINKING@
NODEJS = @NODEJS@
NODEGYP = @NODEGYP@
+ifneq (, $(ENGINE))
+ JSENGINE=$(ENGINE)
+else
+ifneq (, $(NODEJS))
+ JSENGINE=node
+else
+ifneq (, @JSCENABLED@)
+ JSENGINE=jsc
+else
+ifneq (, @JSV8ENABLED@)
+ JSENGINE=v8
+else
+ # Shouldn't happen, but avoid empty value if it does.
+ JSENGINE=node
+endif
+endif
+endif
+endif
# ----------------------------------------------------------------
# Creating and building Javascript wrappers
# ----------------------------------------------------------------
javascript_wrapper:
- $(SWIG) -javascript $(SWIGOPT) -o $(INTERFACEDIR)$(TARGET)_wrap.c $(INTERFACEPATH)
+ $(SWIG) -javascript $(SWIGOPT) -$(JSENGINE) -o $(INTERFACEDIR)$(TARGET)_wrap.c $(INTERFACEPATH)
javascript_wrapper_cpp: $(SRCDIR_SRCS)
- $(SWIG) -javascript -c++ $(SWIGOPT) -o $(INTERFACEDIR)$(TARGET)_wrap.cxx $(INTERFACEPATH)
+ $(SWIG) -javascript -c++ $(SWIGOPT) -$(JSENGINE) -o $(INTERFACEDIR)$(TARGET)_wrap.cxx $(INTERFACEPATH)
javascript_build: $(SRCDIR_SRCS)
$(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) $(JSINCLUDES)