summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2012-06-17 22:23:55 -0700
committerYukihiro "Matz" Matsumoto <[email protected]>2012-06-17 22:23:55 -0700
commit95bed11755f983ac66c386dc15bca8c414f06316 (patch)
tree1ee159301f9637074abc1550fc12adfef9eb9c60
parent955a48d964a2bbe175617880c868ca8b862da74e (diff)
parent83e5999d7efcad648e9ecbd64c51b305b6261999 (diff)
downloadmruby-95bed11755f983ac66c386dc15bca8c414f06316.tar.gz
mruby-95bed11755f983ac66c386dc15bca8c414f06316.zip
Merge pull request #297 from bovi/improve-cflag-choice
Make CFLAG choices in Makefiles more flexible
-rw-r--r--Makefile17
-rw-r--r--mrblib/Makefile17
-rw-r--r--src/Makefile17
-rw-r--r--test/Makefile17
-rw-r--r--tools/mirb/Makefile13
-rw-r--r--tools/mrbc/Makefile17
-rw-r--r--tools/mruby/Makefile17
7 files changed, 82 insertions, 33 deletions
diff --git a/Makefile b/Makefile
index e7408d793..a960fc14a 100644
--- a/Makefile
+++ b/Makefile
@@ -7,12 +7,19 @@ export LL = gcc
export AR = ar
export YACC = bison
-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 = --no-print-directory CC=$(CC) LL=$(LL) ALL_CFLAGS='$(ALL_CFLAGS)'
diff --git a/mrblib/Makefile b/mrblib/Makefile
index c7226ddcd..01a5a6198 100644
--- a/mrblib/Makefile
+++ b/mrblib/Makefile
@@ -18,12 +18,19 @@ LIBR := ../lib/libmruby.a
# libraries, includes
INCLUDES = -I../src -I../include
-DEBUG_MODE = 1
-ifeq ($(DEBUG_MODE),1)
-CFLAGS = -g
-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/src/Makefile b/src/Makefile
index 61012ea68..13f80b694 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -19,12 +19,19 @@ OBJS := $(OBJ1) $(OBJ2) $(OBJ3)
# libraries, includes
INCLUDES = -I$(BASEDIR) -I$(BASEDIR)/../include
-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)
diff --git a/test/Makefile b/test/Makefile
index 170c1dac8..921442b28 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -20,12 +20,19 @@ OBJS := driver.o $(MLIB)
LIBS = -lm
INCLUDES = -I$(BASEDIR)/../src -I$(BASEDIR)/../include
-DEBUG_MODE = 1
-ifeq ($(DEBUG_MODE),1)
-CFLAGS = -g
-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/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)"