diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2012-05-14 06:15:42 -0700 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2012-05-14 06:15:42 -0700 |
| commit | bcb743fccba0628362e284515edade211dd55e19 (patch) | |
| tree | a29397364f5c6f05b2f1bdd24af5f13a6472a6f7 /test/Makefile | |
| parent | 6b67801d4e643583746da41a74218145236b8f9d (diff) | |
| parent | c82a518ee1df250a03abb82aa58a1bfd2c04cfc3 (diff) | |
| download | mruby-bcb743fccba0628362e284515edade211dd55e19.tar.gz mruby-bcb743fccba0628362e284515edade211dd55e19.zip | |
Merge pull request #131 from bovi/master
mrit - Embeddable Ruby ISO Test
Diffstat (limited to 'test/Makefile')
| -rw-r--r-- | test/Makefile | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/test/Makefile b/test/Makefile new file mode 100644 index 000000000..b7a6572c8 --- /dev/null +++ b/test/Makefile @@ -0,0 +1,70 @@ +# makefile discription. +# basic build file for mruby library (Ruby part) + +# project-specific macros +# extension of the executable-file is modifiable(.exe .out ...) +BASEDIR = . +TARGET := mritlib +MLIB := $(TARGET).o +CLIB := $(TARGET).c +DLIB := $(TARGET).ctmp +RLIB := $(TARGET).rbtmp +DEPLIB := $(TARGET).d +MRB1 := $(BASEDIR)/*.rb +MRBS := $(MRB1) +LIBR := ../lib/libmrit.a + +# C compiler (gcc) +CC = gcc +LL = gcc +AR = ar +DEBUG_MODE = 1 +ifeq ($(DEBUG_MODE),1) +CFLAGS = -g +else +CFLAGS = -O3 +endif +INCLUDES = -I../src -I../include +ALL_CFLAGS = -Wall -Werror-implicit-function-declaration $(CFLAGS) +ifeq ($(OS),Windows_NT) + MAKE_FLAGS = CC=$(CC) LL=$(LL) ALL_CFLAGS="$(ALL_CFLAGS)" +else + MAKE_FLAGS = CC='$(CC)' LL='$(LL)' ALL_CFLAGS='$(ALL_CFLAGS)' +endif + +# mruby compiler +ifeq ($(OS),Windows_NT) +MRBC = ../bin/mrbc.exe +else +MRBC = ../bin/mrbc +endif + +############################## +# generic build targets, rules + +.PHONY : all +all : $(MRBC) $(MLIB) + $(AR) r $(LIBR) $(MLIB) + @echo "make: built targets of `pwd`" + +# Compile mrblib source +$(MLIB) : $(CLIB) + $(CC) $(ALL_CFLAGS) -MMD $(INCLUDES) -c $(CLIB) -o $(MLIB) + +# Compile C source from merged mruby source +$(CLIB) : $(RLIB) $(MRBC) + $(MRBC) -Bmritlib_irep -o$(DLIB) $(RLIB); cat init_$(TARGET).c $(DLIB) > $@ + +$(MRBC) : ../src/opcode.h ../src/codegen.c ../src/parse.y + $(MAKE) -C ../tools/mrbc $(MAKE_FLAGS) + +# merge mruby sources +$(RLIB) : $(MRBS) + cat $? > $@ + +# clean up +.PHONY : clean +clean : + @echo "make: removing targets, objects and depend files of `pwd`" + -rm -f $(MRBC) $(MLIB) $(CLIB) $(RLIB) $(DLIB) $(DEPLIB) $(LIBR) + |
