Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
90 lines (65 sloc) 2.19 KB
# This is the default Makefile integrated
# by each Gem. It integrates important constants
# for usage inside of a Gem.
ifeq ($(strip $(MRUBY_ROOT)),)
# mruby src root
MRUBY_ROOT := $(realpath ../../..)
endif
# Tools
CC := gcc
RM := rm -f
AR := ar
SRC_DIR := src
MRB_DIR := mrblib
# LIBR can be manipulated with command line arguments
ifeq ($(strip $(LIBR)),)
# default mruby library
LIBR := $(MRUBY_ROOT)/lib/libmruby.a
endif
GEM_PACKAGE := mrb-$(GEM)-gem.a
ifeq ($(strip $(ACTIVE_GEMS)),)
# the default file which contains the active GEMs
ACTIVE_GEMS = GEMS.active
endif
# Default rules which are calling the
# gem specific gem-all and gem-clean
# implementations of a gem
.PHONY : all
all : gem-info gem-all
gem-info:
@echo "Building Gem '$(GEM)'"
# Building target for C and Ruby files
gem-c-and-rb-files : gem_mixlib.o
$(AR) rs $(GEM_PACKAGE) $(GEM_OBJECTS) $^
gem_mixlib.c : gem_mrblib_header.ctmp gem_mrblib_irep.ctmp gem_mixlib_init.ctmp
cat $^ > $@
gem_mixlib_init.ctmp :
$(MRUBY_ROOT)/mrbgems/generator gem_mixlib $(GEM) > $@
# Building target for C files
gem-c-files : gem_srclib.o
$(AR) rs $(GEM_PACKAGE) $(GEM_OBJECTS) $<
gem_srclib.c :
$(MRUBY_ROOT)/mrbgems/generator gem_srclib $(GEM) > $@
# Building target for Ruby Files
gem-rb-files : gem_mrblib.o
$(AR) rs $(GEM_PACKAGE) $<
gem_mrblib.c : gem_mrblib_header.ctmp gem_mrblib_irep.ctmp gem_mrblib_init.ctmp
cat $^ > $@
gem_mrblib_header.ctmp :
$(MRUBY_ROOT)/mrbgems/generator gem_mrblib > $@
gem_mrblib_init.ctmp :
$(MRUBY_ROOT)/mrbgems/generator gem_mrblib $(GEM) > $@
gem_mrblib_irep.ctmp : gem_mrblib.rbtmp
$(MRUBY_ROOT)/bin/mrbc -Bgem_mrblib_irep_$(subst -,_,$(GEM)) -o$@ $<
gem_mrblib.rbtmp :
cat $(GEM_RB_FILES) > $@
gem-clean-c-and-rb-files :
-$(RM) $(GEM_PACKAGE) gem_mixlib.o gem_mixlib.c gem_mrblib_header.ctmp gem_mrblib_irep.ctmp gem_mixlib_init.ctmp gem_mrblib.rbtmp
-$(RM) gem_srclib.c gem_srclib.o $(GEM_OBJECTS)
gem-clean-c-files :
-$(RM) $(GEM_PACKAGE) gem_srclib.c gem_srclib.o $(GEM_OBJECTS)
gem-clean-rb-files :
-$(RM) $(GEM_PACKAGE) gem_mrblib.o gem_mrblib.c gem_mrblib_header.ctmp gem_mrblib_init.ctmp gem_mrblib_irep.ctmp gem_mrblib.rbtmp
.PHONY : clean
clean : gem-clean
@echo "Gem '$(GEM)' is clean"
Jump to Line
Something went wrong with that request. Please try again.