diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2012-12-07 01:04:32 -0800 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2012-12-07 01:04:32 -0800 |
| commit | f521738953b9297a4d26e68ec42b7e9a22e5b442 (patch) | |
| tree | c54451f210ebea9233229cc29ad82311e554ff63 /test | |
| parent | bd3b95cae66bf68a757a0dcdf05bcb05eb177391 (diff) | |
| parent | bef73cc54f044e16caf6bc1ba16ed0bf779c5ade (diff) | |
| download | mruby-f521738953b9297a4d26e68ec42b7e9a22e5b442.tar.gz mruby-f521738953b9297a4d26e68ec42b7e9a22e5b442.zip | |
Merge pull request #479 from bovi/mrbgems
mrbgems
Diffstat (limited to 'test')
| -rw-r--r-- | test/Makefile | 33 | ||||
| -rw-r--r-- | test/init_mrbtest.c | 4 |
2 files changed, 33 insertions, 4 deletions
diff --git a/test/Makefile b/test/Makefile index 3df07b280..dfbcd8ce2 100644 --- a/test/Makefile +++ b/test/Makefile @@ -3,9 +3,29 @@ # project-specific macros # extension of the executable-file is modifiable(.exe .out ...) +MRUBY_ROOT := .. BASEDIR = . TARGET := mrbtest LIBR := ../lib/libmruby.a + +ifeq ($(strip $(ENABLE_GEMS)),) + # by default GEMs are deactivated + ENABLE_GEMS = false +endif + +ifeq ($(ENABLE_GEMS),false) + GEM_ARCHIVE_FILES = +else + 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 @@ -58,7 +78,6 @@ MRUBY= ../bin/mruby EXE := $(TARGET) endif - ############################## # generic build targets, rules @@ -76,7 +95,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 +104,14 @@ $(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) +ifeq ($(ENABLE_GEMS),true) + @$(MAKE) prepare-test -C $(GEMDIR) +endif + $(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 e68c9d71a..47b14c325 100644 --- a/test/init_mrbtest.c +++ b/test/init_mrbtest.c @@ -5,11 +5,15 @@ #include "mruby/proc.h" extern const char mrbtest_irep[]; +extern const char mrbgemtest_irep[]; void mrb_init_mrbtest(mrb_state *mrb) { mrb_load_irep(mrb, mrbtest_irep); +#ifdef ENABLE_GEMS + mrb_load_irep(mrb, mrbgemtest_irep); +#endif if (mrb->exc) { mrb_p(mrb, mrb_obj_value(mrb->exc)); exit(0); |
