MakeFiles and dependencies

Posted by Michael on Stack Overflow See other posts from Stack Overflow or by Michael
Published on 2010-03-20T16:46:13Z Indexed on 2010/03/20 17:41 UTC
Read the original article Hit count: 399

Filed under:

Hello, I'm writing a makefile and I can't figure out how to include all my source files without having to write all source file I want to use. Here is the makefile I'm currently using:

GCC = $(GNUARM_HOME)\bin\arm-elf-gcc.exe
SOURCES=ShapeApp.cpp Square.cpp Circle.cpp Shape.cpp
OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=hello

all: $(EXECUTABLE)

$(EXECUTABLE): $(OBJECTS) 
#$(CC) $(LDFLAGS) $(OBJECTS) -o $@

.cpp.o:
    $(GCC) -c $< -o $@

How do I automatically add new source file without having to add it to the sources line?

© Stack Overflow or respective owner

Related posts about makefile