help-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Make: Can implicit rules be forced to make non-existing prerequisite


From: James
Subject: Re: Make: Can implicit rules be forced to make non-existing prerequisites?
Date: 7 Aug 2006 10:02:47 -0700
User-agent: G2/0.2

Jan T. Kim wrote:
> 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

How about commenting out .PHONY line?

James



reply via email to

[Prev in Thread] Current Thread [Next in Thread]