From 39f6c9eb5f9a423d0c7d5d1719822768e08e9f66 Mon Sep 17 00:00:00 2001 From: Frantisek Burian Date: Sat, 4 Jan 2014 14:41:51 +0100 Subject: [PATCH] [FIX] Correct the compilation of C++ files (prepared for the future) --- examples/Makefile.rules | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/examples/Makefile.rules b/examples/Makefile.rules index a3392a5..f75811e 100644 --- a/examples/Makefile.rules +++ b/examples/Makefile.rules @@ -29,8 +29,10 @@ endif PREFIX ?= arm-none-eabi CC = $(PREFIX)-gcc -CPP = $(PREFIX)-g++ +CXX = $(PREFIX)-g++ LD = $(PREFIX)-gcc +AR = $(PREFIX)-ar +AS = $(PREFIX)-as OBJCOPY = $(PREFIX)-objcopy OBJDUMP = $(PREFIX)-objdump GDB = $(PREFIX)-gdb @@ -75,11 +77,11 @@ CFLAGS += -I$(INCLUDE_DIR) # C++ flags -CPPFLAGS += -Os -g $(ARCH_FLAGS) -MD $(DEFS) -CPPFLAGS += -Wall -Wextra -Wimplicit-function-declaration -CPPFLAGS += -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -CPPFLAGS += -Wundef -Wshadow -fno-common -CPPFLAGS += -I$(INCLUDE_DIR) +CXXFLAGS += -Os -g $(ARCH_FLAGS) -MD $(DEFS) +CXXFLAGS += -Wall -Wextra -Wimplicit-function-declaration +CXXFLAGS += -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes +CXXFLAGS += -Wundef -Wshadow -fno-common +CXXFLAGS += -I$(INCLUDE_DIR) # Linker flags @@ -130,11 +132,15 @@ flash: $(BINARY).flash %.o: %.c @#printf " CC $(*).c\n" - $(Q)$(CC) $(CFLAGS) -o $(*).o -c $(*).c + $(Q)$(CC) $(CFLAGS) $(CPPFLAGS) -o $(*).o -c $(*).c + +%.o: %.cxx + @#printf " CXX $(*).cxx\n" + $(Q)$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $(*).o -c $(*).cxx %.o: %.cpp - @#printf " CPP $(*).cpp\n" - $(Q)$(CPP) $(CPPFLAGS) -o $(*).o -c $(*).cpp + @#printf " CXX $(*).cpp\n" + $(Q)$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $(*).o -c $(*).cpp clean: @#printf " CLEAN\n"