summaryrefslogtreecommitdiffhomepage
path: root/Makefile
diff options
context:
space:
mode:
authorYukihiro Matsumoto <[email protected]>2012-04-30 10:58:36 +0900
committerYukihiro Matsumoto <[email protected]>2012-04-30 10:58:36 +0900
commitdb999237bc0f9d8e9aed5f22f41b780884ceb6b8 (patch)
tree93e443677acc3c3a6c551854e8ca2357bb1a70e5 /Makefile
parentf8fb9474aad9ffc6921755eda3006475f556c4ea (diff)
downloadmruby-db999237bc0f9d8e9aed5f22f41b780884ceb6b8.tar.gz
mruby-db999237bc0f9d8e9aed5f22f41b780884ceb6b8.zip
build process restructured
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile89
1 files changed, 11 insertions, 78 deletions
diff --git a/Makefile b/Makefile
index 55988683b..7d13946d7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,42 +1,5 @@
# makefile discription.
-# basic build file for Rite-VM(mruby)
-# 11.Apr.2011 coded by Kenji Yoshimoto.
-# 17.Jan.2012 coded by Hiroshi Mimaki.
-
-# project-specific macros
-# extension of the executable-file is modifiable(.exe .out ...)
-TARGET := bin/mrubysample
-RITEVM := lib/ritevm
-MRUBY := tools/mruby/mruby
-ifeq ($(OS),Windows_NT)
-EXE := $(TARGET).exe
-LIB := $(RITEVM).lib
-MRB := $(MRUBY).exe
-else
-EXE := $(TARGET)
-LIB := $(RITEVM).a
-MRB := $(MRUBY)
-endif
-MSRC := src/minimain.c
-YSRC := src/parse.y
-YC := src/y.tab.c
-EXCEPT1 := $(YC) $(MSRC)
-OBJM := $(patsubst %.c,%.o,$(MSRC))
-OBJY := $(patsubst %.c,%.o,$(YC))
-OBJ1 := $(patsubst %.c,%.o,$(filter-out $(EXCEPT1),$(wildcard src/*.c)))
-#OBJ2 := $(patsubst %.c,%.o,$(wildcard ext/regex/*.c))
-#OBJ3 := $(patsubst %.c,%.o,$(wildcard ext/enc/*.c))
-OBJS := $(OBJ1) $(OBJ2) $(OBJ3)
-# mruby libraries
-EXTC := mrblib/mrblib.c
-EXTRB := $(wildcard mrblib/*.rb)
-EXT0 := $(patsubst %.c,%.o,src/$(EXTC))
-# ext libraries
-EXTS := $(EXT0)
-
-# libraries, includes
-LIBS = $(LIB) -lm
-INCLUDES = -I./src -I./include
+# basic build file for mruby
# library for iOS
IOSLIB := $(RITEVM)-ios.a
@@ -48,24 +11,26 @@ IOSDEVCC := xcrun -sdk iphoneos llvm-gcc-4.2 -arch armv7 -isysroot "/Developer/P
# compiler, linker (gcc)
CC = gcc
LL = gcc
-YACC = bison
DEBUG_MODE = 1
ifeq ($(DEBUG_MODE),1)
-CFLAGS = -g
+CFLAGS = -g -O3
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 = --no-print-directory CC=$(CC) LL=$(LL) ALL_CFLAGS='$(ALL_CFLAGS)'
+else
+ MAKE_FLAGS = --no-print-directory CC='$(CC)' LL='$(LL)' ALL_CFLAGS='$(ALL_CFLAGS)'
+endif
##############################
# generic build targets, rules
.PHONY : all
-all : $(LIB) $(MRB) $(EXE)
- @echo "make: built targets of `pwd`"
+all :
+ @$(MAKE) -C tools/mruby $(MAKE_FLAGS)
-##############################
# make library for iOS
.PHONY : ios
ios : $(IOSLIB)
@@ -83,40 +48,8 @@ $(IOSDEVLIB) :
$(MAKE) -C src $(MAKE_FLAGS) CC="$(IOSDEVCC)" LL="$(IOSDEVCC)"
cp $(LIB) $(IOSDEVLIB)
-# executable constructed using linker from object files
-$(EXE) : $(OBJM) $(LIB)
- $(LL) -o $@ $(OBJM) $(LIBS)
-
--include $(OBJS:.o=.d)
-
-# src compile
-$(LIB) : $(EXTS) $(OBJS) $(OBJY)
- $(MAKE) -C src $(MAKE_FLAGS)
-
-# mruby interpreter compile
-$(MRB) : $(EXTS) $(OBJS) $(OBJY)
- $(MAKE) -C tools/mruby $(MAKE_FLAGS)
-
-# objects compiled from source
-$(OBJS) :
- $(MAKE) -C src $(MAKE_FLAGS) && $(MAKE) -C tools/mruby $(MAKE_FLAGS)
-
-# extend libraries complile
-$(EXTS) : $(EXTRB)
- $(MAKE) -C mrblib $(MAKE_FLAGS)
-
-# test module compile
-$(OBJM) : $(MSRC)
- $(CC) $(ALL_CFLAGS) -MMD $(INCLUDES) -c $(MSRC) -o $(OBJM)
-
# clean up
.PHONY : clean
clean :
- $(MAKE) clean -C src $(MAKE_FLAGS)
- $(MAKE) clean -C tools/mrbc $(MAKE_FLAGS)
- $(MAKE) clean -C tools/mruby $(MAKE_FLAGS)
- -rm -f $(EXE) $(OBJM)
- -rm -f $(OBJM:.o=.d)
- -rm -f $(patsubst %.c,%.o,$(EXCEPT1)) $(patsubst %.c,%.d,$(EXCEPT1))
- -rm -f $(IOSLIB) $(IOSSIMLIB) $(IOSDEVLIB)
- @echo "make: removing targets, objects and depend files of `pwd`"
+ @$(MAKE) clean -C src $(MAKE_FLAGS)
+ @$(MAKE) clean -C tools/mruby $(MAKE_FLAGS)