summaryrefslogtreecommitdiffhomepage
path: root/tools/mrit/Makefile
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2012-05-14 06:15:42 -0700
committerYukihiro "Matz" Matsumoto <[email protected]>2012-05-14 06:15:42 -0700
commitbcb743fccba0628362e284515edade211dd55e19 (patch)
treea29397364f5c6f05b2f1bdd24af5f13a6472a6f7 /tools/mrit/Makefile
parent6b67801d4e643583746da41a74218145236b8f9d (diff)
parentc82a518ee1df250a03abb82aa58a1bfd2c04cfc3 (diff)
downloadmruby-bcb743fccba0628362e284515edade211dd55e19.tar.gz
mruby-bcb743fccba0628362e284515edade211dd55e19.zip
Merge pull request #131 from bovi/master
mrit - Embeddable Ruby ISO Test
Diffstat (limited to 'tools/mrit/Makefile')
-rw-r--r--tools/mrit/Makefile82
1 files changed, 82 insertions, 0 deletions
diff --git a/tools/mrit/Makefile b/tools/mrit/Makefile
new file mode 100644
index 000000000..af973d9de
--- /dev/null
+++ b/tools/mrit/Makefile
@@ -0,0 +1,82 @@
+# makefile discription.
+# basic build file for mrit executable
+
+# project-specific macros
+# extension of the executable-file is modifiable(.exe .out ...)
+BASEDIR = ../../src
+TARGET := ../../bin/mrit
+LIBR := ../../lib/libmruby.a
+LIBRIT := ../../lib/libmrit.a
+ifeq ($(OS),Windows_NT)
+EXE := $(TARGET).exe
+else
+EXE := $(TARGET)
+endif
+OBJ0 := $(patsubst %.c,%.o,$(wildcard $(BASEDIR)/../tools/mrit/*.c))
+#OBJ1 := $(patsubst %.c,%.o,$(filter-out $(EXCEPT1),$(wildcard $(BASEDIR)/*.c)))
+#OBJ2 := $(patsubst %.c,%.o,$(wildcard $(BASEDIR)/ext/regex/*.c))
+#OBJ3 := $(patsubst %.c,%.o,$(wildcard $(BASEDIR)/ext/enc/*.c))
+OBJS := $(OBJ0)
+
+# ext libraries
+#EXT1 := $(patsubst %.c,%.o,$(wildcard $(BASEDIR)/../ext/socket/*.c))
+EXTS := $(EXT1)
+
+# libraries, includes
+LIBS = -lm
+INCLUDES = -I$(BASEDIR) -I$(BASEDIR)/../include
+
+# compiler, linker (gcc)
+CC = gcc
+LL = gcc
+YACC = bison
+DEBUG_MODE = 1
+ifeq ($(DEBUG_MODE),1)
+CFLAGS = -g -O3
+else
+CFLAGS = -O3
+endif
+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
+
+##############################
+# generic build targets, rules
+
+.PHONY : all
+all : $(LIBRIT) $(LIBR) $(EXE)
+ @echo "make: built targets of `pwd`"
+
+# executable constructed using linker from object files
+$(EXE) : $(LIBRIT) $(LIBR) $(OBJS) $(EXTS)
+ $(LL) -o $@ $(CFLAGS) $(OBJS) $(LIBRIT) $(LIBR) $(EXTS) $(LIBS)
+
+-include $(OBJS:.o=.d)
+
+# objects compiled from source
+$(OBJS) : %.o : %.c
+ $(CC) $(ALL_CFLAGS) -MMD $(INCLUDES) -c $< -o $@
+
+# C library compile
+$(LIBR) :
+ @$(MAKE) -C $(BASEDIR) $(MAKE_FLAGS)
+$(LIBRIT) :
+ @$(MAKE) -C $(BASEDIR) $(MAKE_FLAGS)
+
+# mrit library compile
+# extend libraries complile
+$(EXTS) : %.o : %.c
+ $(CC) $(ALL_CFLAGS) -MMD $(INCLUDES) -c $< -o $@
+
+# clean up
+.PHONY : clean #cleandep
+clean :
+ $(MAKE) clean -C ../../test $(MAKE_FLAGS)
+ $(MAKE) clean -C ../../mrblib $(MAKE_FLAGS)
+ $(MAKE) clean -C ../mrbc $(MAKE_FLAGS)
+ @echo "make: removing targets, objects and depend files of `pwd`"
+ -rm -f $(EXE) $(OBJS)
+ -rm -f $(OBJS:.o=.d)