bna3p45vnh
bna3p45vnh

Reputation: 141

Create a list of string variable in makefile

FILES = Y_4_X_0.log \
        Y_4_X_1.log \
        Y_4_X_2.log \
        Y_5_X_0.log \
        Y_5_X_1.log \
        Y_5_X_2.log

Say I want to create a variable like this. Is there a clean/readable way of doing this without using addsuffix, addprefix, etc?

Upvotes: 1

Views: 2246

Answers (1)

MadScientist
MadScientist

Reputation: 100856

There's not really enough information here to know what you want to do and what the requirements are (does "clean/readable" mean "without using any functions", or is there something about addsuffix and addprefix specifically that you don't like?)

Anyway, something like this will work for the small example you provide:

EXTS := 0 1 2
BASES := 4 5

FILES := $(foreach B,$(BASES),$(foreach E,$(EXTS),Y_$B_X_$E.log))

Upvotes: 3

Related Questions