diff options
| author | mimaki <[email protected]> | 2012-04-20 09:39:03 +0900 |
|---|---|---|
| committer | mimaki <[email protected]> | 2012-04-20 09:39:03 +0900 |
| commit | e0d6430f63c4cbe0c71ce82ee23284671389a818 (patch) | |
| tree | 41abad7f12eced98d9ac14d141cea62464c3332f /mrblib/Makefile | |
| parent | 54ad561098ed353ada70205c39b2c42a2a2eb9e5 (diff) | |
| download | mruby-e0d6430f63c4cbe0c71ce82ee23284671389a818.tar.gz mruby-e0d6430f63c4cbe0c71ce82ee23284671389a818.zip | |
add mruby sources
Diffstat (limited to 'mrblib/Makefile')
| -rw-r--r-- | mrblib/Makefile | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/mrblib/Makefile b/mrblib/Makefile new file mode 100644 index 000000000..91dfe4c64 --- /dev/null +++ b/mrblib/Makefile @@ -0,0 +1,62 @@ +# makefile discription. +# basic build file for RiteVM library +# 11.Oct.2011 coded by Hiroshi Mimaki. + +# project-specific macros +# extension of the executable-file is modifiable(.exe .out ...) +BASEDIR = . +TARGET := mrblib +MLIB := $(TARGET).o +CLIB := $(TARGET).c +DLIB := $(TARGET).ctmp +RLIB := $(TARGET).rbtmp +MRB1 := $(BASEDIR)/*.rb +MRBS := $(MRB1) + +# C compiler (gcc) +CC = gcc +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) +MAKE_FLAGS = --no-print-directory CC="$(CC)" LL="$(LL)" + +# mruby compiler +ifeq ($(OS),Windows_NT) +MRBC = ../bin/mrbc.exe +else +MRBC = ../bin/mrbc +endif + +############################## +# generic build targets, rules + +.PHONY : all +all : $(MRBC) $(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) -Bmrblib_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 : + -rm -f $(MRBC) $(MLIB) $(CLIB) $(RLIB) $(DLIB) + @echo "make: removing targets, objects and depend files of `pwd`" + |
