Skip to content
This repository
tree: 72bcf7ee01
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 88 lines (74 sloc) 1.966 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
# Makefile description.
# basic build file for mruby

# compiler, linker (gcc), archiver, parser generator
export CC = gcc
export LL = gcc
export AR = ar
export YACC = bison

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 = --no-print-directory CC=$(CC) LL=$(LL) ALL_CFLAGS='$(ALL_CFLAGS)'
else
  MAKE_FLAGS = --no-print-directory CC='$(CC)' LL='$(LL)' ALL_CFLAGS='$(ALL_CFLAGS)'
endif

##############################
# internal variables

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

.PHONY : all
all :
@$(MAKE) -C src $(MAKE_FLAGS)
@$(MAKE) -C mrblib $(MAKE_FLAGS)
@$(MAKE) -C tools/mruby $(MAKE_FLAGS)
@$(MAKE) -C tools/mirb $(MAKE_FLAGS)

# mruby test
.PHONY : test
test : all
@$(MAKE) -C test $(MAKE_FLAGS)

# clean up
.PHONY : clean
clean :
@$(MAKE) clean -C src $(MAKE_FLAGS)
@$(MAKE) clean -C tools/mruby $(MAKE_FLAGS)
@$(MAKE) clean -C tools/mirb $(MAKE_FLAGS)
@$(MAKE) clean -C test $(MAKE_FLAGS)

# display help for build configuration and interesting targets
.PHONY : showconfig
showconfig :
$(MSG_BEGIN) \
"" \
" CC = $(CC)" \
" LL = $(LL)" \
" MAKE = $(MAKE)" \
"" \
" CFLAGS = $(CFLAGS)" \
" ALL_CFLAGS = $(ALL_CFLAGS)" \
$(MSG_END)

.PHONY : help
help :
$(MSG_BEGIN) \
"" \
" Basic mruby Makefile" \
"" \
"targets:" \
" all (default): build all targets, install (locally) in-repo" \
" clean: clean all built and in-repo installed artifacts" \
" showconfig: show build config summary" \
" test: run all mruby tests" \
$(MSG_END)
Something went wrong with that request. Please try again.