I use strange rules like this a long time ago, but suddenly they break in a new environment.
Is there a reliable way to do this?
all: test.1.out test.%.out: %/test*.out /bin/cp -f $< $@
On my box (ubuntu):
alishan:~/Dropbox/make_insanity> make --version GNU Make 3.81 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This program built for x86_64-pc-linux-gnu alishan:~/Dropbox/make_insanity> make /bin/cp -f 1/test.out test.1.out
There is no problem with this code on other Mac computers, ubuntu machines, ubuntu virtual machines. I donโt know all of my versions, but it looks like OK code.
On my mageia server in the same directory after cleaning.
[ dushoff@yushan make_insanity]$ make --version GNU Make 3.82 Built for x86_64-mageia-linux-gnu Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. [ dushoff@yushan make_insanity]$ make make: *** No rule to make target `test.1.out', needed by `all'. Stop. [ dushoff@yushan make_insanity]$
Changing either % or * to the corresponding text "fixes" the problem, but, of course, does not create the desired generality.
source share