Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Makefile prepend and append all elements in array

Tags:

makefile

I'm writing a Makefile, I have a list of all the files (without src/ or .cpp), and I want to convert those to build/*.o. Here's what I've tried already:

FILES=icxxabi list memory string
OBJECTS=$(echo ("${build/$$FILES[@].o}")[@])

So for the input a dir/b c, it should output:

build/a.o build/dir/b.o build/c.o
like image 541
Chris Smith Avatar asked Jul 22 '16 18:07

Chris Smith


1 Answers

With GNU Make, you could try

OBJECTS=$(patsubst %, build/%.o, $(FILES))
like image 122
ccorn Avatar answered Sep 22 '22 20:09

ccorn