This will only work in the commands (where simple quoting will also
work), but not in targets and dependencies, which is what the OP
wants.
You probably meant: This will only work in targets and dependencies
but not in commands.
No, I meant what I said, but it looks like I was mistaken, sorry.
Somehow, I remembered Paul saying that file names with blanks cannot
be supported, but my failing memory betrayed me again, or so it seems.
some\ program\ name.exe : some\ file.c other\ file.c
@echo gcc $^ -o $@
some\ file.c other\ file.c :
@echo touch $@
touch some file.c
touch other file.c
gcc some file.c other file.c -o some program name.exe
Of course, in a real-life example, some additional juggling will be
needed, because each file name with spaces needs to be quoted on the
command line, or else:
touch some file.c
touch some file.c
touch other file.c
touch other file.c
gcc some file.c other file.c -o some program name.exe
gcc some file.c other file.c -o some program name.exe
gcc: program: No such file or directory
gcc: name.exe: No such file or directory
make: *** [some program name.exe] Error 1
(And `touch' creates the files `some', `other', and `file.c'.)
Quoting inside $^ is not entirely trivial.