fixed daisysp makefile to work with cpp sources.
@@ -45,6 +45,8 @@ BUILD_DIR = build
# C sources
C_SOURCES += $(addsuffix .c, $(MODULE_DIR)/$(MODULES))
+# CPP sources
+CPP_SOURCES += $(addsuffix .cpp, $(MODULE_DIR)/$(MODULES))
#######################################
# binaries
@@ -54,6 +56,7 @@ PREFIX = arm-none-eabi-
# either it can be added to the PATH environment variable.
ifdef GCC_PATH
CC = $(GCC_PATH)/$(PREFIX)gcc
+CXX = $(GCXX_PATH)/$(PREFIX)g++
AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp
CP = $(GCC_PATH)/$(PREFIX)objcopy
SZ = $(GCC_PATH)/$(PREFIX)size
@@ -61,6 +64,7 @@ AR = $(GCC_PATH)/$(PREFIX)ar
GDB = $(GCC_PATH)/$(PREFIX)gdb
else
CC = $(PREFIX)gcc
+CXX = $(PREFIX)g++
AS = $(PREFIX)gcc -x assembler-with-cpp
CP = $(PREFIX)objcopy
SZ = $(PREFIX)size
@@ -111,6 +115,11 @@ endif
# Generate dependency information
CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)"
+CPPFLAGS = $(CFLAGS)
+CPPFLAGS += \
+-fno-exceptions \
+-finline-functions
+
#######################################
# LDFLAGS
#######################################
@@ -132,17 +141,17 @@ all: $(BUILD_DIR)/$(TARGET).a
# list of objects
OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
vpath %.c $(sort $(dir $(C_SOURCES)))
+OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(CPP_SOURCES:.cpp=.o)))
+vpath %.cpp $(sort $(dir $(CPP_SOURCES)))
# list of ASM program objects
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
vpath %.s $(sort $(dir $(ASM_SOURCES)))
-#$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
-# $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
-
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
$(CC) -c $(CFLAGS) -static -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
- #$(CC) -Wall $(CFLAGS) -static $< -o $@
+$(BUILD_DIR)/%.o: %.cpp Makefile | $(BUILD_DIR)
+ $(CXX) -c $(CPPFLAGS) -static -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.cpp=.lst)) $< -o $@
$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
$(AS) -c $(CFLAGS) $< -o $@
