Make: Can implicit rules be forced to make non-existing prerequisites?

"Jan T. Kim" <[email protected]>
Newsgroups gmane.comp.gnu.utils
Organization http://groups.google.com
Message-ID <[email protected]>
Dear all,

I want to set up a Makefile to handle installation and checking etc.
of a bunch of R packages, and I'd like to be able to add a new
package by just adding the new name to a variable. I use implicit
rules to try and pull this off. The problem I run into is that make
cannot
be bothered to make prerequisites required by an implicit rule, but in
my
case, that's what I need.

Here's my Makefile:

RPACKS                  = xpipe jtkstuff
RPACKS_INSTALL          = $(RPACKS:%=%-install)
RPACKS_UNINSTALL        = $(RPACKS:%=%-uninstall)
RPACKS_CHECK            = $(RPACKS:%=%-check)

install : $(RPACKS_INSTALL)

# explicit rule: target is unconditionally made
jtkstuff-install :
        echo target: $@ prerequisites: $^
        R CMD INSTALL jtkstuff

# implicit rule: nothing is made
%-install :
        echo target: $@ prerequisites: $^
        R CMD INSTALL $*

.PHONY : install uninstall check clean $(RPRACKS) $(RPACKS_INSTALL)

make -n -d install shows the problem:

Updating goal targets....
Considering target file `install'.
 File `install' does not exist.
  Considering target file `xpipe-install'.
   File `xpipe-install' does not exist.
   Finished prerequisites of target file `xpipe-install'.
  Must remake target `xpipe-install'.
  Successfully remade target file `xpipe-install'.
  Considering target file `jtkstuff-install'.
   File `jtkstuff-install' does not exist.
   Finished prerequisites of target file `jtkstuff-install'.
  Must remake target `jtkstuff-install'.
echo target: jtkstuff-install prerequisites:
R CMD INSTALL jtkstuff
  Successfully remade target file `jtkstuff-install'.
 Finished prerequisites of target file `install'.
Must remake target `install'.
Successfully remade target file `install'.

Obviously, make handles the explicit jtkstuff-install rule differently
from the implicit %-install rule in that it does execute the commands
for the former while it considers the implicitly specified target
xpipe-install to be remade without actually doing anything.

Is there any way to change this behaviour?

Regards & thanks in advance, Jan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.