From b5dcb7128d7d235b66b4d9be879d26364dd1e3e9 Mon Sep 17 00:00:00 2001 From: Beoran Date: Tue, 1 May 2012 20:13:09 +0200 Subject: First cmake build system. Works on Linux. --- src/CMakeLists.txt | 23 ++++++++++++++++++++ src/Makefile | 64 ------------------------------------------------------ src/Makefile.orig | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 64 deletions(-) create mode 100644 src/CMakeLists.txt delete mode 100644 src/Makefile create mode 100644 src/Makefile.orig (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 000000000..b25711ae3 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,23 @@ +# Build the C files in the mruby src directory + +cmake_minimum_required(VERSION 2.6) +if(CMAKE_VERSION VERSION_GREATER "2.8.0") + cmake_policy(SET CMP0012 OLD) +endif() + +find_package(BISON) +BISON_TARGET(mruby parse.y ${CMAKE_CURRENT_BINARY_DIR}/parse.c) + +# configure_file("config.in.h" "config.h") +file(GLOB MRUBY_SRC_C "*.c") +add_library(ritevm_object OBJECT ${MRUBY_SRC_C}) +add_library(ritevm_static STATIC $) +add_library(ritevm SHARED $) + + +# target_link_libraries(ritevm ${MRUBY_LIBS}) +# target_link_libraries(ritevm_static ${MRUBY_LIBS}) +# install(TARGETS ritevm ritevm_static +# LIBRARY DESTINATION lib +# ARCHIVE DESTINATION lib) + diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index 14485041d..000000000 --- a/src/Makefile +++ /dev/null @@ -1,64 +0,0 @@ -# makefile discription. -# basic build file for mruby library - -# project-specific macros -# extension of the executable-file is modifiable(.exe .out ...) -BASEDIR = . -TARGET := ../lib/libmruby_core.a -YSRC := $(BASEDIR)/parse.y -YC := $(BASEDIR)/y.tab.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) - -# 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 -else -CFLAGS = -O3 -endif -ALL_CFLAGS = -Wall -Werror-implicit-function-declaration $(CFLAGS) - -############################## -# generic build targets, rules - -.PHONY : all -all : $(TARGET) - -# executable constructed using linker from object files -$(TARGET) : $(OBJS) $(OBJY) - $(AR) r $@ $(OBJS) $(OBJY) - --include $(OBJS:.o=.d) $(OBJY:.o=.d) - -# objects compiled from source -$(OBJS) : %.o : %.c - $(CC) $(ALL_CFLAGS) -MMD $(INCLUDES) -c $< -o $@ - -# parser complie -$(OBJY) : $(YC) - $(CC) $(ALL_CFLAGS) -MMD $(INCLUDES) -c $(YC) -o $(OBJY) - -# yacc complie -$(YC) : $(YSRC) - $(YACC) -o $(YC) $(YSRC) - -# clean up -.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)) diff --git a/src/Makefile.orig b/src/Makefile.orig new file mode 100644 index 000000000..14485041d --- /dev/null +++ b/src/Makefile.orig @@ -0,0 +1,64 @@ +# makefile discription. +# basic build file for mruby library + +# project-specific macros +# extension of the executable-file is modifiable(.exe .out ...) +BASEDIR = . +TARGET := ../lib/libmruby_core.a +YSRC := $(BASEDIR)/parse.y +YC := $(BASEDIR)/y.tab.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) + +# 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 +else +CFLAGS = -O3 +endif +ALL_CFLAGS = -Wall -Werror-implicit-function-declaration $(CFLAGS) + +############################## +# generic build targets, rules + +.PHONY : all +all : $(TARGET) + +# executable constructed using linker from object files +$(TARGET) : $(OBJS) $(OBJY) + $(AR) r $@ $(OBJS) $(OBJY) + +-include $(OBJS:.o=.d) $(OBJY:.o=.d) + +# objects compiled from source +$(OBJS) : %.o : %.c + $(CC) $(ALL_CFLAGS) -MMD $(INCLUDES) -c $< -o $@ + +# parser complie +$(OBJY) : $(YC) + $(CC) $(ALL_CFLAGS) -MMD $(INCLUDES) -c $(YC) -o $(OBJY) + +# yacc complie +$(YC) : $(YSRC) + $(YACC) -o $(YC) $(YSRC) + +# clean up +.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)) -- cgit v1.2.3