3

I have found an interesting "feature" of make

DIR_INPUT=/test
test:
        # 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'
PROMPT#

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?

asdmin
  • 2,020
  • 16
  • 28

1 Answers1

4

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

kbrandt@kbrandt-opadmin:~/scrap/make$ ls
foo
kbrandt@kbrandt-opadmin:~/scrap/make$ vim foo
kbrandt@kbrandt-opadmin:~/scrap/make$ ls
foo
kbrandt@kbrandt-opadmin:~/scrap/make$ cat foo
files:
    $(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
kbrandt@kbrandt-opadmin:~/scrap/make$
Kyle Brandt
  • 82,107
  • 71
  • 302
  • 444
  • unfortunately $(shell ) does not exists in Solaris10 version of make... but the answer is correct, it works on my debian – asdmin Mar 05 '10 at 13:30