From 105c11b7f6570292ad0fa15c8346c038f9d2f561 Mon Sep 17 00:00:00 2001 From: Jon Date: Wed, 23 May 2012 12:01:08 -0400 Subject: Clean and DRY up the basic Makefiles --- mrblib/Makefile | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'mrblib') 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) -- cgit v1.2.3 From c1faad90ec8768b9364638da4bb56b47b87c6661 Mon Sep 17 00:00:00 2001 From: Daniel Bovensiepen Date: Sun, 27 May 2012 04:34:47 +0800 Subject: Add documentation to Comparable --- mrblib/compar.rb | 52 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 44 insertions(+), 8 deletions(-) (limited to 'mrblib') diff --git a/mrblib/compar.rb b/mrblib/compar.rb index 3badf57de..9f2ab887d 100644 --- a/mrblib/compar.rb +++ b/mrblib/compar.rb @@ -1,5 +1,15 @@ +## +# Comparable +# +# ISO 15.3.3 module Comparable - # 15.3.3.2.1 + + ## + # Return true if +self+ is less + # than +other+. Otherwise return + # false. + # + # ISO 15.3.3.2.1 def < other cmp = self <=> other if cmp.nil? @@ -11,7 +21,12 @@ module Comparable end end - # 15.3.3.2.2 + ## + # Return true if +self+ is less + # than or equal to +other+. + # Otherwise return false. + # + # ISO 15.3.3.2.2 def <= other cmp = self <=> other if cmp.nil? @@ -23,7 +38,12 @@ module Comparable end end - # 15.3.3.2.3 + ## + # Return true if +self+ is equal + # to +other+. Otherwise return + # false. + # + # ISO 15.3.3.2.3 def == other cmp = self <=> other if cmp == 0 @@ -33,7 +53,12 @@ module Comparable end end - # 15.3.3.2.4 + ## + # Return true if +self+ is greater + # than +other+. Otherwise return + # false. + # + # ISO 15.3.3.2.4 def > other cmp = self <=> other if cmp.nil? @@ -45,9 +70,14 @@ module Comparable end end - # 15.3.3.2.5 + ## + # Return true if +self+ is greater + # than or equal to +other+. + # Otherwise return false. + # + # ISO 15.3.3.2.5 def >= other - cmp = self <=> other + cmp = self <=> other if cmp.nil? false elsif cmp >= 0 @@ -57,8 +87,14 @@ module Comparable end end - # 15.3.3.2.6 - def between?(min,max) + ## + # Return true if +self+ is greater + # than or equal to +min+ and + # less than or equal to +max+. + # Otherwise return false. + # + # ISO 15.3.3.2.6 + def between?(min, max) if self < min or self > max false else -- cgit v1.2.3 From c403458b977dea4fcab756cf1644ed69440b5e2c Mon Sep 17 00:00:00 2001 From: Jon Date: Sun, 27 May 2012 22:06:28 -0400 Subject: Remove unnecessary mrblib object build target --- mrblib/CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'mrblib') diff --git a/mrblib/CMakeLists.txt b/mrblib/CMakeLists.txt index b9fa22587..a0386f0fe 100644 --- a/mrblib/CMakeLists.txt +++ b/mrblib/CMakeLists.txt @@ -45,12 +45,10 @@ else() endif() -add_library(mrblib_object OBJECT mrblib.c) - # generate final static libmruby archive library add_library(libmruby_static STATIC + mrblib.c $ - $ ) set_target_properties(libmruby_static PROPERTIES OUTPUT_NAME mruby) -- cgit v1.2.3 From 661906c6824e992790c2558d9983eb606367f5cc Mon Sep 17 00:00:00 2001 From: Yukihiro Matsumoto Date: Mon, 28 May 2012 12:10:23 +0900 Subject: should compile all mrblib files --- mrblib/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mrblib') diff --git a/mrblib/Makefile b/mrblib/Makefile index 9a7e93596..c7226ddcd 100644 --- a/mrblib/Makefile +++ b/mrblib/Makefile @@ -63,7 +63,7 @@ $(MRBC) : ../src/opcode.h ../src/codegen.c ../src/parse.y # merge mruby sources $(RLIB) : $(MRBS) - $(CAT) $? > $@ + $(CAT) $(MRBS) > $@ # clean up .PHONY : clean -- cgit v1.2.3