From 422a4c67554f31570f06fab0469b094e985b3675 Mon Sep 17 00:00:00 2001 From: Gregwar Date: Tue, 11 Nov 2014 20:08:20 +0100 Subject: [Makefile] Easier adding of sources MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Grégoire Passault , Quentin Rouxel --- build-targets.mk | 9 ++++++--- 1 file 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 -- cgit v1.2.3