summaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/mrbc/Makefile44
-rw-r--r--tools/mruby/Makefile54
2 files changed, 46 insertions, 52 deletions
diff --git a/tools/mrbc/Makefile b/tools/mrbc/Makefile
index 421ff7e0a..475f406cf 100644
--- a/tools/mrbc/Makefile
+++ b/tools/mrbc/Makefile
@@ -1,26 +1,24 @@
# makefile discription.
-# basic build file for Rite-Compiler
-# 11.Apr.2011 coded by Kenji Yoshimoto.
-# 31.Aug.2011 coded by Hiroshi Mimaki.
+# basic build file for mruby-compiler
# project-specific macros
# extension of the executable-file is modifiable(.exe .out ...)
BASEDIR := ../../src
TARGET := ../../bin/mrbc
+LIB := ../../lib/ritevm
ifeq ($(OS),Windows_NT)
EXE := $(TARGET).exe
+LIBR := $(LIB).lib
else
EXE := $(TARGET)
+LIBR := $(LIB).a
endif
-YSRC := $(BASEDIR)/parse.y
-YC := $(BASEDIR)/y.tab.c
-EXCEPT1 := $(YC) $(BASEDIR)/minimain.c $(BASEDIR)/load.c $(BASEDIR)/init_ext.c
-OBJY := $(patsubst %.c,%.o,$(YC))
+EXCEPT1 :=
OBJ0 := $(patsubst %.c,%.o,$(wildcard $(BASEDIR)/../tools/mrbc/*.c))
-OBJ1 := $(patsubst %.c,%.o,$(filter-out $(EXCEPT1),$(wildcard $(BASEDIR)/*.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) $(OBJ1) $(OBJ2) $(OBJ3)
+OBJS := $(OBJ0)
# libraries, includes
LIBS = -lm
@@ -37,7 +35,11 @@ else
CFLAGS = -O3
endif
ALL_CFLAGS = -Wall -Werror-implicit-function-declaration $(CFLAGS)
-MAKE_FLAGS = --no-print-directory CC=$(CC) LL=$(LL)
+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
@@ -47,28 +49,22 @@ all : $(EXE)
@echo "make: built targets of `pwd`"
# executable constructed using linker from object files
-$(EXE) : $(OBJS) $(OBJY)
- $(LL) -o $@ $(OBJS) $(OBJY) $(LIBS)
+$(EXE) : $(OBJS) $(LIBR)
+ $(LL) -o $@ $(OBJS) $(LIBR) $(LIBS)
--include $(OBJS:.o=.d) $(OBJY:.o=.d)
+-include $(OBJS:.o=.d)
# objects compiled from source
$(OBJS) : %.o : %.c
$(CC) $(ALL_CFLAGS) -MMD $(INCLUDES) -c $< -o $@
-# parser complie
-$(OBJY) : $(YC)
- $(CC) $(ALL_CFLAGS) -MMD $(INCLUDES) -c $(YC) -o $(OBJY)
-
-# yacc complie
-$(YC) : $(YSRC)
- $(YACC) -o $(YC) $(YSRC)
+# C library compile
+$(LIBR) :
+ @$(MAKE) -C $(BASEDIR) $(MAKE_FLAGS)
# clean up
.PHONY : clean
clean :
- -rm -f $(EXE) $(OBJS) $(OBJY) $(YC)
- -rm -f $(OBJS:.o=.d) $(OBJY:.o=.d)
- -rm -f $(patsubst %.c,%.o,$(EXCEPT1)) $(patsubst %.c,%.d,$(EXCEPT1))
@echo "make: removing targets, objects and depend files of `pwd`"
-
+ -rm -f $(EXE) $(OBJS)
+ -rm -f $(OBJS:.o=.d)
diff --git a/tools/mruby/Makefile b/tools/mruby/Makefile
index 3872fc0eb..6fe362b54 100644
--- a/tools/mruby/Makefile
+++ b/tools/mruby/Makefile
@@ -1,26 +1,24 @@
# makefile discription.
-# basic build file for Rite-Interpreter
-# 11.Apr.2011 coded by Kenji Yoshimoto.
-# 31.Aug.2011 coded by Hiroshi Mimaki.
+# basic build file for mruby executable
# project-specific macros
# extension of the executable-file is modifiable(.exe .out ...)
BASEDIR = ../../src
TARGET := ../../bin/mruby
+LIB := ../../lib/ritevm
ifeq ($(OS),Windows_NT)
EXE := $(TARGET).exe
+LIBR := $(LIB).lib
else
EXE := $(TARGET)
+LIBR := $(LIB).a
endif
-YSRC := $(BASEDIR)/parse.y
-YC := $(BASEDIR)/y.tab.c
-EXCEPT1 := $(YC) $(BASEDIR)/minimain.c $(BASEDIR)/dump.c $(BASEDIR)/cdump.c
-OBJY := $(patsubst %.c,%.o,$(YC))
OBJ0 := $(patsubst %.c,%.o,$(wildcard $(BASEDIR)/../tools/mruby/*.c))
-OBJ1 := $(patsubst %.c,%.o,$(filter-out $(EXCEPT1),$(wildcard $(BASEDIR)/*.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) $(OBJ1) $(OBJ2) $(OBJ3)
+OBJS := $(OBJ0)
+
# mruby libraries
EXTC := $(BASEDIR)/../mrblib/mrblib.c
EXTRB := $(wildcard $(BASEDIR)/../mrblib/*.rb)
@@ -32,7 +30,6 @@ EXTS := $(EXT1)
# libraries, includes
LIBS = -lm
INCLUDES = -I$(BASEDIR) -I$(BASEDIR)/../include
-#INCLUDES = -I$(RITEVM_ROOT)
# compiler, linker (gcc)
CC = gcc
@@ -45,46 +42,47 @@ else
CFLAGS = -O3
endif
ALL_CFLAGS = -Wall -Werror-implicit-function-declaration $(CFLAGS)
-MAKE_FLAGS = --no-print-directory CC=$(CC) LL=$(LL)
+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 : $(EXTM) $(EXE)
+all : $(LIBR) $(EXE)
@echo "make: built targets of `pwd`"
# executable constructed using linker from object files
-$(EXE) : $(OBJS) $(OBJY) $(EXTM) $(EXTS)
- $(LL) -o $@ $(OBJS) $(OBJY) $(EXTM) $(EXTS) $(LIBS)
+$(EXE) : $(LIBR) $(OBJS) $(EXTM) $(EXTS)
+ $(LL) -o $@ $(CFLAGS) $(OBJS) $(EXTM) $(LIBR) $(EXTS) $(LIBS)
--include $(OBJS:.o=.d) $(OBJY:.o=.d)
+-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)
+
# mruby library compile
-$(EXTM) : $(EXTRB) $(OBJS) $(OBJY)
- $(MAKE) -C ../../mrblib $(MAKE_FLAGS)
+$(EXTM) : $(EXTRB) $(LIBR)
+ @$(MAKE) -C ../mrbc $(MAKE_FLAGS)
+ @$(MAKE) -C ../../mrblib $(MAKE_FLAGS)
# extend libraries complile
$(EXTS) : %.o : %.c
$(CC) $(ALL_CFLAGS) -MMD $(INCLUDES) -c $< -o $@
-# parser complie
-$(OBJY) : $(YC)
- $(CC) $(ALL_CFLAGS) -MMD $(INCLUDES) -c $(YC) -o $(OBJY)
-
-# yacc complie
-$(YC) : $(YSRC)
- $(YACC) -o $(YC) $(YSRC)
-
# clean up
.PHONY : clean #cleandep
clean :
$(MAKE) clean -C ../../mrblib $(MAKE_FLAGS)
- -rm -f $(EXE) $(OBJS) $(OBJY) $(YC) $(EXTS)
- -rm -f $(OBJS:.o=.d) $(OBJY:.o=.d) $(EXTS:.o=.d)
- -rm -f $(patsubst %.c,%.o,$(EXCEPT1)) $(patsubst %.c,%.d,$(EXCEPT1))
+ $(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)