From c8c0ef85bcb49adb2296169f6098a18a251d6f07 Mon Sep 17 00:00:00 2001 From: Daniel Bovensiepen Date: Mon, 14 May 2012 20:21:31 +0800 Subject: mrit - Embeddable Ruby ISO Test --- test/Makefile | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 test/Makefile (limited to 'test/Makefile') 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) + -- cgit v1.2.3