Append to beginning of list

Viewed 6551

I have a makefile that lists the source files: (shortened to relevant)

SRCFOLDER=src/
SOURCES= main.cpp
OBJECTS=$(SOURCES:.cpp=.o)

and I would like to concate the strings together, but for each one in SOURCES. As you can see above, I do it for OBJECTS, but I want to do it like this: (pseudocode)

foreach(src in SOURCES)
  src = concate(SRCFOLDER, src)

so that if SOURCES was main.cpp window.cpp, the result would be src/main.cpp src/window.cpp.

I tried this:

SOURCES=$(SOURCES:*=$(SRCFOLDER)/*)

but I get this error:

makefile:12: *** Recursive variable `SOURCES' references itself (eventually). Stop.
1 Answers
Related