diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/Makefile | 22 | ||||
| -rw-r--r-- | test/init_mrbtest.c | 3 |
2 files changed, 21 insertions, 4 deletions
diff --git a/test/Makefile b/test/Makefile index 3df07b280..1cadd90a2 100644 --- a/test/Makefile +++ b/test/Makefile @@ -3,13 +3,24 @@ # project-specific macros # extension of the executable-file is modifiable(.exe .out ...) +MRUBY_ROOT := .. BASEDIR = . TARGET := mrbtest LIBR := ../lib/libmruby.a + +MAKEFILE_GEM_LIST := $(MRUBY_ROOT)/mrbgems/g/MakefileGemList +ifeq ($(wildcard $(MAKEFILE_GEM_LIST)),) + GEM_ARCHIVE_FILES = +else + include $(MAKEFILE_GEM_LIST) +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 @@ -58,7 +69,6 @@ MRUBY= ../bin/mruby EXE := $(TARGET) endif - ############################## # generic build targets, rules @@ -76,7 +86,7 @@ all : $(EXE) $(MRUBY) $(TESTRB) $(TESTMRB) # executable constructed using linker from object files $(EXE) : $(OBJS) $(LIBR) - $(LL) -o $@ $(CFLAGS) $(OBJS) $(LIBR) $(LIBS) + $(LL) -o $@ $(CFLAGS) $(OBJS) $(LIBR) $(GEM_ARCHIVE_FILES) $(LIBS) -include $(OBJS:.o=.d) @@ -85,8 +95,12 @@ $(OBJS) : %.o : %.c $(CC) $(ALL_CFLAGS) -MMD $(INCLUDES) -c $< -o $@ # Compile C source from merged mruby source -$(CLIB) : $(RLIB) $(MRBC) $(INIT) - $(MRBC) -Bmrbtest_irep -o$(DLIB) $(RLIB); $(CAT) $(INIT) $(DLIB) > $@ +$(CLIB) : $(DLIB) $(INIT) + @$(MAKE) prepare-test -C $(GEMDIR) + $(CAT) $(INIT) $(DLIB) $(GEMDLIB) > $@ + +$(DLIB) : $(RLIB) $(MRBC) + $(MRBC) -Bmrbtest_irep -o$@ $(RLIB) # merge mruby sources $(RLIB) : $(ASSLIB) $(MRBS) diff --git a/test/init_mrbtest.c b/test/init_mrbtest.c index b9f09dd2f..2bc2f2e4b 100644 --- a/test/init_mrbtest.c +++ b/test/init_mrbtest.c @@ -5,13 +5,16 @@ #include "mruby/proc.h" extern const char mrbtest_irep[]; +extern const char mrbgemtest_irep[]; void mrb_init_mrbtest(mrb_state *mrb) { int n = mrb_read_irep(mrb, mrbtest_irep); + int m = mrb_read_irep(mrb, mrbgemtest_irep); mrb_run(mrb, mrb_proc_new(mrb, mrb->irep[n]), mrb_top_self(mrb)); + mrb_run(mrb, mrb_proc_new(mrb, mrb->irep[m]), mrb_top_self(mrb)); if (mrb->exc) { mrb_p(mrb, mrb_obj_value(mrb->exc)); exit(0); |
