diff options
| -rw-r--r-- | Makefile | 13 | ||||
| -rw-r--r-- | mrblib/Makefile | 17 | ||||
| -rw-r--r-- | src/Makefile | 13 | ||||
| -rw-r--r-- | test/Makefile | 29 | ||||
| -rw-r--r-- | tools/mirb/Makefile | 8 | ||||
| -rw-r--r-- | tools/mrbc/Makefile | 8 | ||||
| -rw-r--r-- | tools/mruby/Makefile | 7 |
7 files changed, 36 insertions, 59 deletions
@@ -1,9 +1,12 @@ # makefile discription. # basic build file for mruby -# compiler, linker (gcc) -CC = gcc -LL = gcc +# compiler, linker (gcc), archiver, parser generator +export CC = gcc +export LL = gcc +export AR = ar +export YACC = bison + DEBUG_MODE = 1 ifeq ($(DEBUG_MODE),1) CFLAGS = -g -O3 @@ -23,6 +26,10 @@ endif export MSG_BEGIN = @for line in export MSG_END = ; do echo "$$line"; done +export CP := cp +export RM_F := rm -f +export CAT := cat + ############################## # generic build targets, rules diff --git a/mrblib/Makefile b/mrblib/Makefile index d22c4509f..9a7e93596 100644 --- a/mrblib/Makefile +++ b/mrblib/Makefile @@ -15,17 +15,15 @@ MRBS := $(MRB1) LIBR0 := ../lib/libmruby_core.a LIBR := ../lib/libmruby.a -# C compiler (gcc) -CC = gcc -LL = gcc -AR = ar +# libraries, includes +INCLUDES = -I../src -I../include + 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)" @@ -40,6 +38,7 @@ else MRBC = ../bin/mrbc endif + ############################## # generic build targets, rules @@ -48,7 +47,7 @@ all : $(LIBR) # update libmruby.a $(LIBR) : $(MLIB) $(LIBR0) - cp $(LIBR0) $(LIBR) + $(CP) $(LIBR0) $(LIBR) $(AR) r $(LIBR) $(MLIB) # Compile mrblib source @@ -57,17 +56,17 @@ $(MLIB) : $(CLIB) # Compile C source from merged mruby source $(CLIB) : $(RLIB) $(MRBC) - $(MRBC) -Bmrblib_irep -o$(DLIB) $(RLIB); cat init_$(TARGET).c $(DLIB) > $@ + $(MRBC) -Bmrblib_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 $? > $@ + $(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) + -$(RM_F) $(MRBC) $(MLIB) $(CLIB) $(RLIB) $(DLIB) $(DEPLIB) $(LIBR) diff --git a/src/Makefile b/src/Makefile index 385e447e3..61012ea68 100644 --- a/src/Makefile +++ b/src/Makefile @@ -19,12 +19,6 @@ OBJS := $(OBJ1) $(OBJ2) $(OBJ3) # libraries, includes INCLUDES = -I$(BASEDIR) -I$(BASEDIR)/../include -# compiler, linker (gcc) -CC = gcc -LL = gcc -AR = ar -YACC = bison - DEBUG_MODE = 1 ifeq ($(DEBUG_MODE),1) CFLAGS = -g -O3 @@ -33,6 +27,7 @@ CFLAGS = -O3 endif ALL_CFLAGS = -Wall -Werror-implicit-function-declaration $(CFLAGS) + ############################## # generic build targets, rules @@ -64,6 +59,6 @@ $(LDEF) : $(KWD) .PHONY : clean #cleandep clean : @echo "make: removing targets, objects and depend files of `pwd`" - -rm -f $(TARGET) $(OBJS) $(OBJY) $(YC) - -rm -f $(OBJS:.o=.d) $(OBJY:.o=.d) - -rm -f $(patsubst %.c,%.o,$(EXCEPT1)) $(patsubst %.c,%.d,$(EXCEPT1)) + -$(RM_F) $(TARGET) $(OBJS) $(OBJY) $(YC) + -$(RM_F) $(OBJS:.o=.d) $(OBJY:.o=.d) + -$(RM_F) $(patsubst %.c,%.o,$(EXCEPT1)) $(patsubst %.c,%.d,$(EXCEPT1)) diff --git a/test/Makefile b/test/Makefile index d46fa7a3e..b2df11486 100644 --- a/test/Makefile +++ b/test/Makefile @@ -16,17 +16,16 @@ ASSLIB := $(BASEDIR)/assert.rb MRBS := $(BASEDIR)/t/*.rb OBJS := driver.o $(MLIB) -# C compiler (gcc) -CC = gcc -LL = gcc -AR = ar +# libraries, includes +LIBS = -lm +INCLUDES = -I$(BASEDIR)/../src -I$(BASEDIR)/../include + 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)" @@ -43,20 +42,6 @@ MRBC = ../bin/mrbc EXE := $(TARGET) endif -# libraries, includes -LIBS = -lm - -# 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) ############################## # generic build targets, rules @@ -77,14 +62,14 @@ $(OBJS) : %.o : %.c # Compile C source from merged mruby source $(CLIB) : $(RLIB) $(MRBC) $(INIT) - $(MRBC) -Bmrbtest_irep -o$(DLIB) $(RLIB); cat $(INIT) $(DLIB) > $@ + $(MRBC) -Bmrbtest_irep -o$(DLIB) $(RLIB); $(CAT) $(INIT) $(DLIB) > $@ # merge mruby sources $(RLIB) : $(ASSLIB) $(MRBS) - cat $(ASSLIB) $(MRBS) > $@ + $(CAT) $(ASSLIB) $(MRBS) > $@ # clean up .PHONY : clean clean : @echo "make: removing targets, objects and depend files of `pwd`" - -rm -f $(MLIB) $(CLIB) $(RLIB) $(DLIB) $(DEPLIB) $(OBJS) $(EXE) + -$(RM_F) $(MLIB) $(CLIB) $(RLIB) $(DLIB) $(DEPLIB) $(OBJS) $(EXE) diff --git a/tools/mirb/Makefile b/tools/mirb/Makefile index 4c6ab4e62..ba307227c 100644 --- a/tools/mirb/Makefile +++ b/tools/mirb/Makefile @@ -21,10 +21,6 @@ EXTS := $(EXT1) 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 @@ -69,5 +65,5 @@ clean : $(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) + -$(RM_F) $(EXE) $(OBJS) + -$(RM_F) $(OBJS:.o=.d) diff --git a/tools/mrbc/Makefile b/tools/mrbc/Makefile index 9ecda4a59..99f5830e6 100644 --- a/tools/mrbc/Makefile +++ b/tools/mrbc/Makefile @@ -23,9 +23,6 @@ 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 @@ -39,6 +36,7 @@ else MAKE_FLAGS = CC='$(CC)' LL='$(LL)' ALL_CFLAGS='$(ALL_CFLAGS)' endif + ############################## # generic build targets, rules @@ -63,5 +61,5 @@ $(LIBR) : .PHONY : clean clean : @echo "make: removing targets, objects and depend files of `pwd`" - -rm -f $(EXE) $(OBJS) - -rm -f $(OBJS:.o=.d) + -$(RM_F) $(EXE) $(OBJS) + -$(RM_F) $(OBJS:.o=.d) diff --git a/tools/mruby/Makefile b/tools/mruby/Makefile index 052aa93d6..0442bd422 100644 --- a/tools/mruby/Makefile +++ b/tools/mruby/Makefile @@ -26,9 +26,6 @@ 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 @@ -73,5 +70,5 @@ clean : $(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) + -$(RM_F) $(EXE) $(OBJS) + -$(RM_F) $(OBJS:.o=.d) |
