I have a makefile that lists the source files: (shortened to appropriate)
SRCFOLDER=src/ SOURCES= main.cpp OBJECTS=$(SOURCES:.cpp=.o)
and I would like to combine the lines together, but for each in SOURCES
. As you can see above, I am doing this for OBJECTS
, but I want to do it like this: (pseudocode)
foreach(src in SOURCES) src = concate(SRCFOLDER, src)
so 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.
source share