GNU Make 3.80 on Windows 11
I have a list of files and a list of destinations. I need to write a rule that will copy each file to its corresponding destination (in a specified subdirectory). Note, there is no pattern to the filenames, they are manually maintained lists; the only requirement is that the files (in ADDFILES) exist.
Essentially, something like this (extra spacing for visual clarity):
ADDFILES = Makefile ../Docs/test.log images/screen.jpg
ASFILES = Makefile test.log images/screen.jpg
DESTDIR = Others/
$(addprefix $(DESTDIR),$(ASFILES)): $(ADDFILES)
copy $< $@
Obviously, that rule does not work.
The results should be
copy Makefile Others/Makefile
copy ../Docs/test.log Others/test.log
copy images/screen.jpg Others/images/screen.jpg
I tried with no prerequisite and with $(ADDFILES) as the prerequisite.
With the prerequisite ($ADDFILES), $<
is always the first word in the list (lower-cased for some reason). Without a prerequisite, $<
is blank.
I am not terribly fluent in make. I have been searching, and coming close, but I can’t get this to work. Is it possible at all? Remember, I am running on Windows, with no *nix-type shell available.