diff options
| author | Yuichiro MASUI <[email protected]> | 2012-12-29 05:37:55 +0900 |
|---|---|---|
| committer | Yuichiro MASUI <[email protected]> | 2013-01-03 02:24:15 +0900 |
| commit | 7c469c0b9dadd1de09fed18c3e5cc551012c38c1 (patch) | |
| tree | b79aa703ef7c528896c4f1be8280d0691314008b /tools | |
| parent | a48fc0d7952ad1f10ae777637269fe6a3f9ad0a2 (diff) | |
| download | mruby-7c469c0b9dadd1de09fed18c3e5cc551012c38c1.tar.gz mruby-7c469c0b9dadd1de09fed18c3e5cc551012c38c1.zip | |
Rebuild CRuby based building script without Makefile
Tested CRuby 1.8.6 and 1.9.3
You can see building configuration in build_config.rb
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/CMakeLists.txt | 8 | ||||
| -rw-r--r-- | tools/mirb/CMakeLists.txt | 9 | ||||
| -rw-r--r-- | tools/mirb/Makefile | 94 | ||||
| -rw-r--r-- | tools/mirb/mirb.rake | 10 | ||||
| -rw-r--r-- | tools/mrbc/CMakeLists.txt | 9 | ||||
| -rw-r--r-- | tools/mrbc/Makefile | 72 | ||||
| -rw-r--r-- | tools/mrbc/mrbc.rake | 10 | ||||
| -rw-r--r-- | tools/mruby/CMakeLists.txt | 9 | ||||
| -rw-r--r-- | tools/mruby/Makefile | 99 | ||||
| -rw-r--r-- | tools/mruby/mruby.rake | 10 | ||||
| -rw-r--r-- | tools/xpcat/CMakeLists.txt | 5 | ||||
| -rw-r--r-- | tools/xpcat/xpcat.c | 72 |
12 files changed, 30 insertions, 377 deletions
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt deleted file mode 100644 index ce348f3aa..000000000 --- a/tools/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -# specify the internal and external tools to be built - -add_subdirectory(xpcat) -add_subdirectory(mrbc) -add_subdirectory(mruby) -add_subdirectory(mirb) - -# vim: ts=2 sts=2 sw=2 et diff --git a/tools/mirb/CMakeLists.txt b/tools/mirb/CMakeLists.txt deleted file mode 100644 index a9f52db1f..000000000 --- a/tools/mirb/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# build tools/mirb executable - -file(GLOB MIRBBIN_SRC_C "*.c") -add_executable(mirb ${MIRBBIN_SRC_C}) -target_link_libraries(mirb libmruby_static ${MRUBY_LIBS}) - -install(TARGETS mirb RUNTIME DESTINATION bin) - -# vim: ts=2 sts=2 sw=2 et diff --git a/tools/mirb/Makefile b/tools/mirb/Makefile deleted file mode 100644 index b953038a8..000000000 --- a/tools/mirb/Makefile +++ /dev/null @@ -1,94 +0,0 @@ -# Makefile description. -# basic build file for mirb executable - -# project-specific macros -# extension of the executable-file is modifiable(.exe .out ...) -MRUBY_ROOT := ../.. -BASEDIR = ../../src -TARGET := ../../bin/mirb -LIBR := ../../lib/libmruby.a - -ifeq ($(strip $(ENABLE_GEMS)),) - # by default GEMs are deactivated - ENABLE_GEMS = false -endif - -ifeq ($(ENABLE_GEMS),false) - GEM_ARCHIVE_FILES = -else - MAKEFILE_GEM_LIST := $(MRUBY_ROOT)/mrbgems/g/MakefileGemList - ifeq ($(wildcard $(MAKEFILE_GEM_LIST)),) - GEM_ARCHIVE_FILES = - else - include $(MAKEFILE_GEM_LIST) - endif -endif - -ifeq ($(OS),Windows_NT) - EXE := $(TARGET).exe -else - EXE := $(TARGET) -endif -OBJ0 := $(patsubst %.c,%.o,$(wildcard $(BASEDIR)/../tools/mirb/*.c)) -OBJS := $(OBJ0) - -# ext libraries -EXTS := $(EXT1) - -# libraries, includes -LIBS = -lm -INCLUDES = -I$(BASEDIR) -I$(BASEDIR)/../include - -ifeq ($(strip $(COMPILE_MODE)),) - # default compile option - COMPILE_MODE = debug -endif - -ifeq ($(COMPILE_MODE),debug) - CFLAGS = -g -O3 -else ifeq ($(COMPILE_MODE),release) - CFLAGS = -O3 -else ifeq ($(COMPILE_MODE),small) - CFLAGS = -Os -endif - -ALL_CFLAGS = -Wall -Werror-implicit-function-declaration $(CFLAGS) -ifeq ($(OS),Windows_NT) - MAKE_FLAGS = CC=$(CC) LL=$(LL) ALL_CFLAGS='$(ALL_CFLAGS)' LDFLAGS='$(LDFLAGS)' -else - MAKE_FLAGS = CC='$(CC)' LL='$(LL)' ALL_CFLAGS='$(ALL_CFLAGS)' LDFLAGS='$(LDFLAGS)' -endif - -############################## -# generic build targets, rules - -.PHONY : all -all : $(LIBR) $(EXE) - -# executable constructed using linker from object files -$(EXE) : $(LIBR) $(OBJS) $(GEM_ARCHIVE_FILES) $(EXTS) - $(LL) -o $@ $(LDFLAGS) $(OBJS) $(LIBR) $(GEM_ARCHIVE_FILES) $(EXTS) $(LIBS) - --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 -# extend libraries complile -$(EXTS) : %.o : %.c - $(CC) $(ALL_CFLAGS) -MMD $(INCLUDES) -c $< -o $@ - -# clean up -.PHONY : clean #cleandep -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) diff --git a/tools/mirb/mirb.rake b/tools/mirb/mirb.rake new file mode 100644 index 000000000..045f6ab90 --- /dev/null +++ b/tools/mirb/mirb.rake @@ -0,0 +1,10 @@ +dir = File.dirname(__FILE__).sub(%r|^\./|, '') + +MRuby.each_target do + exec = exefile("#{build_dir}/bin/mirb") + objs = Dir.glob("#{dir}/*.{c}").map { |f| f.pathmap("#{build_dir}/%X.o") } + + file exec => objs + ["#{build_dir}/lib/libmruby.a"] do |t| + link t.name, t.prerequisites, [], gems.map { |g| g.mruby_libs } + end +end
\ No newline at end of file diff --git a/tools/mrbc/CMakeLists.txt b/tools/mrbc/CMakeLists.txt deleted file mode 100644 index 043b7dc83..000000000 --- a/tools/mrbc/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# build tools/mrbc executable - -file(GLOB MRBC_SRC_C "*.c") -add_executable(mrbc ${MRBC_SRC_C} $<TARGET_OBJECTS:mruby_object>) -target_link_libraries(mrbc ${MRUBY_LIBS}) - -install(TARGETS mrbc RUNTIME DESTINATION bin) - -# vim: ts=2 sts=2 sw=2 et diff --git a/tools/mrbc/Makefile b/tools/mrbc/Makefile deleted file mode 100644 index ea2286021..000000000 --- a/tools/mrbc/Makefile +++ /dev/null @@ -1,72 +0,0 @@ -# Makefile description. -# basic build file for mruby-compiler - -# project-specific macros -# extension of the executable-file is modifiable(.exe .out ...) -BASEDIR := ../../src -TARGET := ../../bin/mrbc -LIBR := ../../lib/libmruby_core.a -ifeq ($(OS),Windows_NT) -EXE := $(TARGET).exe -else -EXE := $(TARGET) -endif -EXCEPT1 := -OBJ0 := $(patsubst %.c,%.o,$(wildcard $(BASEDIR)/../tools/mrbc/*.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) - -# libraries, includes -LIBS = -lm -INCLUDES = -I$(BASEDIR) -I$(BASEDIR)/../include - -# compiler, linker (gcc) -ifeq ($(strip $(COMPILE_MODE)),) - # default compile option - COMPILE_MODE = debug -endif - -ifeq ($(COMPILE_MODE),debug) - CFLAGS = -g -O3 -else ifeq ($(COMPILE_MODE),release) - CFLAGS = -O3 -else ifeq ($(COMPILE_MODE),small) - CFLAGS = -Os -endif - -ALL_CFLAGS = -Wall -Werror-implicit-function-declaration $(CFLAGS) -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 : $(EXE) - -# executable constructed using linker from object files -$(EXE) : $(OBJS) $(LIBR) - $(LL) -o $@ $(LDFLAGS) $(OBJS) $(LIBR) $(LIBS) - --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) - -# clean up -.PHONY : clean -clean : - @echo "make: removing targets, objects and depend files of `pwd`" - -$(RM_F) $(EXE) $(OBJS) - -$(RM_F) $(OBJS:.o=.d) diff --git a/tools/mrbc/mrbc.rake b/tools/mrbc/mrbc.rake new file mode 100644 index 000000000..4cca63b6f --- /dev/null +++ b/tools/mrbc/mrbc.rake @@ -0,0 +1,10 @@ +dir = File.dirname(__FILE__).sub(%r|^\./|, '') + +MRuby.each_target do + exec = exefile("#{build_dir}/bin/mrbc") + objs = Dir.glob("#{dir}/*.{c}").map { |f| f.pathmap("#{build_dir}/%X.o") } + + file exec => objs + ["#{build_dir}/lib/libmruby_core.a"] do |t| + link t.name, t.prerequisites, [], gems.map { |g| g.mruby_libs } + end +end
\ No newline at end of file diff --git a/tools/mruby/CMakeLists.txt b/tools/mruby/CMakeLists.txt deleted file mode 100644 index beff6280d..000000000 --- a/tools/mruby/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# build tools/mruby executable - -file(GLOB MRUBYBIN_SRC_C "*.c") -add_executable(mruby ${MRUBYBIN_SRC_C}) -target_link_libraries(mruby libmruby_static ${MRUBY_LIBS}) - -install(TARGETS mruby RUNTIME DESTINATION bin) - -# vim: ts=2 sts=2 sw=2 et diff --git a/tools/mruby/Makefile b/tools/mruby/Makefile deleted file mode 100644 index 55e37aafa..000000000 --- a/tools/mruby/Makefile +++ /dev/null @@ -1,99 +0,0 @@ -# Makefile description. -# basic build file for mruby executable - -# project-specific macros -# extension of the executable-file is modifiable(.exe .out ...) -MRUBY_ROOT := ../.. -BASEDIR = $(MRUBY_ROOT)/src -TARGET := $(MRUBY_ROOT)/bin/mruby -LIBR := $(MRUBY_ROOT)/lib/libmruby.a - -ifeq ($(strip $(ENABLE_GEMS)),) - # by default GEMs are deactivated - ENABLE_GEMS = false -endif - -ifeq ($(ENABLE_GEMS),false) - GEM_ARCHIVE_FILES = -else - MAKEFILE_GEM_LIST := $(MRUBY_ROOT)/mrbgems/g/MakefileGemList - ifeq ($(wildcard $(MAKEFILE_GEM_LIST)),) - GEM_ARCHIVE_FILES = - else - include $(MAKEFILE_GEM_LIST) - endif -endif - -ifeq ($(OS),Windows_NT) -EXE := $(TARGET).exe -else -EXE := $(TARGET) -endif -OBJ0 := $(patsubst %.c,%.o,$(wildcard $(BASEDIR)/../tools/mruby/*.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) - -# ext libraries -#EXT1 := $(patsubst %.c,%.o,$(wildcard $(BASEDIR)/../ext/socket/*.c)) -EXTS := $(EXT1) - -# libraries, includes -LIBS = -lm -INCLUDES = -I$(BASEDIR) -I$(BASEDIR)/../include - -# compiler, linker (gcc) -ifeq ($(strip $(COMPILE_MODE)),) - # default compile option - COMPILE_MODE = debug -endif - -ifeq ($(COMPILE_MODE),debug) - CFLAGS = -g -O3 -else ifeq ($(COMPILE_MODE),release) - CFLAGS = -O3 -else ifeq ($(COMPILE_MODE),small) - CFLAGS = -Os -endif - -ALL_CFLAGS = -Wall -Werror-implicit-function-declaration $(CFLAGS) -ifeq ($(OS),Windows_NT) - MAKE_FLAGS = CC=$(CC) LL=$(LL) ALL_CFLAGS='$(ALL_CFLAGS)' LDFLAGS='$(LDFLAGS)' -else - MAKE_FLAGS = CC='$(CC)' LL='$(LL)' ALL_CFLAGS='$(ALL_CFLAGS)' LDFLAGS='$(LDFLAGS)' -endif - -############################## -# generic build targets, rules - -.PHONY : all -all : $(LIBR) $(EXE) - -# executable constructed using linker from object files -$(EXE) : $(LIBR) $(OBJS) $(GEM_ARCHIVE_FILES) $(EXTS) - $(LL) -o $@ $(LDFLAGS) $(OBJS) $(LIBR) $(GEM_ARCHIVE_FILES) $(EXTS) $(LIBS) - --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 -# extend libraries complile -$(EXTS) : %.o : %.c - $(CC) $(ALL_CFLAGS) -MMD $(INCLUDES) -c $< -o $@ - -# clean up -.PHONY : clean #cleandep -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) diff --git a/tools/mruby/mruby.rake b/tools/mruby/mruby.rake new file mode 100644 index 000000000..4159fadfd --- /dev/null +++ b/tools/mruby/mruby.rake @@ -0,0 +1,10 @@ +dir = File.dirname(__FILE__).sub(%r|^\./|, '') + +MRuby.each_target do + exec = exefile("#{build_dir}/bin/mruby") + objs = Dir.glob("#{dir}/*.{c}").map { |f| f.pathmap("#{build_dir}/%X.o") } + + file exec => objs + ["#{build_dir}/lib/libmruby.a"] do |t| + link t.name, t.prerequisites, [], gems.map { |g| g.mruby_libs } + end +end
\ No newline at end of file diff --git a/tools/xpcat/CMakeLists.txt b/tools/xpcat/CMakeLists.txt deleted file mode 100644 index bb4d326f5..000000000 --- a/tools/xpcat/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -# build tools/xpcat internal executable - -add_executable(xpcat xpcat.c) - -# vim: ts=2 sts=2 sw=2 et diff --git a/tools/xpcat/xpcat.c b/tools/xpcat/xpcat.c deleted file mode 100644 index e39babcb5..000000000 --- a/tools/xpcat/xpcat.c +++ /dev/null @@ -1,72 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -static void -usage(const char *program) -{ - printf("Usage: %s -o outputfile FILE...\n", program); -} - -int -main(int argc, char *argv[]) -{ - int i, ch; - const char *output = NULL; - FILE *infile = NULL; - FILE *outfile = NULL; - - if (argc < 4) { - usage(argv[0]); - return EXIT_FAILURE; - } - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-o") == 0) { - i++; - if (i < argc) - output = argv[i]; - else { - usage(argv[0]); - return EXIT_FAILURE; - } - } - } - - if (output) { - outfile = fopen(output, "wb"); - if (!outfile) { - fprintf(stderr, "[ERROR] unable to open output file: %s\n", output); - return EXIT_FAILURE; - } - setbuf(outfile, NULL); - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-o") == 0) { - i++; - continue; - } - - infile = fopen(argv[i], "rb"); - if (!infile) { - fprintf(stderr, "[ERROR] unable to open input file: %s\n", argv[i]); - return EXIT_FAILURE; - } - setbuf(infile, NULL); - - while ((ch = getc(infile)) != EOF) { - if (putc(ch, outfile) == EOF) { - fprintf(stderr, "[ERROR] error writing output file: %s\n", output); - return EXIT_FAILURE; - } - } - - fclose(infile); - } - } - - fclose(outfile); - return EXIT_SUCCESS; -} - -/* vim: set ts=2 sts=2 sw=2 et: */ |
