Add MRUBY_CFLAGS / MRUBY_LDFLAGS to mrbgems

This commit is contained in:
Yuichiro MASUI
2012-12-22 01:38:06 +09:00
parent 429359819a
commit dee0b2283c
14 changed files with 144 additions and 38 deletions
+8 -14
View File
@@ -52,14 +52,6 @@ ifeq ($(strip $(COMPILE_MODE)),)
COMPILE_MODE = debug
endif
ifeq ($(COMPILE_MODE),debug)
CFLAGS = -g -O3
else ifeq ($(COMPILE_MODE),release)
CFLAGS = -O3
else ifeq ($(COMPILE_MODE),small)
CFLAGS = -Os
endif
ALL_CFLAGS = -Wall -Werror-implicit-function-declaration $(CFLAGS)
ifeq ($(OS),Windows_NT)
MAKE_FLAGS = CC=$(CC) LL=$(LL) ALL_CFLAGS='$(ALL_CFLAGS)' LDFLAGS='$(LDFLAGS)'
@@ -85,7 +77,7 @@ RAKE = ../minirake
# generic build targets, rules
.PHONY : test
all : $(EXE) $(MRUBY) $(TESTRB) $(TESTMRB)
all : $(EXE) $(MRUBY) $(TESTRB) $(TESTMRB)
@echo "# exec mrbtest"
./$(EXE)
@echo
@@ -97,9 +89,14 @@ all : $(EXE) $(MRUBY) $(TESTRB) $(TESTMRB)
@echo
# executable constructed using linker from object files
$(EXE) : $(OBJS) $(LIBR) $(GEM_ARCHIVE_FILES)
$(EXE) : generate-mrbgems-test $(OBJS) $(LIBR) $(GEM_ARCHIVE_FILES)
$(LL) -o $@ $(LDFLAGS) $(OBJS) $(LIBR) $(GEM_ARCHIVE_FILES) $(LIBS)
generate-mrbgems-test :
ifeq ($(ENABLE_GEMS),true)
@$(RAKE) mrbgems_prepare_test
endif
-include $(OBJS:.o=.d)
# objects compiled from source
@@ -107,10 +104,7 @@ $(OBJS) : %.o : %.c
$(CC) $(ALL_CFLAGS) -MMD $(INCLUDES) -c $< -o $@
# Compile C source from merged mruby source
$(CLIB) : $(DLIB) $(INIT)
ifeq ($(ENABLE_GEMS),true)
@$(RAKE) mrbgems_prepare_test
endif
$(CLIB) : $(DLIB) $(INIT) $(GEMDLIB)
$(CAT) $(INIT) $(DLIB) $(GEMDLIB) > $@
$(DLIB) : $(RLIB) $(MRBC)
+3 -2
View File
@@ -5,14 +5,15 @@
#include "mruby/proc.h"
extern const char mrbtest_irep[];
extern const char mrbgemtest_irep[];
void mrbgemtest_init(mrb_state* mrb);
void
mrb_init_mrbtest(mrb_state *mrb)
{
mrb_load_irep(mrb, mrbtest_irep);
#ifndef DISABLE_GEMS
mrb_load_irep(mrb, mrbgemtest_irep);
mrbgemtest_init(mrb);
#endif
if (mrb->exc) {
mrb_p(mrb, mrb_obj_value(mrb->exc));