From 95499193497ce1fd15de217f7b69fc2f91a37dbf Mon Sep 17 00:00:00 2001 From: "John R. Lenton" Date: Mon, 13 Jan 2014 13:25:10 +0000 Subject: [PATCH] made DEBUG control CFLAGS in Makefiles oter than stm as well. --- teensy/Makefile | 12 +++++++++++- unix-cpy/Makefile | 9 ++++++++- unix/Makefile | 11 ++++++++++- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/teensy/Makefile b/teensy/Makefile index 8046f862a..e25f81481 100644 --- a/teensy/Makefile +++ b/teensy/Makefile @@ -24,10 +24,20 @@ SIZE = $(COMPILER_PATH)/arm-none-eabi-size CFLAGS_TEENSY = -DF_CPU=96000000 -DUSB_SERIAL -D__MK20DX256__ CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -mcpu=cortex-m4 -fsingle-precision-constant -Wdouble-promotion $(CFLAGS_TEENSY) -CFLAGS = -I. -I$(PY_SRC) -I$(CORE_PATH) -Wall -ansi -std=gnu99 -Os -DNDEBUG $(CFLAGS_CORTEX_M4) -D$(TARGET) +CFLAGS = -I. -I$(PY_SRC) -I$(CORE_PATH) -Wall -ansi -std=gnu99 LDFLAGS = -nostdlib -T mk20dx256.ld LIBS = -L $(COMPILER_PATH)/../lib/gcc/arm-none-eabi/4.7.2/thumb2 -lgcc +#Debugging/Optimization +ifdef DEBUG +CFLAGS += -Og -ggdb +else +CFLAGS += -Os #-DNDEBUG +endif + +# if order is not important for these, move them up +CFLAGS += $(CFLAGS_CORTEX_M4) -D$(TARGET) + SRC_C = \ main.c \ lcd.c \ diff --git a/unix-cpy/Makefile b/unix-cpy/Makefile index 90e1f733d..e59a06b7a 100644 --- a/unix-cpy/Makefile +++ b/unix-cpy/Makefile @@ -11,9 +11,16 @@ ECHO = @echo # compiler settings CC = gcc -CFLAGS = -I. -I$(PY_SRC) -Wall -Werror -ansi -std=gnu99 -Os #-DNDEBUG +CFLAGS = -I. -I$(PY_SRC) -Wall -Werror -ansi -std=gnu99 LDFLAGS = -lm +#Debugging/Optimization +ifdef DEBUG +CFLAGS += -Og -ggdb +else +CFLAGS += -Os #-DNDEBUG +endif + # source files SRC_C = \ main.c \ diff --git a/unix/Makefile b/unix/Makefile index e9bae4768..2c54cf2d4 100644 --- a/unix/Makefile +++ b/unix/Makefile @@ -11,9 +11,16 @@ ECHO = @echo # compiler settings CC = gcc -CFLAGS = -I. -I$(PY_SRC) -Wall -Werror -ansi -std=gnu99 -Os #-DNDEBUG +CFLAGS = -I. -I$(PY_SRC) -Wall -Werror -ansi -std=gnu99 LDFLAGS = -lm +#Debugging/Optimization +ifdef DEBUG +CFLAGS += -Og -ggdb +else +CFLAGS += -Os #-DNDEBUG +endif + # source files SRC_C = \ main.c \ @@ -27,7 +34,9 @@ LIB = -lreadline $(PROG): $(BUILD) $(OBJ) $(ECHO) "LINK $<" $(Q)$(CC) -o $@ $(OBJ) $(LIB) $(LDFLAGS) +ifndef DEBUG $(Q)strip $(PROG) +endif $(Q)size $(PROG) $(BUILD)/%.o: %.c