changeset 209:5f53b838b742

Updated Makefile to include debug mode (make debug)
author Giulio Moro <giuliomoro@yahoo.it>
date Mon, 08 Feb 2016 22:50:39 +0000
parents 35fc8bfc240b
children e23c304d264f
files Makefile
diffstat 1 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Mon Feb 08 01:54:25 2016 +0000
+++ b/Makefile	Mon Feb 08 22:50:39 2016 +0000
@@ -36,10 +36,18 @@
 DEFAULT_MAIN_OBJS := ./build/core/default_main.o
 DEFAULT_MAIN_CPP_DEPS := ./build/core/default_main.d
 
-# All = build BeagleRT
+CPP_FLAGS=-O2
+C_FLAGS=-O2
+
+# all = build BeagleRT 
 all: SYNTAX_FLAG :=
 all: BeagleRT
 
+# debug = buildBeagleRT debug
+debug: CPP_FLAGS=-g
+debug: C_FLAGS=-g
+debug: all
+
 # syntax = check syntax
 syntax: SYNTAX_FLAG := -fsyntax-only
 syntax: BeagleRT
@@ -48,7 +56,7 @@
 build/core/%.o: ./core/%.cpp
 	@echo 'Building file: $<'
 	@echo 'Invoking: GCC C++ Compiler'
-	g++ $(SYNTAX_FLAG) $(INCLUDES) -O2 -Wall -c -fmessage-length=0 -U_FORTIFY_SOURCE -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
+	g++ $(SYNTAX_FLAG) $(INCLUDES) $(CPP_FLAGS) -Wall -c -fmessage-length=0 -U_FORTIFY_SOURCE -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
 	@echo 'Finished building: $<'
 	@echo ' '
 
@@ -56,7 +64,7 @@
 build/source/%.o: ./source/%.cpp
 	@echo 'Building file: $<'
 	@echo 'Invoking: GCC C++ Compiler'
-	g++ $(SYNTAX_FLAG) $(INCLUDES) -O2 -Wall -c -fmessage-length=0 -U_FORTIFY_SOURCE -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
+	g++ $(SYNTAX_FLAG) $(INCLUDES) $(CPP_FLAGS) -Wall -c -fmessage-length=0 -U_FORTIFY_SOURCE -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
 	@echo 'Finished building: $<'
 	@echo ' '
 
@@ -64,7 +72,7 @@
 build/source/%.o: ./source/%.c
 	@echo 'Building file: $<'
 	@echo 'Invoking: GCC C Compiler'
-	gcc $(SYNTAX_FLAG) $(INCLUDES) -O2 -Wall -c -fmessage-length=0 -U_FORTIFY_SOURCE -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<" -std=c99 -mfpu=neon
+	gcc $(SYNTAX_FLAG) $(INCLUDES) $(C_FLAGS) -Wall -c -fmessage-length=0 -U_FORTIFY_SOURCE -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<" -std=c99 -mfpu=neon
 	@echo 'Finished building: $<'
 	@echo ' '
 
@@ -120,5 +128,5 @@
 post-build:
 # Nothing to do here (for now)
 
-.PHONY: all clean distclean sourceclean dependents
+.PHONY: all clean distclean sourceclean dependents debug
 .SECONDARY: post-build