aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build-targets.mk9
1 files changed, 6 insertions, 3 deletions
diff --git a/build-targets.mk b/build-targets.mk
index aaff2d0..4b9c880 100644
--- a/build-targets.mk
+++ b/build-targets.mk
@@ -1,5 +1,8 @@
-# main project target
-$(BUILD_PATH)/main.o: $(SRCROOT)/main.cpp
+# Sources to compile
+SRC_FILES = main.cpp
+OBJ_FILES = $(addprefix $(BUILD_PATH)/,$(SRC_FILES:.cpp=.o))
+
+$(BUILD_PATH)/%.o: %.cpp
$(SILENT_CXX) $(CXX) $(CFLAGS) $(CXXFLAGS) $(LIBMAPLE_INCLUDES) $(WIRISH_INCLUDES) -o $@ -c $<
$(BUILD_PATH)/libmaple.a: $(BUILDDIRS) $(TGT_BIN)
@@ -10,7 +13,7 @@ library: $(BUILD_PATH)/libmaple.a
.PHONY: library
-$(BUILD_PATH)/$(BOARD).elf: $(BUILDDIRS) $(TGT_BIN) $(BUILD_PATH)/main.o
+$(BUILD_PATH)/$(BOARD).elf: $(BUILDDIRS) $(TGT_BIN) $(OBJ_FILES)
$(SILENT_LD) $(CXX) $(LDFLAGS) -o $@ $(TGT_BIN) $(BUILD_PATH)/main.o -Wl,-Map,$(BUILD_PATH)/$(BOARD).map
$(BUILD_PATH)/$(BOARD).bin: $(BUILD_PATH)/$(BOARD).elf