From 83e5999d7efcad648e9ecbd64c51b305b6261999 Mon Sep 17 00:00:00 2001 From: Daniel Bovensiepen Date: Mon, 18 Jun 2012 11:22:05 +0800 Subject: Make CFLAG choices in Makefiles more flexible --- tools/mirb/Makefile | 13 ++++++++++--- tools/mrbc/Makefile | 17 ++++++++++++----- tools/mruby/Makefile | 17 ++++++++++++----- 3 files changed, 34 insertions(+), 13 deletions(-) (limited to 'tools') diff --git a/tools/mirb/Makefile b/tools/mirb/Makefile index ba307227c..52941f242 100644 --- a/tools/mirb/Makefile +++ b/tools/mirb/Makefile @@ -21,12 +21,19 @@ EXTS := $(EXT1) LIBS = -lm INCLUDES = -I$(BASEDIR) -I$(BASEDIR)/../include -DEBUG_MODE = 1 -ifeq ($(DEBUG_MODE),1) +ifeq ($(strip $(COMPILE_MODE)),) + # default compile option + COMPILE_MODE = debug +endif + +ifeq ($(COMPILE_MODE),debug) CFLAGS = -g -O3 -else +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)" diff --git a/tools/mrbc/Makefile b/tools/mrbc/Makefile index 99f5830e6..eea0c02cb 100644 --- a/tools/mrbc/Makefile +++ b/tools/mrbc/Makefile @@ -23,12 +23,19 @@ LIBS = -lm INCLUDES = -I$(BASEDIR) -I$(BASEDIR)/../include # compiler, linker (gcc) -DEBUG_MODE = 1 -ifeq ($(DEBUG_MODE),1) -CFLAGS = -g -O3 -else -CFLAGS = -O3 +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)" diff --git a/tools/mruby/Makefile b/tools/mruby/Makefile index 0442bd422..9955b4302 100644 --- a/tools/mruby/Makefile +++ b/tools/mruby/Makefile @@ -26,12 +26,19 @@ LIBS = -lm INCLUDES = -I$(BASEDIR) -I$(BASEDIR)/../include # compiler, linker (gcc) -DEBUG_MODE = 1 -ifeq ($(DEBUG_MODE),1) -CFLAGS = -g -O3 -else -CFLAGS = -O3 +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)" -- cgit v1.2.3