Question

I have a Makefile for Nmake containing a list of files in a macro:

MYSRCFILES1=myfolder\file1.svg myfolder\file2.svg ... myfolder\file99.svg

and a second one just like this:

MYSRCFILES2=myfolder2\file1.svg myfolder2\file2.svg ... myfolder2\file99.svg

What I am trying is to avoid duplication of the list of files, and to avoid duplication of the folder names, something like this:

MYSRCFILES0=file1.svg file2.svg file3.svg

MYSRCFILES1="prepend 'myfolder\' to each element of $(MYSRCFILES0)"

MYSRCFILES2="prepend 'myfolder2\' to each element of $(MYSRCFILES0)"

Digging myself through the documentation of Nmake I haven't found a solution so far. Any idea how to accomplish this?

Was it helpful?

Solution

Finally found a solution for my problem, it's not perfect since I have to add a .\ to every file but that seems to be ok in my case:

 MYSRCFILES0=.\file1.svg .\file2.svg .\file3.svg ...

 MYSRCFILES1=$(MYSRCFILES0:.\=myfolder\)

 MYSRCFILES2=$(MYSRCFILES0:.\=myfolder2\)

does the trick.

OTHER TIPS

Is Nmake simillar to make? You can use patsubst ("pattern substitute string") function like this:

MYSRCFILES0=.\file1.svg .\file2.svg .\file3.svg ...
MYSRCFILES1=$(patsubst %,myFolder/%,MYSRCFILES0)
MYSRCFILES2=$(patsubst %,myFolder2/%,MYSRCFILES0)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top