Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have found an interesting "feature" of make

        # testing date (it should be yesterday)
        test ! -z "${DATE}"
        ls -lad ${DIR_INPUT}/{a,c}

but it seems to work in a strange way:

PROMPT# make test
# testing date (it should be yesterday)
test ! -z "20100120"
ls -lad /test/{a,c}
/test/{a,c}: No such file or directory
*** Error code 2
make: Fatal error: Command failed for target `test'

of course if I issue ls -lad /test/{a,c} from my shell works.

Question: how can I get make to evaluate this pattern as the shell would do?

share|improve this question
up vote 1 down vote accepted

You can do this using the shell function, $(shell touch {a..c}), (Maybe the wildcard function as well?):

kbrandt@kbrandt-opadmin:~/scrap/make$ ls
kbrandt@kbrandt-opadmin:~/scrap/make$ vim foo
kbrandt@kbrandt-opadmin:~/scrap/make$ ls
kbrandt@kbrandt-opadmin:~/scrap/make$ cat foo
    $(shell touch {a..c})
kbrandt@kbrandt-opadmin:~/scrap/make$ make -f foo
make: `files' is up to date.
kbrandt@kbrandt-opadmin:~/scrap/make$ ls
a  b  c  foo
share|improve this answer
unfortunately $(shell ) does not exists in Solaris10 version of make... but the answer is correct, it works on my debian – asdmin Mar 5 '10 at 13:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.