summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--test/Makefile21
-rw-r--r--test/init_mrbtest.c4
2 files changed, 20 insertions, 5 deletions
diff --git a/test/Makefile b/test/Makefile
index 1cadd90a2..dfbcd8ce2 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -8,19 +8,28 @@ BASEDIR = .
TARGET := mrbtest
LIBR := ../lib/libmruby.a
-MAKEFILE_GEM_LIST := $(MRUBY_ROOT)/mrbgems/g/MakefileGemList
-ifeq ($(wildcard $(MAKEFILE_GEM_LIST)),)
+ifeq ($(strip $(ENABLE_GEMS)),)
+ # by default GEMs are deactivated
+ ENABLE_GEMS = false
+endif
+
+ifeq ($(ENABLE_GEMS),false)
GEM_ARCHIVE_FILES =
else
- include $(MAKEFILE_GEM_LIST)
+ GEMDIR := ../mrbgems
+ GEMDLIB := $(GEMDIR)/g/mrbgemtest.ctmp
+ MAKEFILE_GEM_LIST := $(MRUBY_ROOT)/mrbgems/g/MakefileGemList
+ ifeq ($(wildcard $(MAKEFILE_GEM_LIST)),)
+ GEM_ARCHIVE_FILES =
+ else
+ include $(MAKEFILE_GEM_LIST)
+ endif
endif
MLIB := $(TARGET).o
CLIB := $(TARGET).c
INIT := init_$(TARGET).c
DLIB := $(TARGET).ctmp
-GEMDIR := ../mrbgems
-GEMDLIB := $(GEMDIR)/g/mrbgemtest.ctmp
RLIB := $(TARGET).rbtmp
DEPLIB := $(TARGET).d driver.d
ASSLIB := $(BASEDIR)/assert.rb
@@ -96,7 +105,9 @@ $(OBJS) : %.o : %.c
# Compile C source from merged mruby source
$(CLIB) : $(DLIB) $(INIT)
+ifeq ($(ENABLE_GEMS),true)
@$(MAKE) prepare-test -C $(GEMDIR)
+endif
$(CAT) $(INIT) $(DLIB) $(GEMDLIB) > $@
$(DLIB) : $(RLIB) $(MRBC)
diff --git a/test/init_mrbtest.c b/test/init_mrbtest.c
index 2bc2f2e4b..ce9dd4cdd 100644
--- a/test/init_mrbtest.c
+++ b/test/init_mrbtest.c
@@ -11,10 +11,14 @@ void
mrb_init_mrbtest(mrb_state *mrb)
{
int n = mrb_read_irep(mrb, mrbtest_irep);
+#ifdef ENABLE_GEMS
int m = mrb_read_irep(mrb, mrbgemtest_irep);
+#endif
mrb_run(mrb, mrb_proc_new(mrb, mrb->irep[n]), mrb_top_self(mrb));
+#ifdef ENABLE_GEMS
mrb_run(mrb, mrb_proc_new(mrb, mrb->irep[m]), mrb_top_self(mrb));
+#endif
if (mrb->exc) {
mrb_p(mrb, mrb_obj_value(mrb->exc));
exit(0);