rgrinberg
rgrinberg

Reputation: 9878

Makefile not expanding glob because of zsh?

I have a line in my Makefile that's about something like that:

prog /something/f.{one,two,three}

but running the make file I get from prog that

/something/f.{one,two,three} does not exist. Which leads me to believe that make is not expanding the glob. Normally this would work for me in Bash but I'm running zshell now so I think that's the problem. Anyone know how to specify that pattern portably?

Upvotes: 1

Views: 788

Answers (2)

Tuxdude
Tuxdude

Reputation: 49543

An alternative to what ThePosey suggested would be making use of addprefix:

FILE_SUFFIXES := one two three
FILE_BASE := /something/f

FILES := $(addprefix $(FILE_BASE).,$(FILE_SUFFIXES))

my_rule:
    prog $(FILES)

Upvotes: 1

ThePosey
ThePosey

Reputation: 2734

Does it have to be shell expanded? Make can do something similar for you. This is just one way to do it:

EXPANDED_POSTFIX := one two three
BASE_FILE := f.

PROG_FILE_LIST := $(foreach post,${EXPANDED_POSTFIX},${BASE_FILE}${post})

exec_prog:
    prog ${PROG_FILE_LIST}

Upvotes: 1

Related Questions