mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
build process restructured
This commit is contained in:
+6
-27
@@ -1,7 +1,5 @@
|
||||
# makefile discription.
|
||||
# basic build file for RiteVM library
|
||||
# 11.Apr.2011 coded by Kenji Yoshimoto.
|
||||
# 31.Aug.2011 coded by Hiroshi Mimaki.
|
||||
# basic build file for mruby library
|
||||
|
||||
# project-specific macros
|
||||
# extension of the executable-file is modifiable(.exe .out ...)
|
||||
@@ -14,23 +12,15 @@ LIB := $(TARGET).a
|
||||
endif
|
||||
YSRC := $(BASEDIR)/parse.y
|
||||
YC := $(BASEDIR)/y.tab.c
|
||||
EXCEPT1 := $(YC) $(BASEDIR)/minimain.c $(BASEDIR)/compile.c $(BASEDIR)/dump.c $(BASEDIR)/cdump.c
|
||||
EXCEPT1 := $(YC) $(BASEDIR)/minimain.c
|
||||
OBJY := $(patsubst %.c,%.o,$(YC))
|
||||
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 := $(OBJ1) $(OBJ2) $(OBJ3)
|
||||
# mruby libraries
|
||||
EXTC := $(BASEDIR)/../mrblib/mrblib.c
|
||||
EXTRB := $(wildcard $(BASEDIR)/../mrblib/*.rb)
|
||||
EXTM := $(patsubst %.c,%.o,$(EXTC))
|
||||
# extend libraries
|
||||
#EXT1 := $(patsubst %.c,%.o,$(wildcard $(BASEDIR)/ext/socket/*.c))
|
||||
EXTS := $(EXT1)
|
||||
|
||||
# libraries, includes
|
||||
INCLUDES = -I$(BASEDIR) -I$(BASEDIR)/../include
|
||||
#INCLUDES = -I$(RITEVM_ROOT)
|
||||
|
||||
# compiler, linker (gcc)
|
||||
CC = gcc
|
||||
@@ -45,18 +35,17 @@ else
|
||||
CFLAGS = -O3
|
||||
endif
|
||||
ALL_CFLAGS = -Wall -Werror-implicit-function-declaration $(CFLAGS)
|
||||
MAKE_FLAGS = --no-print-directory CC=$(CC) LL=$(LL)
|
||||
|
||||
##############################
|
||||
# generic build targets, rules
|
||||
|
||||
.PHONY : all
|
||||
all : $(EXTM) $(LIB)
|
||||
all : $(LIB)
|
||||
@echo "make: built targets of `pwd`"
|
||||
|
||||
# executable constructed using linker from object files
|
||||
$(LIB) : $(OBJS) $(OBJY) $(EXTM) $(EXTS)
|
||||
$(AR) r $@ $(OBJS) $(OBJY) $(EXTM) $(EXTS)
|
||||
$(LIB) : $(OBJS) $(OBJY)
|
||||
$(AR) r $@ $(OBJS) $(OBJY)
|
||||
|
||||
-include $(OBJS:.o=.d) $(OBJY:.o=.d)
|
||||
|
||||
@@ -64,14 +53,6 @@ $(LIB) : $(OBJS) $(OBJY) $(EXTM) $(EXTS)
|
||||
$(OBJS) : %.o : %.c
|
||||
$(CC) $(ALL_CFLAGS) -MMD $(INCLUDES) -c $< -o $@
|
||||
|
||||
# mruby library compile
|
||||
$(EXTM) : $(EXTRB) $(OBJS) $(OBJY)
|
||||
$(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)
|
||||
@@ -83,9 +64,7 @@ $(YC) : $(YSRC)
|
||||
# clean up
|
||||
.PHONY : clean #cleandep
|
||||
clean :
|
||||
$(MAKE) clean -C ../mrblib $(MAKE_FLAGS)
|
||||
@echo "make: removing targets, objects and depend files of `pwd`"
|
||||
-rm -f $(LIB) $(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`"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user